br/pkg/restore/snap_client: stabilize flaky TestConcurrency#67887
br/pkg/restore/snap_client: stabilize flaky TestConcurrency#67887flaky-claw wants to merge 1 commit intopingcap:masterfrom
Conversation
|
@flaky-claw I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details. ⏳ This process typically takes 10-30 minutes depending on the complexity of the changes. ℹ️ Learn more details on Pantheon AI. |
|
Hi @flaky-claw. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
📝 WalkthroughWalkthroughThe PR stabilizes a flaky test by replacing failpoint-based synchronization with a storage-layer interceptor wrapper that captures Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
br/pkg/restore/snap_client/pitr_collector_test.go (1)
311-367: Optional: tighten the cleanup ordering.
t.Cleanupat Line 334 already callscloseFence()+wg.Wait(), so the explicitcloseFence(); wg.Wait()at Lines 354-355 is redundant (safe due tosync.Once, just noise). If you want to keep the fence release explicit for readability, consider dropping the duplicatewg.Wait()or removing the cleanup'swg.Wait()to avoid doing it twice. Non-blocking.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@br/pkg/restore/snap_client/pitr_collector_test.go` around lines 311 - 367, In TestConcurrency remove the duplicated wait by either (A) keeping the explicit closeFence(); wg.Wait() before collecting results and remove wg.Wait() from the t.Cleanup closure, or (B) keep wg.Wait() in t.Cleanup and simply call closeFence() (no wg.Wait()) in the main test body; update the t.Cleanup closure or the main teardown accordingly so wg.Wait() is invoked exactly once (references: TestConcurrency, closeFence, wg, t.Cleanup).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@br/pkg/restore/snap_client/pitr_collector_test.go`:
- Around line 311-367: In TestConcurrency remove the duplicated wait by either
(A) keeping the explicit closeFence(); wg.Wait() before collecting results and
remove wg.Wait() from the t.Cleanup closure, or (B) keep wg.Wait() in t.Cleanup
and simply call closeFence() (no wg.Wait()) in the main test body; update the
t.Cleanup closure or the main teardown accordingly so wg.Wait() is invoked
exactly once (references: TestConcurrency, closeFence, wg, t.Cleanup).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a1aa3e2c-a487-47c7-99cc-ae212027d7c9
📒 Files selected for processing (1)
br/pkg/restore/snap_client/pitr_collector_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #67887 +/- ##
================================================
+ Coverage 77.7969% 78.6380% +0.8410%
================================================
Files 1983 1984 +1
Lines 548948 549125 +177
================================================
+ Hits 427065 431821 +4756
+ Misses 120962 116285 -4677
- Partials 921 1019 +98
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
|
@yinsustart: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
YuJuncen
left a comment
There was a problem hiding this comment.
w/o t.Parallel() I'm not sure whehter there is acually a race on failpoints... Anyway this isn't harmful.
| } | ||
|
|
||
| func (s *copyInterceptorStorage) CopyFrom(ctx context.Context, from storeapi.Storage, spec storeapi.CopySpec) error { | ||
| if s.onCopy != nil { |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Leavrth, YuJuncen The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: close #66975
Problem Summary:
Flaky test
TestConcurrencyinbr/pkg/restore/snap_clientintermittently fails, so this PR stabilizes that path.What changed and how does it work?
Root Cause
TEST_ISSUE: TestConcurrency depended on a failpoint-based barrier that is not guaranteed on the required test surface, so the concurrency fence was never engaged.
Fix
Replacing failpoint gating with a test-local copy-boundary interceptor keeps the same concurrency assertion while removing execution-surface dependence that caused deterministic/flaky failures.
Verification
Spec:
br/pkg/restore/snap_client :: TestConcurrencytidb.go_flaky.defaultBASELINE_ONLYObserved result:
Gate checklist:
Commands:
go test -json ./br/pkg/restore/snap_client -run '^TestConcurrency$' -count=1go test -json ./br/pkg/restore/snap_client -count=1make buildCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
Fixes #66975
Summary by CodeRabbit