mq logstore: read parquet rows at the stop time

The log reader treats stopTsNs as inclusive, delivering an entry at it and
reading a file whose first entry is at it, but the parquet reader stopped at a
row equal to it and skipped a file starting at it, so the same bounded read
returned that message from a log file and dropped it once compacted. Both
checks are now inclusive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-01 11:21:36 -08:00
1 parent 49d6091e59
commit 7c0e2c39d4
2 files changed
+22 -2

No files matched your search

+20
View File
@@ -434,3 +434,23 @@ func TestParquetReadResumesInsideAnEarlierFile(t *testing.T) {
t.Errorf("stopping at 8s read %v, want %v", got, want)
}
}
// The stop time is inclusive, as for log files: a row at it is read, and so is a
// file whose first row is at it.
func TestParquetReadIncludesARowAtTheStopTime(t *testing.T) {
f, client := newCompactionFiler(t)
f.putTopicConf(t)
base := time.Date(2026, 11, 30, 10, 0, 0, 0, time.UTC)
at := func(sec int) int64 { return base.Add(time.Duration(sec) * time.Second).UnixNano() }
f.putLogFile(t, base, 0, at(1), at(5), at(9))
compactSchemaless(t, client)
f.removeLogFiles()
read := GenParquetReadFunc(client, compactionTopic, compactionPartition)
if got, want := readParquetTimestamps(t, read, 1, at(5)), []int64{at(1), at(5)}; !slices.Equal(got, want) {
t.Errorf("stopping at 5s read %v, want %v", got, want)
}
if got, want := readParquetTimestamps(t, read, 1, at(1)), []int64{at(1)}; !slices.Equal(got, want) {
t.Errorf("stopping at the file's first row read %v, want %v", got, want)
}
}
+2 -2
View File
@@ -135,7 +135,7 @@ func GenParquetReadFunc(filerClient filer_pb.FilerClient, t topic.Topic, p topic
}
// rows of windows flushed across a reload are not in time order
tsNs := recordValue.Fields[SW_COLUMN_NAME_TS].GetInt64Value()
if tsNs <= starTsNs || (stopTsNs != 0 && tsNs >= stopTsNs) {
if tsNs <= starTsNs || (stopTsNs != 0 && tsNs > stopTsNs) {
continue
}
@@ -208,7 +208,7 @@ func GenParquetReadFunc(filerClient filer_pb.FilerClient, t topic.Topic, p topic
return nil
}
if stopTsNs != 0 && stopTsNs <= minTsNs {
if stopTsNs != 0 && stopTsNs < minTsNs {
return nil
}