Support configurable action when log writes time out
- 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
Assessment
This issue has not been assessed yet.