pingcap/tidb

*: a better design for concurrent access of GlobalConfig

Open

#30.366 geöffnet am 3. Dez. 2021

Auf GitHub ansehen
 (3 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)Go (6.186 Forks)batch import
help wantedsig/sql-infratype/enhancement

Repository-Metriken

Stars
 (40.090 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 4h) (346 gemergte PRs in 30 T)

Beschreibung

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:

Contributor Guide