distributed-databasetidb

How to modify tidb default GLOBAL variables like "tidb_replica_read" value in TiDB


Concept: https://pingcap.com/docs/dev/follower-read/

For detailing, i have also asked the question in here: https://github.com/pingcap/tidb/issues/17650

While getting value of tidb_replica_read config param, it shows "leader" by DEFAULT. Document of pingcap (link at top) says that it can be set using session variable. How can i change globally. I am unable to find a my.cnf type file neither any appropriate section in TiDB config: https://github.com/pingcap/tidb/blob/master/config/config.toml.example

Can someone help if this is possible with existing TiDB support?

PS: i already tried

set @@global.tidb_replica_read='follower';

It threw error: ERROR 1105 (HY000): Variable 'tidb_replica_read' is a SESSION variable and can't be used with SET GLOBAL


Solution

  • Agree with AndreMouche, this is not supported as of now

    Edit: My PR was merged recently - https://github.com/pingcap/tidb/pull/27622. You can expect this feature in next release