Skip to content

Commit cd48ae3

Browse files
committed
fix(qwp): cover flushAndGetSequence's residual seal in the commit boundary
Self-review finding: flushAndGetSequence() has the same belt-and-braces residual sealAndSwapBuffer() as close(), but the commit-boundary update was only added to close()'s copy. A non-deferred residual publish there left lastCommitBoundaryFsn stale, so drainOnClose targeted a lower FSN and close() could return before the residual frame's ack -- memory-mode data loss on JVM exit, the exact bug class this series fixes.
1 parent c6eadf0 commit cd48ae3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core/src/main/java/io/questdb/client/cutlass/qwp/client/QwpWebSocketSender.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,13 @@ public long flushAndGetSequence() {
15331533
}
15341534
if (activeBuffer != null && activeBuffer.hasData()) {
15351535
sealAndSwapBuffer();
1536+
if (!deferCommit) {
1537+
// Same residual-seal boundary update as close(): a
1538+
// non-deferred residual publish is commit-bearing and must be
1539+
// covered by close-time drains, or drainOnClose would return
1540+
// before its ack and memory-mode data could be lost on exit.
1541+
lastCommitBoundaryFsn = cursorEngine.publishedFsn();
1542+
}
15361543
}
15371544
cursorSendLoop.checkError();
15381545
checkConnectionError();

0 commit comments

Comments
 (0)