pingcap / pingcap/tidb

Support configurable action when log writes time out

Open
#68,968 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Feature Request

TiDB currently uses `[log].timeout` to detect stuck log writes and panic when the timeout is reached. This is useful for fail-fast behavior, but some deployments may prefer to keep TiDB serving traffic and discard later log writes after a timeout is observed.

## Proposal

Introduce a new `[log].timeout-action` configuration item with valid values:

- `panic`: preserve the existing behavior. This remains the default.
- `discard`: after a log write/sync timeout is observed, discard later log writes/syncs instead of panicking.

The option should be passed through to the underlying `github.com/pingcap/log` configuration and should also apply to TiDB audit logs that use the TiDB log config.

## Notes

`discard` mode cannot cancel the goroutine already blocked in the OS/file write. It is intended to avoid later log calls repeatedly blocking or panicking while the underlying writer remains stuck.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.