Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 系统变量tidb_general_log是global还是session?
[TiDB Usage Environment] Production Environment v3.0.12
[TiDB Version] v3.0.12
The documentation I read says that tidb_general_log is global, but when I use the command set global tidb_general_log=on; it gives an error
ERROR 1105 (HY000): Variable ‘tidb_general_log’ is a SESSION variable and can’t be used with SET GLOBAL
When I use set @@tidb_general_log or set tidb_general_log = 1, it takes effect globally on the current server (I create a new connection and see that the variable value has changed, and I understand that the new connection is not the same session).
I’m very confused!!!
The image is not visible. Please provide the text you need translated.
Uh… Off-topic
You might want to consider upgrading!
Your version is too old. In 4.0, the scope is INSTANCE. In 3.0, it is definitely not global. You should upgrade your version.
The error message indicates that it is a SESSION variable, right? Using set @@tidb_general_log
or set tidb_general_log = 1
only affects the current TiDB instance connection. The documentation also states that it is not persisted to the cluster and only affects the current instance connection.
tidb_general_log
- Scope: GLOBAL
- Persisted to the cluster: No, only affects the current TiDB instance connection
After I set it to 1, I checked the logs and it took effect on the current TiDB instance. If it is at the session level, it should become invalid after I close the client connection, but it is still effective now, so I am confused.
This is instance-level scope.
Instance-level modification:
- Effective for all sessions of the current TiDB instance;
The modification will not be persisted and will be invalidated upon restart.
It should be like this, thank you.
The old version was too frustrating. The documentation was hard to find.
You can test it yourself, the version is too old.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.