Fix some comments for punctuation and accuracy

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits 2024-08-27 14:51:52 +02:00
parent ce36c05266
commit bd423f0099
2 changed files with 16 additions and 16 deletions

View file

@ -5442,7 +5442,7 @@ func TestQuerierOOOQuery(t *testing.T) {
// Adding counter reset to all histograms means each histogram will have its own chunk. // Adding counter reset to all histograms means each histogram will have its own chunk.
appendFunc: func(app storage.Appender, ts int64, counterReset bool) (storage.SeriesRef, error) { appendFunc: func(app storage.Appender, ts int64, counterReset bool) (storage.SeriesRef, error) {
h := tsdbutil.GenerateTestHistogram(int(ts)) h := tsdbutil.GenerateTestHistogram(int(ts))
h.CounterResetHint = histogram.CounterReset // for this scenario, ignore the counterReset argument h.CounterResetHint = histogram.CounterReset // For this scenario, ignore the counterReset argument.
return app.AppendHistogram(0, labels.FromStrings("foo", "bar1"), ts, h, nil) return app.AppendHistogram(0, labels.FromStrings("foo", "bar1"), ts, h, nil)
}, },
sampleFunc: func(ts int64) chunks.Sample { sampleFunc: func(ts int64) chunks.Sample {
@ -5544,7 +5544,7 @@ func testQuerierOOOQuery(t *testing.T,
}, },
}, },
{ {
name: "alternating OOO batches", // in order: 100-200 normal. out of order first path: 0, 2, 4, ... 98 (no counter reset), second pass: 1, 3, 5, ... 99 (with counter reset) name: "alternating OOO batches", // In order: 100-200 normal. out of order first path: 0, 2, 4, ... 98 (no counter reset), second pass: 1, 3, 5, ... 99 (with counter reset).
queryMinT: minutes(0), queryMinT: minutes(0),
queryMaxT: minutes(200), queryMaxT: minutes(200),
batches: []sampleBatch{ batches: []sampleBatch{
@ -5741,7 +5741,7 @@ func TestChunkQuerierOOOQuery(t *testing.T) {
// Adding counter reset to all histograms means each histogram will have its own chunk. // Adding counter reset to all histograms means each histogram will have its own chunk.
appendFunc: func(app storage.Appender, ts int64, counterReset bool) (storage.SeriesRef, error) { appendFunc: func(app storage.Appender, ts int64, counterReset bool) (storage.SeriesRef, error) {
h := tsdbutil.GenerateTestHistogram(int(ts)) h := tsdbutil.GenerateTestHistogram(int(ts))
h.CounterResetHint = histogram.CounterReset // for this scenario, ignore the counterReset argument h.CounterResetHint = histogram.CounterReset // For this scenario, ignore the counterReset argument.
return app.AppendHistogram(0, labels.FromStrings("foo", "bar1"), ts, h, nil) return app.AppendHistogram(0, labels.FromStrings("foo", "bar1"), ts, h, nil)
}, },
sampleFunc: func(ts int64) chunks.Sample { sampleFunc: func(ts int64) chunks.Sample {
@ -5843,7 +5843,7 @@ func testChunkQuerierOOOQuery(t *testing.T,
}, },
}, },
{ {
name: "alternating OOO batches", // in order: 100-200 normal. out of order first path: 0, 2, 4, ... 98 (no counter reset), second pass: 1, 3, 5, ... 99 (with counter reset) name: "alternating OOO batches", // In order: 100-200 normal. out of order first path: 0, 2, 4, ... 98 (no counter reset), second pass: 1, 3, 5, ... 99 (with counter reset).
queryMinT: minutes(0), queryMinT: minutes(0),
queryMaxT: minutes(200), queryMaxT: minutes(200),
batches: []sampleBatch{ batches: []sampleBatch{
@ -6006,8 +6006,8 @@ func testChunkQuerierOOOQuery(t *testing.T,
} }
} }
// This test verifies the counter reset headers for in-order and out-of-order samples upon ingestion. // TestOOONativeHistogramsWithCounterResets verifies the counter reset headers for in-order and out-of-order samples
// Note that when the counter reset(s) occur in OOO samples, the header is set to UnknownCounterReset // upon ingestion. Note that when the counter reset(s) occur in OOO samples, the header is set to UnknownCounterReset
// rather than CounterReset. This is because with OOO native histogram samples, it cannot be definitely // rather than CounterReset. This is because with OOO native histogram samples, it cannot be definitely
// determined if a counter reset occurred because the samples are not consecutive, and another sample // determined if a counter reset occurred because the samples are not consecutive, and another sample
// could potentially come in that would change the status of the header. In this case, the UnknownCounterReset // could potentially come in that would change the status of the header. In this case, the UnknownCounterReset
@ -6274,9 +6274,9 @@ func testOOOAppendAndQuery(t *testing.T, scenario sampleTypeScenario) {
addSample(s2, 255, 265, false) addSample(s2, 255, 265, false)
verifyOOOMinMaxTimes(250, 265) verifyOOOMinMaxTimes(250, 265)
testQuery(math.MinInt64, math.MaxInt64) testQuery(math.MinInt64, math.MaxInt64)
testQuery(minutes(250), minutes(265)) // Test querying ono data time range testQuery(minutes(250), minutes(265)) // Test querying ono data time range.
testQuery(minutes(290), minutes(300)) // Test querying in-order data time range testQuery(minutes(290), minutes(300)) // Test querying in-order data time range.
testQuery(minutes(250), minutes(300)) // Test querying the entire range testQuery(minutes(250), minutes(300)) // Test querying the entire range.
// Out of time window. // Out of time window.
addSample(s1, 59, 59, true) addSample(s1, 59, 59, true)
@ -6846,7 +6846,7 @@ func TestOOOHistogramCompactionWithCounterResets(t *testing.T) {
// Check that blocks are created after compaction. // Check that blocks are created after compaction.
require.Len(t, db.Blocks(), 5) require.Len(t, db.Blocks(), 5)
// Check samples after compaction // Check samples after compaction.
verifyDBSamples(series1ExpSamplesPostCompact, series2ExpSamplesPostCompact) verifyDBSamples(series1ExpSamplesPostCompact, series2ExpSamplesPostCompact)
// 0th WBL file will be deleted and 1st will be the only present. // 0th WBL file will be deleted and 1st will be the only present.
@ -6867,7 +6867,7 @@ func TestOOOHistogramCompactionWithCounterResets(t *testing.T) {
for _, s := range series1ExpSamplesPostCompact { for _, s := range series1ExpSamplesPostCompact {
if s.T() >= fromMins*time.Minute.Milliseconds() { if s.T() >= fromMins*time.Minute.Milliseconds() {
// samples should be sorted, so break out of loop when we reach a timestamp that's too big // Samples should be sorted, so break out of loop when we reach a timestamp that's too big.
if s.T() > toMins*time.Minute.Milliseconds() { if s.T() > toMins*time.Minute.Milliseconds() {
break break
} }
@ -7004,7 +7004,7 @@ func testOOOCompactionFailure(t *testing.T, scenario sampleTypeScenario) {
// There is a 0th WBL file. // There is a 0th WBL file.
verifyFirstWBLFileIs0 := func(count int) { verifyFirstWBLFileIs0 := func(count int) {
require.NoError(t, db.head.wbl.Sync()) // syncing to make sure wbl is flushed in windows require.NoError(t, db.head.wbl.Sync()) // Syncing to make sure wbl is flushed in windows.
files, err := os.ReadDir(db.head.wbl.Dir()) files, err := os.ReadDir(db.head.wbl.Dir())
require.NoError(t, err) require.NoError(t, err)
require.Len(t, files, count) require.Len(t, files, count)
@ -7058,7 +7058,7 @@ func testOOOCompactionFailure(t *testing.T, scenario sampleTypeScenario) {
require.Len(t, db.Blocks(), 3) require.Len(t, db.Blocks(), 3)
require.Equal(t, oldBlocks, db.Blocks()) require.Equal(t, oldBlocks, db.Blocks())
// There should be a single m-map file // There should be a single m-map file.
verifyMmapFiles("000001") verifyMmapFiles("000001")
// All but last WBL file will be deleted. // All but last WBL file will be deleted.
@ -7154,7 +7154,7 @@ func TestWBLCorruption(t *testing.T) {
// should be deleted after replay. // should be deleted after replay.
// Checking where we corrupt it. // Checking where we corrupt it.
require.NoError(t, db.head.wbl.Sync()) // syncing to make sure wbl is flushed in windows require.NoError(t, db.head.wbl.Sync()) // Syncing to make sure wbl is flushed in windows.
files, err := os.ReadDir(db.head.wbl.Dir()) files, err := os.ReadDir(db.head.wbl.Dir())
require.NoError(t, err) require.NoError(t, err)
require.Len(t, files, 2) require.Len(t, files, 2)
@ -7177,7 +7177,7 @@ func TestWBLCorruption(t *testing.T) {
addSamples(310, 320, false) addSamples(310, 320, false)
// Verifying that we have data after corruption point. // Verifying that we have data after corruption point.
require.NoError(t, db.head.wbl.Sync()) // syncing to make sure wbl is flushed in windows require.NoError(t, db.head.wbl.Sync()) // Syncing to make sure wbl is flushed in windows.
files, err = os.ReadDir(db.head.wbl.Dir()) files, err = os.ReadDir(db.head.wbl.Dir())
require.NoError(t, err) require.NoError(t, err)
require.Len(t, files, 3) require.Len(t, files, 3)

View file

@ -4617,7 +4617,7 @@ func TestOOOHistogramCounterResetHeaders(t *testing.T) {
}, },
) )
// Count is lower than previous sample at ts 200, so the NotCounterReset is ignored. // Count is lower than previous sample at ts 200, and NotCounterReset is always ignored on append.
appendHistogram(int64(205), tsdbutil.SetHistogramNotCounterReset(tsdbutil.GenerateTestHistogram(1000))) appendHistogram(int64(205), tsdbutil.SetHistogramNotCounterReset(tsdbutil.GenerateTestHistogram(1000)))
appendHistogram(int64(210), tsdbutil.SetHistogramCounterReset(tsdbutil.GenerateTestHistogram(2010))) appendHistogram(int64(210), tsdbutil.SetHistogramCounterReset(tsdbutil.GenerateTestHistogram(2010)))