Skip to content

Speed up CAS unit tests; fix a GC drain race in an integration test - #2958

Merged
filimonov merged 2 commits into
antalya-26.8from
work/antalya-26.8/cas-unit-test-speed
Nov 25, 2026
Merged

filimonov merged 2 commits into
antalya-26.8from
work/antalya-26.8/cas-unit-test-speed

Conversation

@filimonov

@filimonov filimonov commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Cut the CAS unit suite from 272 s to about 113 s of test time. 43 of 5,188 tests took 205 s, nearly all of it spent waiting, and under MSan the unit job ran out of its 90 minutes, which dropped the jobs that depend on it in PR 2941.

  • A successor mount waited out its predecessor's lease for 40 s: the test now passes the boot clock and the wait function it already had hooks for.
  • Five scheduler tests waited through eight deferred rounds of an idle pool: they run with no deferral and request the round at once.
  • Three cas-fsck deadline tests use the virtual retry clock their siblings use.
  • "Has not returned yet" windows are 300 to 500 ms instead of 2 s.
  • A dying death-test child was dumped through the kernel's core handler when core_pattern is a pipe, about a second per death. CAS_EXPECT_DEATH and CAS_ASSERT_DEATH make only that child non-dumpable.

Test-only. No assertion is removed in either change.

Local gates on this exact tree (Rust off): CAS*:ReadBufferFromS3SessionRelease*:S3BulkDeleteFallback*:ReadBufferFromFileView*, release 5188/5188 passed in 112.7 s; ASan + UBSan 5189 passed, 2 skipped (CASDecodeErrors.AMemoryLimit..., memory-tracker tests skipped under sanitizers) in 409.9 s.

Also fixes test_cas_cross_table_copy_gc, which failed all five copy-then-drop cases in the 2026-11-24 nightly (ASan, db disk, old analyzer) with GC did not drain in 200 rounds. Manual and scheduled GC rounds share one deferral counter and the ninth round folds. In CI the scheduler started a round every ~1.1 s and the drain's manual loop every ~1.3-1.4 s, so the ninth round was always the scheduler's, and the manual run arriving during the fold waited on the round mutex and became deferral number one again. The drain counts only its own non-deferred rounds and never saw one, although every fold found nothing to do. drain_gc now stops the scheduler for the drain. Locally, release and ASan: 8/8. The failure did not reproduce locally (it depends on the exact timings); the cycle is read from the CI server log.

Nightly report: https://altinity-build-artifacts.s3.amazonaws.com/json.html?REF=antalya-26.8&sha=9be3ad607ce760b0070910ef856b72a0cbb55d1b&name_0=MasterCI
Related: #2941

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Not required.

Documentation entry for user-facing changes

None.

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

43 of 5,188 tests took 205 of the suite's 272 s, nearly all of it real
time spent waiting. Under MSan the unit job ran out of its 90 minutes.

- A successor mount waited out its predecessor's lease for 40 s: the
  test now passes the boot clock and the wait function it already had
  hooks for.
- Five scheduler tests waited through eight deferred rounds of an idle
  pool: they run with no deferral and request the round at once. The
  "an operator stop persists" check could not fire before, because a
  wrongly restarted scheduler logged `Deferred`, never `Success`.
- Three `cas-fsck` deadline tests use the virtual retry clock their
  siblings use.
- "Has not returned yet" windows are 300 to 500 ms instead of 2 s.
- A dying death-test child is dumped through the kernel's core handler
  even with a zero core limit when `core_pattern` is a pipe, about a
  second per death. `CAS_EXPECT_DEATH` and `CAS_ASSERT_DEATH` make only
  that child non-dumpable; the test binary itself stays dumpable.

Test-only. No assertion is removed.

Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [2caca63]

The nightly ASan run failed all five copy-then-drop cases with `GC did
not drain in 200 rounds`. The drain counts only its own non-deferred
quiet rounds, but manual and scheduled rounds share one deferral
counter, and the fold goes to the ninth round. In CI the scheduler
started a round every ~1.1 s and the manual loop every ~1.3-1.4 s, so
the ninth round was always the scheduler's; the manual run that arrived
during the fold waited on the round mutex and became deferral number
one, which repeated the cycle. Every fold found nothing to do, yet the
drain never saw one. `drain_gc` now stops the scheduler and starts it
again in `finally`, so every ninth manual round folds.

https://altinity-build-artifacts.s3.amazonaws.com/json.html?REF=antalya-26.8&sha=9be3ad607ce760b0070910ef856b72a0cbb55d1b&name_0=MasterCI

Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@filimonov filimonov changed the title Cut the CAS unit suite from 272 s to about 113 s Speed up CAS unit tests; fix a GC drain race in an integration test Nov 25, 2026
@filimonov filimonov added the CAS label Nov 25, 2026
@filimonov
filimonov requested a review from k-morozov November 25, 2026 15:54
@filimonov
filimonov marked this pull request as ready for review November 25, 2026 15:55
@filimonov
filimonov merged commit 0192f73 into antalya-26.8 Nov 25, 2026
379 of 388 checks passed
@DimensionWieldr

Copy link
Copy Markdown
Collaborator

No medium/high defects found by AI audit.

No CI fails are PR-caused.

PR fixes tests, does not touch src code; no extra regression tests needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants