Skip to content
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

Print status to migrationContext logger #1194

Conversation

SocalNick
Copy link
Contributor

NOTE: This is a simple alternative to #1193

A Pull Request should be associated with an Issue.

We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
and potentially we'll be able to point development in a particular direction.

Related issue: #1026

Further notes in https://github.com/github/gh-ost/blob/master/.github/CONTRIBUTING.md
Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR

Description

Status is currently only sent to stdout. We'd like the status to also be sent to the migrationContext logger.

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.

@SocalNick SocalNick changed the title Print status to migration context logger Print status to migratioContext logger - simple alternative to #1193 Oct 27, 2022
@SocalNick SocalNick changed the title Print status to migratioContext logger - simple alternative to #1193 Print status to migratioContext logger Oct 27, 2022
@SocalNick SocalNick changed the title Print status to migratioContext logger Print status to migrationContext logger Oct 27, 2022
@SocalNick
Copy link
Contributor Author

Hi @Svoyu - I see you approved this change, but I can't merge it because none of the workflows have run. It says, "First-time contributors need a maintainer to approve running workflows."

Are you able to approve those to run?

@dm-2
Copy link
Contributor

dm-2 commented Nov 14, 2022

Hi @Svoyu - I see you approved this change, but I can't merge it because none of the workflows have run. It says, "First-time contributors need a maintainer to approve running workflows."

Are you able to approve those to run?

Hi @SocalNick, I've approved the workflows to run - all looks good! 😄

(P.S. I think @syoyu is a spam user so I've reported their account)

@WesleyW
Copy link

WesleyW commented May 1, 2023

Hi there, we're currently using a fork to get this functionalit - are there any plans for a new release soon? We can use the commit hash in the meanwhile if that's not in the works yet. @dm-2

@SocalNick SocalNick mentioned this pull request May 16, 2023
icyflame added a commit to icyflame/gh-ost that referenced this pull request Jan 31, 2024
The string `status` has the character `%` after the progress percentage number. When printed once
again using the `Infof` function, this `%` is read as a directive for formatting and ends up showing
`MISSING` in the output as shown below:

	2024-01-31 12:49:54 INFO Copy: 0/0 100.0%!;(MISSING) Applied: 0; Backlog: 0/1000; Time: 0s(total), 0s(copy); streamer: mysql_bin.000002:79674; Lag: 0.00s, HeartbeatLag: 0.02s, State: migrating; ETA: due

Simply changing `Infof` to `Info` does not work here because `this.migrationContext.Log` is an
object of the type `DefaultLogger` in this repository, which uses the library
https://github.com/outbrain/golib/log. That library uses formatting __even__ when the `Info`function
is called:
https://github.com/outbrain/golib/blob/2531e5dbcc71b6f8a4ccf1205c209ae89b7529fc/log/log.go#L191-L193

If this patch is not acceptible, then I can also just remove this line. The migration context logger
prints the messages which are already printed to STDOUT once again to STDERR with the current time
as a prefix. This change was introduced in the commit
https://github.com/github/gh-ost/blob/515aa72d3d9b756e454b0168b4e57bc599b45e36/go/logic/migrator.go#L1039,
introduced in the PR github#1194.
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.

4 participants