Migrate block, compaction, head read, querier, and benchmark tests in tsdb to AppenderV2.
Part of #17632
Signed-off-by: Bartek Plotka <bwplotka@google.com>
The writeMinValidTime opt-out existed because the agent replay treated any
unrecognized record type as corruption. Agent replay now ignores unknown
records, so the shared checkpointer can write the cutoff unconditionally and
the agent just skips it.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Using an empty directory string in os.CreateTemp created SD files in the shared global OS temp directory, causing file_sd watchers in scrape tests to watch all parallel test activity in os.TempDir() and leak temp files.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
On Windows, fsnotify's Watcher.Add (called in refresh -> watchFiles) blocks waiting for the single readEvents IOCP goroutine, which itself blocks sending to Watcher.Events or Watcher.Errors when the 50-event buffer fills up. Previously, only stop() drained Events and Errors concurrently around Watcher.Close(), leaving Run() vulnerable to deadlocking inside refresh -> watchFiles when a watched directory received a burst of events.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
Ubuntu 26.04 runners currently ship Docker 29.4.2, whose default seccomp profile blocks socketcall(2) with ENOSYS (actions/runner-images#14790). Since Go on linux/386 still uses socketcall(2) for socket operations (golang/go#79200), all tests opening sockets fail with 'socket: function not implemented' when ubuntu-latest lands on ubuntu-26.04.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
Check author.__typename == "Bot" (and include codecov in the login fallback list) so bot comments such as Codecov reports do not move PRs into the Waiting on Author bucket.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
Stale samples returned early in AppenderV2.Append, which skipped metadata
updates. Only skip exemplars for stale samples, so metadata is still
recorded in the WAL.
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
Port the segmentSize helper from TestWBLCorruption (039cb358a7) to TestWBLCorruption_AppendV2 so segment size checks open and stat the file handle instead of reading stale os.ReadDir directory metadata on Windows after async WL.NextSegment closes.
In TestWBLAndMmapReplay and TestWBLAndMmapReplay_AppendV2, truncate the closed 000001 head chunk file in mmapDir to 128 KiB (matching non-Windows HeadChunkFilePreallocationSize) before copying mmapDir across subtests, and run each test's sampleTypeScenarios sequentially. On Windows, head chunk files are preallocated to 128 MiB, so copying mmapDir 5 times per scenario across 14 scenarios wrote ~9 GiB of zeros and caused ./tsdb to exceed the 10m package test timeout after #20157 parallelized the subtests.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
Require all review threads, comments, and reviews to be resolved or responded to by the author, and require CI to be green (or have an author comment after the latest commit explaining why CI is not green) before categorizing a PR as waiting on maintainer.
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Add a reusable agent skill and script under .agents/skills/pr-triage-board that queries GitHub GraphQL, CODEOWNERS, MAINTAINERS.md, and PULL_REQUEST_TEMPLATE.md to generate a Markdown PR triage board or update a pinned issue description.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
Clear the captured DB reference before asserting that Close succeeded, so
FailNow cannot skip releasing the fixture. Also clear the separate cleanup
reference to the final restarted Head in the histogram-series metrics test.
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Move compactOOOHeadTestingCallback and compactHeadViewBeforeEvictTestingCallback from package-level variables to fields on DB so compaction tests using them can run concurrently without data races.
Add t.Parallel() to isolated slow top-level tests in tsdb (over 440 of 464 top-level tests previously ran sequentially), reducing go test -race -parallel 4 ./tsdb/ from ~16m30s to ~6m05s.
Also clear the captured DB and Head references inside newTestDB and newTestHead t.Cleanup closures: Go's testing package keeps parallel *testing.T instances in t.parent.sub until the parent finishes and pops t.cleanups via reslicing without zeroing the backing array, which otherwise pins every closed *DB and *Head in the heap across all parallel tests.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
The synced zizmor workflow reports cache-poisoning for the synced
golangci-lint workflow in every Go repository, because the workflow runs
on tag and release branch pushes and actions/setup-go caches by default.
zizmor here only scans .github/workflows, so it never checks
scripts/golangci-lint.yml.
Restoring the Go cache is acceptable in this workflow: its token is
read-only, it uses no secrets and it publishes nothing. Ignore the
finding for this step rather than disabling the cache. This differs from
the golangci job in ci.yml, which disables the cache since d5f79f751,
because that job runs in the same workflow as the publish jobs.
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
In TestDelete_e2e and TestHeadAppenderV2_Delete_e2e, the inner numRanges (1000) loop was copied from TestDB_e2e without random query bounds, executing the exact same deterministic [0, 100000] query 1,000 times per deletion (~139s under -race).
In TestHead_RaceBetweenSeriesCreationAndGC and TestHeadAppenderV2_RaceBetweenSeriesCreationAndGC, the i%128 != 0 loop condition forced 128 full head.gc() passes over 100,000 series even after the concurrent series-creation goroutine finished after ~5 iterations (~77s of single-threaded post-completion work under -race). Checking !done.Load() directly keeps continuous concurrent GC while series creation runs without spinning after completion.
Signed-off-by: Bartek Plotka <bwplotka@google.com>
Prevent frequent compaction notifications from resetting the maintenance schedule before it fires.
This can happen when automatic compaction is disabled the head remains compactable until externally scheduled compaction runs.
Signed-off-by: Guido Ricioppo <griciopp@redhat.com>