Skip to content

[Store] Give WeightOperationReplay test's OpLog writer room for UnmountSegment - #5179

Merged
Aionw merged 1 commit into
kvcache-ai:mainfrom
0z5a:fix/ha-weight-replay-flake
Nov 3, 2026
Merged

Aionw merged 1 commit into
kvcache-ai:mainfrom
0z5a:fix/ha-weight-replay-flake

Conversation

@0z5a

@0z5a 0z5a commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

MasterServiceHATest.WeightOperationReplayRestoresActiveAndCompletedState fails intermittently. It failed nightly-test on main on 10-29 and 11-02:

W ... UnmountSegment: segment OpLog queue failed for key=test_segment, type=6, err=-1401
E ... Failed to persist weight operation mutation, operation_id=2, key=weight-revision:..., error=-1401
master_service_ha_test.cpp:7608: Failure
Value of: degraded
  Actual: false
Expected: true

-1401 is TASK_PENDING_LIMIT_EXCEEDED. The test builds its writer with set_oplog_batch_max_entries(1), and OrderedOpLogWriter::ReserveBatch() counts an entry as occupying a slot from Commit() until the writer thread takes it into a batch.

With HA on, UnmountSegment() cleans up stale handles synchronously. It queues one stale-handle cleanup per object (here the payload and the manifest) and then SEGMENT_UNMOUNT, all back to back on the caller's thread. Each Reserve() succeeds only if the writer thread has already taken the previous entry:

  • if it hasn't, SEGMENT_UNMOUNT is dropped with the warning above;
  • the next ReconcileWeightRevision() cannot persist its mutation for the same reason, so the test never sees DEGRADED.

The default capacity is 1024, so this only affects the test setup. The fix gives this test 16 slots. The puts in the test still wait for each entry with RunCallbacksThrough(), and the comment there is updated, since the writer is no longer single-entry.

Testing

On a 72-core aarch64 machine, CPU only, I built master_service_ha_test at main 7d4670b with and without this change. I ran the test pinned to one core (taskset -c 40), which starves the writer thread:

--gtest_filter=*WeightOperationReplay* --gtest_repeat=200 Failed
main 7d4670b 6 / 200, all at line 7608 with the two -1401 lines above
this PR 0 / 200

With this PR, the whole master_service_ha_test binary, also pinned to one core, passes all 138 tests.

…ntSegment

The test used a one-entry OpLog writer. With HA on, UnmountSegment queues a
stale-handle cleanup per object and then SEGMENT_UNMOUNT back to back, and
Reserve() counts committed entries until the writer thread takes them, so
these calls fail with TASK_PENDING_LIMIT_EXCEEDED whenever the writer is
late. The next weight mutation then fails the same way and the test sees
no DEGRADED state. Use 16 entries; each put is still waited on explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions github-actions Bot added size/S 0-99 changed lines (additions + deletions) run-ci Store labels Nov 3, 2026
@Aionw
Aionw merged commit abd909c into kvcache-ai:main Nov 3, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci size/S 0-99 changed lines (additions + deletions) Store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants