*: a better design for concurrent access of GlobalConfig
#30.366 aperta il 3 dic 2021
Metriche repository
- Star
- (40.090 star)
- Metriche merge PR
- (Merge medio 14g 4h) (346 PR mergiate in 30 g)
Descrizione
Enhancement
Currently, the GlobalConfig is loaded from the configuration file and can be modified('dynamic config') after that, several fields are wrapped with an atomic operation helper to avoid data race issues, for example:
But it can be vulnerable, for example:
https://github.com/pingcap/tidb/issues/30345 is introduced by #29247 but it is really hard for the developers to realize the race issue. In order to solve it, an atomic wrapper is introduced in https://github.com/pingcap/tidb/pull/30346.
IMO this may easily happen before we find a systematic way to solve it, possible alternatives are:
- Avoid changing the GlobalConfig after bootstrap by removing the 'dynamic configuration'(https://docs.pingcap.com/tidb/stable/dynamic-config#modify-tidb-configuration-online): if we want to change something, it can be archived by system variables.
- Make sure that GlobalConfig can be safely updated if we do keep the ability to change the fields on the fly.