Skip to content

fix: topology-aware cache keys with shard epoch to prevent collision during rebalance - #9

Open
Kasuki354 wants to merge 2 commits into
rasoolharlym8:mainfrom
Kasuki354:fix/cache-key-collision
Open

fix: topology-aware cache keys with shard epoch to prevent collision during rebalance#9
Kasuki354 wants to merge 2 commits into
rasoolharlym8:mainfrom
Kasuki354:fix/cache-key-collision

Conversation

@Kasuki354

Copy link
Copy Markdown

Summary

Fixes issue #3: Cache key collision and partial results during tenant shuffle-sharding rebalance.

Implementation

  1. ShardConfig with Epoch and RoutingHash for shard versioning
  2. ShardStateManager with RWMutex for thread-safe concurrent access
  3. GenerateKey: incorporates tenant shard epoch + routing hash (format: tenantID:epoch:routingHash:requestHash)
  4. ValidateConsistency: detects mid-flight shard transitions by comparing epochs

When a rebalance occurs, the epoch increments, causing all new cache keys to differ from old ones.

Tests

  • Cache keys differ when shard config changes
  • Cache keys match for same config
  • ValidateConsistency detects epoch changes
  • ShardStateManager handles concurrent reads + writes

/claim #3

…during rebalance

Resolves rasoolharlym8#3

Implements:
1. ShardConfig with Epoch and RoutingHash for versioning
2. ShardStateManager with RWMutex for thread-safe access
3. GenerateKey: incorporates shard epoch + routing hash
4. ValidateConsistency: detects mid-flight shard transitions
@opirebot

opirebot Bot commented Aug 7, 2026

Copy link
Copy Markdown

😅 Unfortunately there are no rewards left to claim in this issue!

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.

1 participant