Tools should default to unbuffered stdout/stderr

Description

When running various tools on Kubernetes, output is buffered by default which makes debugging a bit problematic.

For example, pt-archiver:

 

First timestamp is created by Kubernetes, 2nd by pt-archiver. It took around 6 minutes to see output, even though the tool was running and doing work. In a customer case we saw 10+ minutes delay before "kubectl logs" would show output.

Adding STDOUT->autoflush(1); somewhere before progress output should fix it.

Example above was from pt-archiver, but same would apply to pt-online-schema-change etc.

It would be great to have an option like --buffered-output which could either default to ON to keep old behavior, or OFF to always have unbuffered output. Performance boost of buffering stdout/stderr is probably negligible.

 

Environment

None

AFFECTED CS IDs

CS0025233, CS0029256

Smart Checklist

Activity

Show:

Details

Assignee

Reporter

Priority

Affects versions

Fix versions

Smart Checklist

Created March 7, 2022 at 8:40 AM
Updated November 14, 2024 at 8:43 PM