Commit Graph
1 Commits
Author SHA1 Message Date
Chris LuandClaude Opus 5.5 960230f86d mq: keep keyless and valueless messages in compacted parquet (#13258)
* mq: keep keyless and valueless messages in compacted parquet

mq.topic.compact treated every message without a key, every message
without a value, and every value that happened to parse as a
DataMessage with a Ctrl as a control entry, and left it out of the
parquet it wrote. Kafka records with a null key and tombstones were
gone once retention removed their logs, and so was a JSON string value
whose bytes parse that way.

The only control entry a log holds is a publisher's close marker, which
the broker logged without its Ctrl, as an entry with neither key nor
value. That is now the whole rule, for compaction and for reading
parquet back. A schematized topic's message without a value is still
left out, since its row has no column to hold one.

Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34

* mq broker: ack a publisher's close marker without logging it

The marker a publisher sends when it finishes was appended to the
partition log like a message, minus its Ctrl, so it took an offset and
sat in the log as an entry with neither key nor value that every reader
had to recognize and skip. The broker now acks it and moves on. Every
message the publisher sent before it on the stream was acked first, so
the publisher's wait for its last ack is unchanged. Logs written before
still hold markers, which readers keep skipping.

Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34

* mq broker: log a Ctrl message that carries a key or value

The close-marker branch dropped every DataMessage with a Ctrl, though
one carrying a key or value was published before. Only a bare marker,
a Ctrl with neither, is acked without an offset now; anything else is
stored at its offset as it was.

Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34

* query engine: skip only close markers, as compaction does

Compaction now keeps keyless messages and values that happen to parse as a
DataMessage with a Ctrl, but the SQL engine still dropped both from log scans
and live-log counts, while COUNT(*) took parquet row counts from file stats.
After compaction COUNT(*) included messages SELECT did not show. Scans and
counts now use the same rule as compaction and parquet reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* query engine: leave out a schematized message without a value, as compaction does

Compaction writes no row for a schematized message without a value, so a live
log count that included one dropped by one once its log was compacted. Scans
and live-log counts now skip what compaction skips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* query engine: count only rows among broker-buffered messages

The COUNT(*) fast path added every unflushed broker message, so a close marker
or a schematized message without a value counted until its flush, when the
live-log count left it out. Unflushed messages now count by the same row rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* query engine: test the broker-buffered count against the scan

COUNT(*) adds the broker's unflushed messages by the row rule a scan of
them uses, but nothing tested it. The count moves into countRows, and
the scan test checks it gives the number of rows the scan returns for a
schemaless and a schematized topic, so close markers and schematized
messages without a value stay out of both.

Claude-Session: https://claude.ai/code/session_011Upvai5AjLiNE5B1HCAn34

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 21:10:22 -08:00