Skip to content

Emit all messages across sequence number gaps in messagesWithBatch (#517)#521

Merged
pjfanning merged 1 commit into
apache:1.3.xfrom
pjfanning:journal-del-1.3
Jun 14, 2026
Merged

Emit all messages across sequence number gaps in messagesWithBatch (#517)#521
pjfanning merged 1 commit into
apache:1.3.xfrom
pjfanning:journal-del-1.3

Conversation

@pjfanning

Copy link
Copy Markdown
Member

cherry pick 40cdd6d #517

…pache#517)

* Emit all messages across sequence number gaps in messagesWithBatch apache#516

* The query windowing introduced by apache#180 treated a windowed batch returning
  fewer messages than batchSize as the end of the journal: bounded streams
  (recovery, currentEventsByPersistenceId) completed early and silently
  dropped every message beyond a gap left by deleted messages, and live
  streams stalled forever polling an empty window. apache#195 fixed only the gap
  at the head of the journal.
* Rework the unfoldAsync state from FlowControl into a QueryPlan state
  machine (QueryRemaining, QueryWindow, PollRemaining, Complete): a short
  windowed batch is no longer conclusive and falls back to one query over
  the full remaining range, which gaps cannot hide messages from.
* Keep windowing as the dense fast path of apache#180: after a full batch shows
  the journal to be dense, queries stay bounded to [from, from + batchSize].
* Span the full remaining range on the first query, crossing a deleted
  journal head (snapshot cleanup) in a single round trip, subsuming the
  apache#195 special case.
* Poll the full remaining range when tailing: a windowed poll can never
  reach messages appended beyond a trailing gap.
* Specify the gap state machine in MessagesWithBatchTest (core, in-memory
  journal stub) and the database-coupled behavior in
  MessagesWithBatchDatabaseContractTest (H2 plus the five integration
  databases): hard and soft deletes, a prefix purge through the journal's
  delete, and serialization failures.

* Use a non-empty writer in the corrupt-row test fixture

Oracle treats the empty string as NULL, so inserting the synthetic
corrupt row with writer = "" violated the NOT NULL constraint on
EVENT_JOURNAL.WRITER (ORA-01400) and failed only the Oracle integration
tests. The production write path always carries a writer UUID, so this is
a test-fixture-only fix.

* Use the standard Apache header on the new test files

These files contain no Akka-derived code, so they should carry the full
ASF header (the headerLicense the build stamps on new files) rather than
the shorter "derived from Akka" variant, per a maintainer review note.

* Note batchSize+1 window width in LimitWindowingStreamTest
@pjfanning pjfanning merged commit a410f9d into apache:1.3.x Jun 14, 2026
28 checks passed
@pjfanning pjfanning deleted the journal-del-1.3 branch June 14, 2026 15:59
@pjfanning pjfanning added this to the 1.3.0 milestone Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants