tidb-operator icon indicating copy to clipboard operation
tidb-operator copied to clipboard

Avoid using temporary storage of slow-log tailer

Open aylei opened this issue 4 years ago • 2 comments

Feature Request

Is your feature request related to a problem? Please describe:

Currently, the slow-log tailer requires the tidb-server output slow logs to a temporary dir and tail it to its STDOUT. However, this approach would consume ephemeral storage and may cause tidb-server being evicted under Disk Pressure.

Describe the feature you'd like:

Use pipe to transfer the slow log instead:

# tidb process
> mkfifo slow.log
> ./tidb-server --log-slow-query slow.log

# slow log tailer
> cat slow.log

Pipe does not consume any filesystem storage. We may lose slow logs if the tailer is abnormal, but this can hardly happen since the tailer is as simple as a single cat process.

Describe alternatives you've considered:

N/A

Teachability, Documentation, Adoption, Migration Strategy:

This would be change that requires rolling-restart of tidb-servers, if we think rolling-restarting tidb-servers should be avoided when upgrading tidb-operator, we can add an feature-gate and let the user enable is actively.

aylei avatar Jan 04 '22 03:01 aylei

@aylei Is mkfifo a good way to print the logs in a container? What about we suggest using a PV for the slow log?

DanielZhangQD avatar Jan 05 '22 10:01 DanielZhangQD

if #25716 to be fixed, is this still a potential problem?

yiduoyunQ avatar Jan 14 '22 06:01 yiduoyunQ