You can set the proxy_route_policy session variable to allow OceanBase Database Proxy (ODP) to first read data from a follower. This setting takes effect in the weak consistency read mode. When it is effective, data is first read from a follower.
Log on to the business tenant from a supported client tool. Execute the following statement to set the proxy_route_policy variable:
obclient> SET @proxy_route_policy='[policy]';
Valid values of the [policy] parameter:
follower_first: ODP reads data first from a follower, even if the cluster is in a major compaction. Priority order:Follower not in a major compaction in the same IDC > Follower not in a major compaction in a different IDC in the same region > Follower in a major compaction in the same IDC > Follower in a major compaction in a different IDC in the same region > Leader not in a major compaction in the same IDC > Leader not in a major compaction in a different IDC in the same region > Leader in a major compaction in the same IDC > Leader in a major compaction in a different IDC in the same region > Follower not in a major compaction in a different region > Follower in a major compaction in a different region > Leader not in a major compaction in a different region > Leader in a major compaction in a different region
unmerge_follower_first: ODP reads data first from a follower that is not in a major compaction. Priority order:Follower not in a major compaction in the same IDC > Follower not in a major compaction in a different IDC in the same region > Leader not in a major compaction in the same IDC > Leader not in a major compaction in a different IDC in the same region > Follower in a major compaction in the same IDC > Follower in a major compaction in a different IDC in the same region > Follower not in a major compaction in a different region > Leader not in a major compaction in a different region > Follower in a major compaction in a different region > Leader in a major compaction in a different region
Other values: The normal load-balanced routing logic in weak consistency read mode is adopted. Priority order:
Leader or follower not in a major compaction in the same IDC > Leader or follower not in a major compaction in a different IDC in the same region > Leader or follower in a major compaction in the same IDC > Leader or follower in a major compaction in a different IDC in the same region > Leader or follower not in a major compaction in a different region > Leader or follower in a major compaction in a different region