github-actions[bot] commented on code in PR #63480:
URL: https://github.com/apache/doris/pull/63480#discussion_r3287003863


##########
fe/fe-core/src/main/java/org/apache/doris/job/offset/jdbc/JdbcSourceOffsetProvider.java:
##########
@@ -87,7 +87,7 @@ public class JdbcSourceOffsetProvider implements 
SourceOffsetProvider {
     List<SnapshotSplit> remainingSplits = new ArrayList<>();
     List<SnapshotSplit> finishedSplits = new ArrayList<>();
 
-    JdbcOffset currentOffset;
+    volatile JdbcOffset currentOffset;

Review Comment:
   This field is also written by the 
`JdbcTvfSourceOffsetProvider.updateOffset()` override. That path still does 
`this.currentOffset = (JdbcOffset) offset` before it copies `tableId` / split 
bounds from `remainingSplits` and before it updates `finishedSplits` / 
`chunkHighWatermarkMap` under `splitsLock` 
(`JdbcTvfSourceOffsetProvider.java:267-297`). Because this PR makes the 
inherited field volatile, TVF-job readers such as `getShowCurrentOffset()`, 
`hasMoreDataToConsume()`, and persistence can now observe the just-published 
snapshot offset while its `SnapshotSplit` objects are still partially 
populated. The base-class `updateOffset()` was fixed to publish last, but the 
override needs the same treatment (build/mutate a local `JdbcOffset`, update 
the split bookkeeping under the lock, then assign `currentOffset`). This is a 
separate instance from the existing thread because it is in the TVF 
offset-provider override rather than the base provider method.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to