Please sign in to comment.
BUG/MINOR: log: make "show startup-log" use a ring buffer instead
The copy of the startup logs used to rely on a re-allocated memory area on the fly, that would attempt to be delivered at once over the CLI. But if it's too large (too many warnings) it will take time to start up, and may not even show up on the CLI as it doesn't fit in a buffer. The ring buffer infrastructure solves all this with no more code, let's switch to this instead. It simply requires a parsing function to attach the ring via ring_attach_cli() and all the rest is automatically handled. Initially this was imagined as a code cleanup, until a test with a config involving 100k backends and just one occurrence of "load-server-state-from-file global" in the defaults section took approx 20 minutes to parse due to the O(N^2) cost of concatenating the warnings resulting in ~1 TB of data to be copied, while it took only 0.57s with the ring. Ideally this patch should be backported to 2.0 and 1.9, though it relies on the ring infrastructure which will then also need to be backported. Configs able to trigger the bug are uncommon, so another workaround for older versions without backporting the rings would consist in simply limiting the size of the error message in print_message() to something always printable, which will only return the first errors.
- Loading branch information
Showing with 31 additions and 19 deletions.