Skip to content

Commit f333cb1

Browse files
committed
Fix ThreadSanitizer data races between bundle processing and async background writer closing in FileBasedSink and WriteFiles
1 parent aa8869c commit f333cb1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -905,15 +905,15 @@ public abstract static class Writer<DestinationT, OutputT> {
905905
private final WriteOperation<DestinationT, OutputT> writeOperation;
906906

907907
/** Unique id for this output bundle. */
908-
private @Nullable String id;
908+
private volatile @Nullable String id;
909909

910-
private @Nullable DestinationT destination;
910+
private volatile @Nullable DestinationT destination;
911911

912912
/** The output file for this bundle. May be null if opening failed. */
913-
private @Nullable ResourceId outputFile;
913+
private volatile @Nullable ResourceId outputFile;
914914

915915
/** The channel to write to. */
916-
private @Nullable WritableByteChannel channel;
916+
private volatile @Nullable WritableByteChannel channel;
917917

918918
/**
919919
* The MIME type used in the creation of the output channel (if the file system supports it).

0 commit comments

Comments
 (0)