-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Complete empty uploads #10608
Complete empty uploads #10608
Conversation
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.
Code looks good, but I'm fairly certain that a multipart upload with zero parts is rejected by the s3 API. Please verify against s3 before merging.
fa920dd
to
f3742bd
Compare
f3742bd
to
0019ff5
Compare
Note to myself and others, please do not squash these commits - they were intentionally rebased and separated this way because some of them need to be backported further than others. |
0019ff5
to
7667328
Compare
@zmb3 Looks like this was approved, can you merge? |
Just waiting on tests to pass. Rotate trusted clusters is still a bit flaky. |
The upload completer scans for uploads that need to be completed, likely due to an error or process restart. Prior to this change, it only completed uploads that had 1 or more parts. Since completing an upload is what cleans up the directory on disk (or in the case of cloud storage, finishes the multipart upload), it was possible for us to leave behind empty directories (or multipart uploads) for uploads with no parts. This change makes it valid to complete uploads with no parts, which ensures that these directories get cleaned up. Also fix an issue with the GCS uploader, which failed to properly calculate the upload ID from the path. This is because strings.Split(s, "/") returns an empty string as the last element when s ends with a /. Updates #9646
Ensure that the logic which checks for (and emits) a session.end event also applies for windows.desktop.session.end events. For this to work, we use the StreamSessionEvents API instead of GetEvents. This is because the streaming API works for any stream of audit events, and GetSessionEvents is specific to SSH and the chunks index format used by SSH sessions. Lastly, ensure that desktop related events are also captured in the session recording stream (but omitted when streaming the events to the browser during session playback). This allows us to use the start event in order to reconstruct a missing end event.
When completing a file-based upload, open the parts files one at a time and write them to the upload, closing each file before opening the next one. This is preferrable to opening them all at once and closing all files at the end, because it consumes less file descriptors. Updates #10660
7667328
to
ac33851
Compare
The upload completer scans for uploads that need to be completed,
likely due to an error or process restart. Prior to this change,
it only completed uploads that had 1 or more parts. Since completing
an upload is what cleans up the directory on disk, it was possible
for us to leave behind empty directories for uploads with no parts.
This change makes it valid to complete uploads with no parts, which
ensures that these directories get cleaned up.
In addition, the upload completer checks the upload for a session.end
event, and emits one if there is not already an end event present.
This logic only handled session.end, and not
windows.desktop.session.end, so that has been updated as well.
Updates #9646