Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support direct shard database operation routing in Spring JDBC #31506

Commits on Aug 3, 2023

  1. Introduce ShardingKeyDataSourceAdapter to get shard connections.

    This commit introduces a DataSource proxy, that changes the behavior of the getConnection method to use the `createConnectionBuilder()` api to acquire direct shard connections. The shard connection is acquired by specifying a `ShardingKey` that is correspondent to the wanted shard.
    
    The sharding key can be specified either by setting the thread bound sharding key value, which will be used later by the `getConnection()` method, or by defining a `ShardingKeyProvider` which is used in the `getConnection` method to get the ShardingKey.
    
    If both ways are used at the same time, the thread-bound sharding key is the one that will be used.
    
    The goal of binding the sharding key to the current thread, is that we want to specify the sharding key at one level, and want it to be used later in another level, without the need to propagate it, for example set the thread-bound sharding key, and execute a `JdbcTemplate.query(SQL)` method that that will call `DataSource.getConnection()`, and as the sharding key is bound to the thread, it can be acquired to get the shard connection.
    Mohamed Lahyane (Anir) committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    fd09639 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. Add tests for ShardingKeyDataSourceAdapter

    Mohamed Lahyane (Anir) authored and meedbek committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    f107dfd View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. Configuration menu
    Copy the full SHA
    462ecfc View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. Configuration menu
    Copy the full SHA
    471da35 View commit details
    Browse the repository at this point in the history