Repository navigation
tsdb: honor head isolation in streamed remote reads - #20184
Conversation
| if it != nil { | ||
| p.bufIter.Iter = it | ||
| } | ||
| if filtersSamples { |
There was a problem hiding this comment.
When filtersSamples is false, s.iterator still calls c.Iterator(it) and overwrites p.bufIter.Iter even though p.currDelIter is nil and the iterator goes unused, which allocates an unnecessary chunk iterator and drops any cached *stopIterator. Could iteratorForChunkCopy return nil, false when stopAfter == numSamples, and could we add a test case with a full pre-snapshot chunk where c.isoState != nil to cover this branch?
There was a problem hiding this comment.
PR head: 3cb01335d9c0bb957417a9d16ce31e693d87d8dd. Response to this feedback.
The copy iterator now returns nil,false before creating a chunk iterator when every sample is visible, so the cached iterator is preserved. Added a full pre-snapshot chunk with a later incomplete appender in the handler test and a TSDB unit test for the no-filter return.
| } | ||
| if tc.isolationDisabled { | ||
| require.Equal(t, initial.timestamp, streamed.chunkBounds[0][0]) | ||
| require.Equal(t, tc.laterStart, streamed.chunkBounds[0][1]) |
There was a problem hiding this comment.
Quick nit: this if tc.isolationDisabled block duplicates the streamed.chunkBounds[0] check on line 1323 and assumes laterCount == 1, so we can drop lines 1329 to 1332.
There was a problem hiding this comment.
PR head: 3cb01335d9c0bb957417a9d16ce31e693d87d8dd. Response to this feedback.
Removed the duplicate isolation-disabled bounds check. The shared assertion now checks the first and last visible timestamps without assuming a single later sample.
19a1c4c to
3cb0133
Compare
Which issue(s) does the PR fix:None. This makes streamed Remote Read chunks from the local TSDB honor the isolation snapshot for in-order head data. When no deletion interval overlaps, fully visible chunks keep byte pass-through; partially visible chunks are re-encoded from visible samples, and wholly hidden chunks are omitted. The existing open-chunk copy still protects bytes from later appends. Out-of-order chunks retain their separate reader-lifetime path.
The race-enabled The This condition holds with this change and does not hold at Release notes for end users (ALL commits must be considered).Generated by Perfloop. |
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
3cb0133 to
a435b95
Compare
Which issue(s) does the PR fix:None. This makes streamed Remote Read chunks from the local TSDB honor the isolation snapshot captured when the querier opens. Fully visible chunks keep byte pass-through; partially visible chunks are re-encoded from visible samples, and hidden chunks are omitted. The existing open-chunk copy continues to protect bytes from later appends. With the handler regression test present and no product fix,
The race-enabled The This condition holds with this change and does not hold at Release notes for end users (ALL commits must be considered).Generated by Perfloop. |
Signed-off-by: Bartlomiej Plotka <[email protected]>
Note
Triggered and guided by @bwplotka -- let me know if this is too spammy etc!
Which issue(s) does the PR fix:
None.
This change makes streamed Remote Read chunks from the local TSDB honor the isolation snapshot for in-order head data. With no overlapping deletion interval, fully visible chunks keep byte pass-through; partially visible chunks are re-encoded from their visible samples, and wholly hidden chunks are skipped. The existing open-chunk copy still protects bytes from later appends. Out-of-order chunks are unchanged and retain their separate reader-lifetime path.
TestRemoteReadStreamIsolationfails on the unmodified TSDB in its open-chunk case: the sample response contains timestamp 0/value 1, while streamed output also contains timestamp 1/value 2. The final source passes all 11 cases, including finite-range open chunks, rotated and mmapped chunks, incomplete appenders, integer and float histograms with and without start timestamps, and isolation-disabled behavior.TestRemoteReadStreamChunkCopyStabilitypasses on both the unmodified and final source. It commits a later sample after the chunk iterator returns its copy, before the handler reads the bytes.TestTxRingLastAppendIDcovers empty-ring, cleanup, and wrap cases. The race-enabledstorage/remoteandtsdbsuites, the TSDB isolation-disabled suite, the Prometheus binary build, and scoped lint pass.The CI jobs
Go tests for 32-bit x86andGo tests on Windowscould not run locally for thestorage/remoteandtsdbpackages. These platform tests remain target-CI work because this Linux sandbox cannot execute 32-bit ELF or Windows test binaries; the Linux/amd64 tests for both packages passed here.The small runner used to report the source comparison is not included in this pull request; the native regression and preservation tests are included.
This condition holds with this change and does not hold at
694f9e00a0b3a51e234c194c618a3bd3a66a08b3:For a local TSDB with head isolation enabled, STREAMED_XOR_CHUNKS Remote Read returns exactly the float and histogram samples visible to its querier-open snapshot for in-order open, rotated, and mmapped head chunks and appenders incomplete at snapshot creation, including supported start-timestamp histogram encodings; with isolation disabled, later appends remain visible..Release notes for end users (ALL commits must be considered).
Generated by Perfloop.