pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.37k stars 5.86k forks source link

Allow to specify diagnostics folder #55513

Open Tema opened 3 months ago

Tema commented 3 months ago

Enhancement

TiDB Server piggybacks on --log-file param or filename config to define a folder where to put diagnostic data emitted by PLAN REPLAYER or oom_record from excessive memory usage.

The default value of filename is empty string "", which translates to the working directory. In the container world it translates to the root directory "/" unless overridden in the container file. TiDB Dockerfile explicitly sets it to the root directory as well.

Note that if filename is specified, the tidb-server logs stops going to the system output, which breaks easy log access using kubectl log command and breaks standard log export setup for kubernetes clusters.

Please consider to add a command line flag or system variable to specify the directory for the diagnostic data mentioned above.

songrijie commented 2 months ago

It makes sense to move the output of PLAN REPLAYER to tmp-storage-path, as it's for temporary storage in TiDB. For oom_record, we will introduce another location for trace files. We will encourage users to setup permanent volume for trace files.