Samrat002 opened a new pull request, #28190:
URL: https://github.com/apache/flink/pull/28190

   ## What is the purpose of the change
   
   This PR fixes two real concurrency bugs and adds missing thread-safety 
annotations across flink-s3-fs-native to aid future maintainability. 
   
   
   
   
   ## Brief change log
   
     - NativeS3FileSystemFactory: flinkConfig and bucketConfigProvider are 
mutable fields written in configure() and read in create(), potentially from 
different threads with no 
     happens-before guarantee. Added volatile to both fields and stashed 
bucketConfigProvider into a local variable before use (prevents a TOCTOU race 
between the null-check and
     dereference on a volatile read). 
     - NativeS3InputStream: closed was annotated both @GuardedBy("lock") and 
volatile — a contradiction, since volatile implies lock-free access while 
@GuardedBy requires the
     lock. All reads and writes of closed are already inside the ReentrantLock, 
so volatile was misleading and unnecessary. Removed volatile.
     
     ### Annotation hygiene:
     - Added @ThreadSafe class annotation to: NativeS3FileSystem, 
S3ClientProvider, NativeS3InputStream, NativeS3OutputStream, 
NativeS3BulkCopyHelper, NativeS3FileSystemFactory, 
     NativeS3RecoverableWriter, NativeS3ObjectOperations, NativeS3Committer, 
NativeS3DelegationTokenReceiver, NativeS3DelegationTokenProvider,
     DynamicTemporaryAWSCredentialsProvider                                     
                                                                                
                  
     - Added @NotThreadSafe to S3ClientProvider.Builder (mutable builder, 
standard pattern)
     - Added @GuardedBy("lock") to NativeS3OutputStream.position and 
fileUploaded
     - Added @Immutable to four inner result classes in 
NativeS3ObjectOperations: UploadPartResult, PutObjectResult, 
CompleteMultipartUploadResult, ObjectMetadata 
   
   
   ## Verifying this change
   Existing UT and e2e test over the large cluster
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no 
     - The S3 file system connector: yes
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? no
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change the checkbox below to `[X]` followed by the name of the tool, and 
uncomment the
   "Generated-by" line. See the ASF Generative Tooling Guidance for details:
   https://www.apache.org/legal/generative-tooling.html
   
   You are responsible for the quality and correctness of every change in this 
PR
   regardless of the tooling used. Low-effort AI-generated PRs will be closed. 
See
   AGENTS.md for the full guidance.
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name and Version]
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to