Skip to content

Conversation

@KIRTIKUMARKK21
Copy link

Description

Added a new DATABASE_ID_HEADER_KEY constant (x-database-id) to RequestContextConstants to support database routing decisions in multi-database deployments. This header allows services to specify which database instance should handle a request, enabling database sharding or multi-tenancy at the database level.

The header is:

  • Added to HEADER_PREFIXES_TO_BE_PROPAGATED to ensure it propagates across gRPC service calls
  • Added to CACHE_MEANINGFUL_HEADERS since database selection affects query results and must be considered for cache invalidation

Testing

  • Verified the constant compiles without errors
  • Confirmed the header is included in propagation and cache-meaningful header sets
  • Manual testing required: Deploy and verify the header propagates correctly in a multi-service environment
  • Manual testing required: Verify cache behavior respects the database ID header

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Documentation

No documentation changes required - this is an internal constant addition. Services consuming this library will need to document their own usage of the x-database-id header based on their specific database routing implementation.

@KIRTIKUMARKK21 KIRTIKUMARKK21 requested a review from a team as a code owner November 13, 2025 06:37
@puneet-traceable
Copy link

I caught up with QE as well and for them to be able to test, they would need a way to use both(mongo/pg) for the same tenant. I am thinking should we use two flags on the lines( usePostgres/forceUsePostgres).
@anujgoyal1 Your thoughts?

Copy link
Contributor

@aaron-steinfeld aaron-steinfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to hear more about what you're trying to accomplish with this and see if we can find a way to do so that doesn't break abstraction like this. Could we set up some time to discuss (or just ping me)

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.

3 participants