cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.18k stars 3.82k forks source link

log: unify the async flush goroutine and the buffer sink flusher #72458

Open knz opened 3 years ago

knz commented 3 years ago

This is follow up work to #70330.

Currently the log package has two separate time-based flushing mechanism:

We would like to unify both mechanisms.

Consideration should be given to simplicity and troubleshooting/maintenance burden. The global periodic flusher goroutine has some simplicity advantages and the current bufferSink design provides flexilbility wrt flushing that was not exactly called for by its motivating use cases.

Jira issue: CRDB-11166

knz commented 3 years ago

One thing that's important is to ensure the buffer sink decorator honors the "always flush" toggle set up when a server process receives SIGTERM for the first time (see cli/start.go)