Skip to content

Fix strict-mode disable race - #8924

Merged
agourlay merged 1 commit into
devfrom
fix-strict-mode-toggle-race
May 6, 2026
Merged

agourlay merged 1 commit into
devfrom
fix-strict-mode-toggle-race

Conversation

@agourlay

@agourlay agourlay commented May 6, 2026 •

Copy link
Copy Markdown
Member

This PR fixes the flaky test_shard_transfer_rate_limiting.

Collection::update_strict_mode_config published the new strict_mode_config to self.collection_config before applying the rate-limiter change to local shards.

During that window info() reported the new state while LocalShard::read_rate_limiter was still on the old one, causing searches to return 429 Read rate limit exceeded after a successful disable.

Fix

Invert the ordering: compute the merged StrictModeConfig, push it into every shard's rate limiter, then update self.collection_config and persist.

LocalShard::on_strict_mode_config_update now takes the new config as a parameter instead of re-reading the shared Arc<RwLock<CollectionConfigInternal>>.

@agourlay
agourlay marked this pull request as ready for review May 6, 2026 13:14
@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1fb7bc65-7854-4e40-89c6-b3717ed00bd6

📥 Commits

Reviewing files that changed from the base of the PR and between 74bbee0 and 52557a4.

📒 Files selected for processing (8)
  • lib/collection/src/collection/collection_ops.rs
  • lib/collection/src/shards/dummy_shard.rs
  • lib/collection/src/shards/forward_proxy_shard.rs
  • lib/collection/src/shards/local_shard/mod.rs
  • lib/collection/src/shards/proxy_shard.rs
  • lib/collection/src/shards/queue_proxy_shard.rs
  • lib/collection/src/shards/replica_set/mod.rs
  • lib/collection/src/shards/shard.rs

📝 Walkthrough

Walkthrough

This pull request refactors the strict mode configuration update flow into a two-phase process. The main change occurs in collection_ops.rs, where the update now computes a new strict mode config, applies rate-limiter and shard-wide changes first via on_strict_mode_config_update, and only then publishes and persists the config. Corresponding changes across all shard implementations (local, proxy, forward proxy, queue proxy, dummy, and replica set) update the on_strict_mode_config_update method signature from an async, parameterless method to a synchronous method that accepts a &StrictModeConfig reference. The method implementations are updated to accept and forward this explicit configuration rather than reading it from internal state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • Reviewers familiar with shard abstraction and implementation patterns
  • Team members with expertise in collection configuration management
  • Contributors experienced with rate limiting mechanisms and their synchronization
  • Code owners responsible for core collection operations and data consistency guarantees
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix strict-mode disable race' directly addresses the main change: fixing a race condition in strict-mode disabling that caused flaky tests.
Description check ✅ Passed The description is directly related to the changeset, explaining the race condition problem and the fix involving reordering operations in update_strict_mode_config.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-strict-mode-toggle-race

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@agourlay
agourlay merged commit cf6f743 into dev May 6, 2026
15 checks passed
@agourlay
agourlay deleted the fix-strict-mode-toggle-race branch May 6, 2026 13:27
timvisee pushed a commit that referenced this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants