b2-sdk-java icon indicating copy to clipboard operation
b2-sdk-java copied to clipboard

Better retry of b2_finish_large_file

Open bwbeach opened this issue 7 years ago • 0 comments

There has been a problem with finishing large files. Sometimes the response from b2_finish_large_file is lost, which can happen because of a request timeout or broken connection. When that happens, the client can't tell whether the file was finished or not. Trying to finish the file again will return a `400 Bad Request' because the file is already finished.

Recently, a race condition has been fixed in the B2 service. Now, if there is a request to finish a file in progress, another call to b2_finish_large_file guarantees not to return a 400 until that request completes. Now, after you get a 400 back when trying to finish a file, you can call b2_get_file_info and get an accurate answer as to whether the file was finished.

Now, the SDK needs to be extended to check whether finishing a file succeeded if a 400 is returned from b2_finish_large_file.

bwbeach avatar Jun 05 '18 20:06 bwbeach