Please answer these questions before submitting your issue. Thanks!
Since the GlobalMemoryUsageTracker is introduced, its size is decided by performance.max-memory configuration. But this configuration is still used by prepared plan cache to set the maximum plan cache size, better to remove this usage for prepare plan cache or change its name to avoid possible incorrect configurations, a single configuration should not have two usages.
@SunRunAway PTAL
Good catch. Thank you @cfzjywxk
The annotation in config file says,
# Max memory size to use, 0 use the total usable memory in the machine.
The configuration description clearly says that max-memory is the max memory to use (for tidb-server perhaps everyone would assume that).
But, The documentation says it's only used for plan cache.
The maximum memory limit for the Prepared Least Recently Used (LRU) caching.
IMO, for best compatibility for upgraded servers from old versions, we should,
max-memory is only for Plan Cache in tidb.toml.example in all release branches(v2.1, v3.0, v3.1, v4.0).max-memory should be changed back to the old meaning, and only be scoped in Plan Cache according to the documentation, then hide and deprecate in the future versions (v4.1, v5.0).memory-quota-server in the [performance] section.@Yisaer Would you like to take a look?
cc @fzhedu @XuHuaiyu
Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: https://github.com/pingcap/tidb/issues/20100
Most helpful comment
IMO, for best compatibility for upgraded servers from old versions, we should,
max-memoryis only for Plan Cache in tidb.toml.example in all release branches(v2.1, v3.0, v3.1, v4.0).max-memoryshould be changed back to the old meaning, and only be scoped in Plan Cache according to the documentation, then hide and deprecate in the future versions (v4.1, v5.0).memory-quota-serverin the[performance]section.