-
Notifications
You must be signed in to change notification settings - Fork 85
fix: fix appendable upload finalization race condition #3295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When finalizing an appendable upload depending on how quickly gcs is acking bytes, we could run into a case where finish_write: true was sent before all bytes had been enqueued. Regression introduced in 2.57.0
if (i < lastIdx && !shouldFlush) { | ||
appended = stream.append(datum); | ||
} else if (i == lastIdx && nextWriteShouldFinalize) { | ||
} else if (i == lastIdx && remainingAfterPacking == 0 && nextWriteShouldFinalize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are the actual fix
totalSentBytes, | ||
confirmedBytes, | ||
size | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding more info to the diagnostic to make it more useful in the future.
@Rule public final TestName testName = new TestName(); | ||
|
||
@Test | ||
public void appendAndFinalizeOnlyPerformedIfAllBytesConsumed() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test to verify the fix
} | ||
} | ||
|
||
private static BidiStreamingCallable<BidiWriteObjectRequest, BidiWriteObjectResponse> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into BidiUploadTestUtils.java for sharing
Was this caught somewhere? Is there a bug with context? |
b/445496061 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Sync'd with Ben earlier / was discussed in biweekly.
When finalizing an appendable upload depending on how quickly gcs is acking bytes, we could run into a case where finish_write: true was sent before all bytes had been enqueued. Regression introduced in 2.57.0
When finalizing an appendable upload depending on how quickly gcs is acking bytes, we could run into a case where finish_write: true was sent before all bytes had been enqueued.
Regression introduced in 2.57.0