Skip to content

feat(redis): add configurable key namespace for leases and capacity - #70

Merged
yashdotdev13 merged 1 commit into
yashdotdev13:mainfrom
Navneet6050:feat/redis-key-namespace
Nov 23, 2026
Merged

yashdotdev13 merged 1 commit into
yashdotdev13:mainfrom
Navneet6050:feat/redis-key-namespace

Conversation

@Navneet6050

Copy link
Copy Markdown
Contributor

Summary

Implements configurable Redis key namespacing to prevent key collisions when multiple deployments share the same Redis instance/database.

Related Issue

Closes #28

Type of Change

  • New feature
  • Test improvement

What Changed?

  • Added configurable Redis key namespace through traffic-control.redis.key-namespace.
  • Added support for the REDIS_KEY_NAMESPACE environment variable.
  • Introduced RedisKeyBuilder to centralize Redis key construction.
  • Updated RedisLeaseCoordinator to use namespaced global capacity, lease, and lease registry keys.
  • Ensured all relevant Lua script key arguments use namespaced keys.
  • Preserved traffic-control as the default namespace for backward compatibility.
  • Added namespace validation and configuration integration tests.

Validation

  • .\mvnw.cmd -B clean verify passes locally.
  • Namespace isolation verified using two coordinators sharing the same Redis instance.
  • Default key formats verified for backward compatibility.
  • Namespaced Lua script operations tested.

Test results: 170 tests passed, 0 failures, 0 errors, 0 skipped.

Distributed Systems Impact

  • Redis coordination: Deployments can share the same Redis instance/database while maintaining independent key spaces.
  • Lease ownership: Lease operations are isolated across namespaces.
  • Atomicity: Existing Lua-based atomic operations are preserved.
  • Concurrency: Existing concurrency and capacity behavior remains covered by integration tests.
  • Backward compatibility: Existing deployments retain the original key format by default.

Breaking Changes

None. The default namespace preserves existing Redis key formats.

Checklist

  • The PR focuses on one logical change.
  • No secrets or credentials were committed.
  • No unrelated files were modified.
  • Tests were added or updated.
  • All tests pass locally.

@sonarqubecloud

Copy link
Copy Markdown

@yashdotdev13
yashdotdev13 requested review from yashdotdev13 and removed request for yashdotdev13 November 23, 2026 04:22
@yashdotdev13
yashdotdev13 merged commit 57a1bf7 into yashdotdev13:main Nov 23, 2026
2 checks passed
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.

Add Redis key namespace and environment prefix

2 participants