Skip to content

Fix output for binary keys in -verbose mode. #1559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

burnison
Copy link
Contributor

@burnison burnison commented May 23, 2025

Description

When migrating a table with a binary key in -verbose mode, different sequences of bytes may prevent execution output from being logged, or correctly logged, to the console.

This happens because the MigrationRange*Values are printed to the screen without any type of encoding. One particularly problematic sequence is 27/0x1b, Escape, which causes the terminal to stop logging for the duration of the migration:

2025-05-23 11:53:27 INFO Listening on unix socket file: /tmp/gh-ost.test.binfoo.sock
2025-05-23 11:53:27 INFO Intercepted changelog state ReadMigrationRangeValues
2025-05-23 11:53:27 INFO Handled changelog state ReadMigrationRangeValues
2025-05-23 11:53:27 INFO Migration min values: [

This commit changes the to-string rendering for binary keys, rendering the values as a hex string rather than an unescaped series of bytes:

2025-05-23 11:53:58 INFO Listening on unix socket file: /tmp/gh-ost.test.binfoo.sock
2025-05-23 11:53:58 INFO Intercepted changelog state ReadMigrationRangeValues
2025-05-23 11:53:58 INFO Handled changelog state ReadMigrationRangeValues
2025-05-23 11:53:58 INFO Migration min values: [b51b0000000000000000000000000000]
2025-05-23 11:53:58 INFO Migration max values: [b51b0000000000000000000000000000]
2025-05-23 11:53:58 INFO Waiting for first throttle metrics to be collected
...

While this build passes and has the expected outcome locally, I'm not positive that this change to StringColumn is used only for logging/debugging purposes. This is something I hope you can verify.

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

When migrating a table with a `binary` key in `-verbose` mode, different
sequences of bytes may prevent execution output from being logged, or
correctly logged, to the console.

This happens because the `MigrationRange*Values` are printed to the
screen without any type of encoding. One particularly problematic
sequence is `0x27`, `Escape`, which causes the terminal to stop logging
for the duration of the migration:

```
2025-05-23 11:53:27 INFO Listening on unix socket file: /tmp/gh-ost.test.binfoo.sock
2025-05-23 11:53:27 INFO Intercepted changelog state ReadMigrationRangeValues
2025-05-23 11:53:27 INFO Handled changelog state ReadMigrationRangeValues
2025-05-23 11:53:27 INFO Migration min values: [
```

This commit changes the to-string rendering for `binary` keys, rendering
the values as a hex string rather than an unescaped series of bytes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants