Skip to content

Commit 996a458

Browse files
committed
Add single-writer invariant comment for fetch position fields
Document why nextFetchChunkIndex and nextFetchRowOffset are safe as separate AtomicLongs (single prefetch thread writer) unlike StreamingChunkProvider which needs a bundled FetchPosition holder. Signed-off-by: Gopal Lal <gopal.lal@databricks.com> Co-authored-by: Isaac Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
1 parent 5aaeb03 commit 996a458

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/com/databricks/jdbc/api/impl/arrow/SeaInlineArrowChunkProvider.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ class SeaInlineArrowChunkProvider implements ChunkProvider {
5353
// Position tracking
5454
private final AtomicLong currentChunkIndex = new AtomicLong(-1);
5555
private final AtomicLong highestFetchedChunkIndex = new AtomicLong(-1);
56+
// Single-writer: nextFetchChunkIndex and nextFetchRowOffset are only written by
57+
// the prefetch thread (fetchNextChunkInternal), so separate AtomicLongs are safe.
58+
// Unlike StreamingChunkProvider where download threads can also update the position
59+
// (requiring a bundled FetchPosition holder), this provider has no second writer.
5660
private final AtomicLong nextFetchChunkIndex = new AtomicLong(1); // 0 is initial chunk
5761
private final AtomicLong nextFetchRowOffset = new AtomicLong(0);
5862
private final AtomicLong totalRowCount = new AtomicLong(0);

0 commit comments

Comments
 (0)