-
Notifications
You must be signed in to change notification settings - Fork 29
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
Show progress of CREATE INDEX #113
Comments
Thanks for filing the feature request. I was thinking of the same thing 👍
I prefer percent for simplicity, but basically both are fine. Besides the percent, it would be better to show the elapsed time to make it possible to guess when the backfill will finish.
I think the most time consuming task for updating DDL would be index backfilling, so it might make sense to show the index backfill progress even if it contains other DDL statements. Other consideration is whether we show index backfill progress when it's running as batch mode. If it shows the progress, I think spanner-cli would be the good alternative to |
Blocker: |
|
I don't have a concrete idea yet for the actual implementation in Note: The elapsed time may rewind because the final Rewriting a single lineRewriting multiple linesNon-rewriting multiple lines(for non-tty output) |
Thanks for creating some prototypes. These are great resources to think about an appropriate format.
Personally I prefer this one, but if it's hard to implement this, I think it's adequate to use "Rewriting a single line" pattern.
I think it's common to see this pattern in some build logs like CircleCI's or Cloud Build's when we try to rewrite the output line. I'm not sure, but can't we rewrite the line if we run spanner-cli as a batch mode? |
I think it isn't so hard but I didn't yet think the change to program structure and portable implementation of rewriting(like Windows support).
I think ordinal executions of the batch mode in a terminal is suited for rewriting multiple-line format. I have experienced the case that some CI build log has broken(including unprocessed escape sequences) because the execution environment is tty but build log doesn't support escape sequences. |
Consideration about "non-rewriting multiple lines":
|
I think it's better to use a well-tested library to rewrite the line. One of the examples is gosuri/uilive which supports windows.
I'm not completely sure, but can we say it's a rare case? If it happens on the major CI providers like CircleCI or Cloud Build, it might be better to add such a flag, but if it's not, I don't think adding more flag is a good option because there is a workaround. Please correct me if my assumption is wrong. |
Yeah, I think it is a major case. Test repo CircleCICircleCI seems to completely ignore unsupported ANSI escape code(no handling). version: 2
jobs:
build:
docker:
- image: ubuntu
steps:
- run: for i in $(seq 1 10); do echo "\033[F\033[2K${i}" && sleep 1; done Cloud BuildCloud Build doesn't support to rewrite and only strip ANSI escape code. steps:
- name: ubuntu
entrypoint: /bin/sh
args:
- -c
- |
for i in $(seq 1 10); do echo "\033[F\033[2K${i}" && sleep 1; done Refs: |
I think many tools see |
Thank you for quickly trying out on some CI providers!
Ah that's a good idea. Even though we have to add some logic in ad hoc way, that looks better than providing a new flag. |
Related discussion in CircleCI Discuss. I think format like "Rewriting multiple lines" will be broken in major CI and file redirection so non-rewriting mode is needed but flag is not mandatory if some workaround is documented.( |
Another choice:
|
Yeah that would be a viable option. But I'm wondering the use case where users need to run To cover that use case, what about always rewriting the lines and documenting the workaround for users who don't want that behavior? |
Does "always" means regardless of whether or not on tty? |
If I understand correctly the results of your experiments on CircleCI and Cloud Build, both CI systems just ignores the escape character for erasing the line. So if spanner-cli attempts to rewrite the line on those environments, it would show the following long listing outputs:
So I wanted to mean if a user doesn't want to be bothered with long listing outputs on non-tty environment like the preceding example, then I think they can suppress the output with One thing I don't fully understand is how turning the stdin/stdout to non-tty mode becomes the workaround for users who bothers with the broken log output (escape character is shown as it is) or long listing output like the above example. Could you elaborate on that? |
I think rewriting multiple-line output format isn't suitable without rewriting because it is multiple-lines and short interval update of elapsed_time even if there are no update in operation status. If there are 4 statements in batch, output will be shown as below.
( There may be some improvement(like separator) but basically it emit huge sized logs(in above format, Non-rewriting output mode can resolve problems.
Below is the case of printing current statement when status changed or 10m interval.
|
That makes sense. Thanks for describing the disadvantage of rewriting the lines on CI systems 👍 Okay, for the simplicity, how about using he following two different modes for showing the index backfill progress?
|
Interactive mode doesn't support batch execution of multiple statements so it means:
|
That looks good to me 👍 |
Currently, spanner-cli doesn't show anything until
CREATE INDEX
is done.Recently, Cloud Spanner supports tracking of the progress of index backfill operations.
https://cloud.google.com/spanner/docs/release-notes#April_06_2021
So we can show progress of index creation using polling.
Consideration
CREATE INDEX
and other DDLs which doesn't supportprogressPercent
.The text was updated successfully, but these errors were encountered: