-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Make createExclusive atomic: fix GcsTransactionLogSynchronizer atomicity with GCS native filesystem implementation #20180
Conversation
56519b4
to
b956dfd
Compare
lib/trino-filesystem/src/main/java/io/trino/filesystem/tracing/TracingOutputFile.java
Outdated
Show resolved
Hide resolved
42075fc
to
220dc37
Compare
220dc37
to
a6e20b0
Compare
/** | ||
* Specifies whether implementation supports {@link TrinoOutputFile#create()} is exclusive. | ||
*/ | ||
protected boolean isCreateExclusive() |
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 methods are pretty close in naming which can be rather misleading.
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.
that's why they got a javadoc. do you want to suggest better names?
When defining test profiles, we don't use properties.
315917c
to
6297459
Compare
@@ -63,11 +71,22 @@ public abstract class AbstractTestTrinoFileSystem | |||
|
|||
protected abstract void verifyFileSystemIsEmpty(); | |||
|
|||
protected boolean supportsCreateExclusive() | |||
/** | |||
* Specifies whether implementation supports {@link TrinoOutputFile#create()} is exclusive. |
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.
nit: drop supports
`GcsTransactionLogSynchronizer` requires that the new transaction log file is created exclusively and atomically. Otherwise concurrent readers of a table may see a file partially written (or not written yet, just empty) and fail. This commit: - fixes the GCS native filesystem implementation so that it's atomic - changes the method signature to indicate atomic creation and remove default not atomic implementation. - makes it clear in-memory buffering occurs (previously it was implicitly done in `HdfsOutputFile` which could be considered surprising) - in `AbstractTestTrinoFileSystem` decouples "is create() exclusive" and "supports createExclusive" behaviors. For example local filesystem has the former, GCS filesystem has both and S3 filesystem has none.
6297459
to
b23725c
Compare
GcsTransactionLogSynchronizer
requires that the new transaction log file is created exclusively and atomically. Otherwise concurrent readers of a table may see a file partially written (or not written yet, just empty) and fail. This commit:HdfsOutputFile
which could be considered surprising)Fixes #20168
Required by #19991