-
Notifications
You must be signed in to change notification settings - Fork 219
Do not append an empty buffer to S3 during file handle RELEASE or FLUSH #1591
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ where | |
request, | ||
initial_etag, | ||
written_bytes: 0, | ||
previously_flushed: false, | ||
}) | ||
} else { | ||
let request = fs | ||
|
@@ -119,6 +120,7 @@ pub enum UploadState<Client: ObjectClient + Send + Sync> { | |
request: AppendUploadRequest<Client>, | ||
initial_etag: Option<ETag>, | ||
written_bytes: usize, | ||
previously_flushed: bool, | ||
}, | ||
MPUInProgress { | ||
request: UploadRequest<Client>, | ||
|
@@ -196,6 +198,7 @@ where | |
request, | ||
initial_etag, | ||
written_bytes, | ||
.. | ||
} => { | ||
let current_offset = request.current_offset(); | ||
match Self::commit_append(request, &handle.location).await { | ||
|
@@ -212,6 +215,7 @@ where | |
request, | ||
initial_etag, | ||
written_bytes, | ||
previously_flushed: true, // Mark that the "append" has seen a Flush at least once | ||
}; | ||
Ok(()) | ||
} | ||
|
@@ -240,8 +244,12 @@ where | |
open_pid: u32, | ||
) -> Result<(), Error> { | ||
match self { | ||
UploadState::AppendInProgress { written_bytes, .. } => { | ||
if *written_bytes == 0 || !are_from_same_process(open_pid, pid) { | ||
UploadState::AppendInProgress { | ||
written_bytes, | ||
previously_flushed, | ||
.. | ||
} => { | ||
if (*written_bytes == 0 && !*previously_flushed) || !are_from_same_process(open_pid, pid) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks that addition of
what's the reasoning, why is this desired? also may it break behaviour of tools like |
||
// Commit current changes, but do not close the write handle. | ||
return self.commit(fs, handle).await; | ||
} | ||
|
@@ -296,8 +304,16 @@ where | |
) -> Result<bool, Error> { | ||
match self { | ||
UploadState::AppendInProgress { | ||
request, initial_etag, .. | ||
request, | ||
initial_etag, | ||
written_bytes, | ||
previously_flushed, | ||
} => { | ||
// No data upload should be pending completion as part of the release - if we have not written anything locally AND we already committed on a preceding Flush | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would clarify here, that with this if we're skipping an S3 request, since we know that it happened before (and an empty object was already created) |
||
if written_bytes == 0 && previously_flushed { | ||
Self::finish(fs, ino, initial_etag).await; | ||
return Ok(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the reasoning for returning |
||
} | ||
Self::complete_append(fs, ino, key, request, initial_etag).await?; | ||
Ok(true) | ||
} | ||
|
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.
Oh I need to fix this condition to move
if (*written_bytes == 0 && *previously_flushed && are_from_same_process(open_pid, pid)) return Ok(())
condition inside so we don't go to the code on line 280