← Back to Pull requests

[#36579] YSQL: Fix PgPackedRowTest.BigValue/kV2 timeout waiting on remote-bootstrapping system tablet #36580

Merged
csi-fix merged 1 files (7 lines) on Nov 02, 2026 12:15 UTC
View on GitHub
csi-fix csi-fix commented on Nov 01, 2026 19:41 UTC
Author

Summary

TSTabletManager::GetTabletPeersUnlocked read a peer's namespace from its opened tablet (shared_tablet_maybe_null()) when applying the user-tablets-only filter. A system-tablet replica that is still being remote-bootstrapped is already registered but has no tablet yet, so the filter let it through. WaitAllReplicasSynchronizedWithLeader then waited the full 90 seconds for a leader among that single follower replica. The filter now reads namespace_name() from peer->tablet_metadata(), which is set when the peer is constructed, so system tablets are excluded at every stage of the peer's life.

---
_Produced fully automatically by csi-fix.py: Claude Opus (5.5) analyzed the failure logs, wrote the change, and verified it locally._

Test plan

./yb_build.sh asan --clang21 --cxx-test pg_packed_row-test --gtest-filter PgPackedRowTest.BigValue/kV2 -n 100 --stop-at-failure -- -p 6
Ran the above locally with no failures.
Before the fix, this test reproduced locally (same test command and -p / env as above, without --stop-at-failure) -- with the CSI dashboard rate for reference:

  • clang21-asan: 6/60 iterations failed locally; CSI 1/49

  • Machine: GCP n2-standard-16, AlmaLinux 8.10 (Cerulean Leopard) x86_64, 16 vCPU, 63 GiB RAM, Intel(R) Xeon(R) CPU @ 2.80GHz

    Diff: 7 lines (+4 / -3) across 1 files Reviewer: arpang Review duration: 994m
    All Vouch review confidence checks passed
    Residual risk 0.04 = Change Risk (0.20) × (1 − Review Confidence (0.82)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.20 · 7 lines diff across 1 files
    0.20
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.74 · 3 substantive comment(s)
    0.74
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    82%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.124
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    6 items
    csi-fix csi-fix commented on Nov 01, 2026 19:41 UTC
    Author

    Automated fix analysis (csi-fix.py) — PgPackedRowTest.BigValue/kV2

    What the test verifies


    PgPackedRowTest.BigValue/kV2 writes rows with large column values into a packed-row (V2) table. It then checks that the values read back intact across flushes and compactions, after all replicas have synchronized with the leader. The test's assertions and data sizes are untouched. The change only fixes the tserver-side filter that decides which system tablets WaitAllReplicasSynchronizedWithLeader waits on.

    Attempt 1

    I did not compile or run the test after this change. The harness will run the asan build; the change is a few lines, uses the same accessor the old code used, and TabletPeer::tablet_metadata() is already called in the function just below it.

    Root cause. The failing waits were all on system-table tablets (transactions, and the like) whose third replica was added by remote bootstrap after the table was created. WaitAllReplicasSynchronizedWithLeader lists peers with the user-tablets-only filter, which should drop system tablets entirely. But TSTabletManager::GetTabletPeersUnlocked worked out a peer's namespace from its opened tablet (shared_tablet_maybe_null()). While a replica is being remote-bootstrapped, its peer is already registered but has no tablet yet, so the filter let it through.

    In log 9, the test listed peers at about 19:28:41.40, while ts-3 was bootstrapping tablet 71948f..., which it opened at 41.504. That replica was the only peer of that tablet in the list, because the replicas on ts-1 and ts-2, including the leader, were filtered out correctly. A follower never becomes leader, so "Wait leader of ..." ran out its full 90s. Logs 4, 11 and 45 time out on a single system tablet in the same way. The leader itself was healthy throughout. Under ASAN, remote bootstrap is slow enough that the listing sometimes lands inside that window, which explains the 6/60 failure rate.

    Fix (src/yb/tserver/ts_tablet_manager.cc, about 4 lines). The filter now reads the namespace from peer->tablet_metadata(). That metadata is set when the peer is constructed, and for a remote-bootstrapped peer it comes from the superblock, which carries namespace_name: "system". So system tablets are excluded at every stage of the peer's life, and the test no longer waits on a leaderless subset of replicas.

    Review


    The fix is sound and doesn't mask a product bug. TabletPeer::meta_ is a const RaftGroupMetadataPtr set at construction. For a remote-bootstrapped peer it is built from the downloaded superblock, so it carries namespace_name. The user-tablets-only filter now drops system tablets consistently, instead of letting through peers whose tablet isn't open yet, which fixes the leaderless subset the test was waiting on. Locking is unchanged: the old code read the same metadata object through tablet->metadata().

    yugabyte-ci yugabyte-ci commented on Nov 01, 2026 19:41 UTC
    Contributor

    <!-- Reviewable:start -->
    This change is <img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>
    <!-- Reviewable:end -->

    yb-agentk-dev[bot] yb-agentk-dev[bot] commented on Nov 01, 2026 19:42 UTC
    Bot

    AgentK has started reviewing this pull request — findings will be posted here shortly.

    Pushes are not reviewed automatically. Comment /agentk review to ask for another pass — but please only after substantial changes, not on every small push, and not for a push that just addresses the review comments.

    yb-agentk-dev[bot] yb-agentk-dev[bot] commented on Nov 01, 2026 19:44 UTC
    Reviewer

    LGTM

    arpang arpang approved these changes on Nov 02, 2026 08:13 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    csi-fix csi-fix
    Labels
    risk: low confidence: 82% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 20.4% (LOW) · Higher = larger blast radius
    20.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 82% · Lower = rushed or shallow review
    82%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 3.7% · Safe to merge
    3.7%