Support a new read_consistency_level #16604
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for a new read consistency level,
follower_read
, across the IoTDB codebase. The changes ensure that configuration, logic, and documentation now recognize and correctly handle this new option alongside the existingstrong
andweak
levels.Read Consistency Level Enhancements:
FOLLOWER_READ
to theReadConsistencyLevel
enum inReadConsistencyLevel.java
, allowing the system to use follower replicas for read operations.ConfigNodeDescriptor.java
andIoTDBConfig.java
to accept and validate the newfollower_read
value, throwing exceptions for unknown values. [1] [2]AbstractFragmentParallelPlanner.java
to select follower replicas whenFOLLOWER_READ
is specified, ensuring the leader is skipped and a follower is chosen based on session ID.iotdb-system.properties.template
to document the newfollower_read
option for users.Refactoring and Logic Separation:
AbstractFragmentParallelPlanner.java
by extracting target index determination into a separate method, improving readability and maintainability.Supposing we have a 3C3D cluster and data replica number is set to 3, we execute the following sqls to prepare data:
Before this pr, if we do

select * from t1;
query, the query will always be routed to leader:After this pr, if we set

read_consistency_level=follower_read
and then restart the cluster, then the above query will always be routed to any follower: