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

add warning message when delete to release-3.5 #13748

Merged
merged 1 commit into from
Nov 5, 2022

Conversation

kkkkun
Copy link
Contributor

@kkkkun kkkkun commented Feb 28, 2022

Fixes #13705

Base PR: #13729
Change commit branch from main to release-3.5

@kkkkun
Copy link
Contributor Author

kkkkun commented Mar 1, 2022

/assign @ptabor

Copy link
Contributor

@ptabor ptabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the only case we want to issue a warning is case
that happens in line 72 of the original code:

opts = append(opts, clientv3.WithRange(args[1]))

i.e. the flags like --prefix', --from-keyor (to be added)--range` are not given...

The code should IMHO print warning only iff:

  • none of the flag is given
  • the command has 2 arguments.

BTW: I would still recommend submiting a PR to main adding the --range flag and warning .... and backport it to 3.5 later.

@kkkkun
Copy link
Contributor Author

kkkkun commented Mar 2, 2022

If I understand correctly, the only case we want to issue a warning is case that happens in line 72 of the original code:

opts = append(opts, clientv3.WithRange(args[1]))

i.e. the flags like --prefix', --from-keyor (to be added)--range` are not given...

The code should IMHO print warning only iff:

  • none of the flag is given
  • the command has 2 arguments.

BTW: I would still recommend submiting a PR to main adding the --range flag and warning .... and backport it to 3.5 later.

According to your advice. I sumbit this to release-3.5
and submit #13747 to main for 3.6 or later ?

@kkkkun kkkkun force-pushed the add-warning-for-del branch 2 times, most recently from 1960aa6 to 6801502 Compare March 2, 2022 06:52
@kkkkun kkkkun changed the title add warning message when delete add warning message when delete to release-3.5 Mar 2, 2022
Copy link
Contributor

@ptabor ptabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does not work....
It prints warning only

etcdctl/ctlv3/command/del_command.go Outdated Show resolved Hide resolved
etcdctl/ctlv3/command/del_command.go Outdated Show resolved Hide resolved
@@ -91,5 +96,9 @@ func getDelOp(args []string) (string, []clientv3.OpOption) {
opts = append(opts, clientv3.WithFromKey())
}

if !ignoreWarn {
fmt.Fprintf(os.Stderr, "Warning: will delete servarl keys.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would state it as:

Warning: This operations is implicitly deleting range of keys. Please add flag `--range` to make it explicit. Will sleep in v3.5. 

Copy link
Contributor Author

@kkkkun kkkkun Mar 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would state it as:

Warning: This operations is implicitly deleting range of keys. Please add flag `--range` to make it explicit. Will sleep in v3.5. 

This PR commit to release-3.5?

Should we chang to this

Warning: This operations is implicitly deleting range of keys. 

When commit to main:

> Warning: This operations is implicitly deleting range of keys. Please add flag `--range` to make it explicit. Will sleep in v3.6. 

If we want add --range to 3.5. Please take a look #13747. If merged, we cherry-pick to release-3.5.

Do we need --range in release-3.5?

@kkkkun kkkkun requested a review from ptabor March 6, 2022 06:07
@serathius serathius mentioned this pull request Apr 6, 2022
28 tasks
@ahrtr
Copy link
Member

ahrtr commented May 15, 2022

Why the warning message in this PR is different from the message in 13747 ?

This is a kind of enhancement, so in my opinion it should NOT be backported to 3.5. However it's just a very minor change, I will not insist on this if other maintainers/reviewers approve this PR.

@kkkkun
Copy link
Contributor Author

kkkkun commented May 17, 2022

Why the warning message in this PR is different from the message in 13747 ?

This is a kind of enhancement, so in my opinion it should NOT be backported to 3.5. However it's just a very minor change, I will not insist on this if other maintainers/reviewers approve this PR.

Copy from #13705 (comment)
It‘s just a warning message.

 In 3.5 we could add a warning on stderr.
 In 3.6 we could add support for --range and sleep (2s) if the --range is not given:
 a) let the operation be cancelled by human operator
 b) trigger attention of the script owners to start using the new flag.

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cc @serathius @spzala @ptabor Please see my comment issuecomment-1126916984.

Copy link
Contributor

@ptabor ptabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds Sleep(2sec) to 3.5, so has potential to break customer's workflows thus cannot be accepted.

I'm for submitting just warning+flag to 3.5, to let customer's prepare for 3.6, but the message needs to be adjusted.

@kkkkun
Copy link
Contributor Author

kkkkun commented Jun 13, 2022

This PR adds Sleep(2sec) to 3.5, so has potential to break customer's workflows thus cannot be accepted.

I'm for submitting just warning+flag to 3.5, to let customer's prepare for 3.6, but the message needs to be adjusted.

The message has been adjusted to #13748 (comment)

@kkkkun kkkkun force-pushed the add-warning-for-del branch 2 times, most recently from 5a59b27 to 25ff3c7 Compare June 14, 2022 03:33
"go.etcd.io/etcd/pkg/v3/cobrautl"
"os"
"time"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to group the import entries properly. The build-in package os, time and fmt should be grouped together and above other packages.

@ahrtr
Copy link
Member

ahrtr commented Jun 23, 2022

This PR adds Sleep(2sec) to 3.5, so has potential to break customer's workflows thus cannot be accepted.

I'm for submitting just warning+flag to 3.5, to let customer's prepare for 3.6, but the message needs to be adjusted.

@ptabor was requesting to remove the sleep, and I agree with that. Please also remove "Will sleep in v3.5." from the message as well, or change it to "Will sleep for a while in v3.6"?. cc @spzala for the professional opinion for the English syntax.

@ahrtr
Copy link
Member

ahrtr commented Jul 9, 2022

Please sign off the commit.

git commit --signoff --amend

@kkkkun kkkkun force-pushed the add-warning-for-del branch 2 times, most recently from 4c2715d to 00f1987 Compare July 10, 2022 02:29
@ahrtr
Copy link
Member

ahrtr commented Jul 10, 2022

Looks good to me now, @ptabor Do you have any comments?

@ahrtr
Copy link
Member

ahrtr commented Oct 9, 2022

Just to be clearer, this PR is a partially backporting of #13747

This is a minor enhancement for the etcdctl del command. Usually we only backport bug fix, so we shouldn't backport this PR. But since it's just a minor enhancement and it's useful, so I will not object if other maintainers agree to backport it.

What's your opinion? @ptabor @spzala @serathius If there is no response, then I assume there is no interest on this PR for 3.5. Then we can close it.

@@ -70,6 +73,9 @@ func getDelOp(args []string) (string, []clientv3.OpOption) {
cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("too many arguments, only accept one argument when `--prefix` or `--from-key` is set"))
}
opts = append(opts, clientv3.WithRange(args[1]))
if !delRange {
fmt.Fprintln(os.Stderr, "Warning: This operations is implicitly deleting range of keys. Please add flag `--range` to make it explicit. Will sleep for a while in v3.6.")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @ahrtr that Will sleep for a while... is difficult to interpret. Sorry, I took longer to review, but I would suggest something like these:
In etcd v3.6, along with this warning, the delete operation will be suspended for a few seconds to provide the user time to verify range.
or
In etcd v3.6, the operation will be suspended for a few seconds to provide the user time to verify range.
or
In v3.6, the operation will be suspended for a few seconds to provide the user time to verify range.
Thanks @kkkkun

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I would change to the second
In etcd v3.6, the operation will be suspended for a few seconds to provide the user time to verify range.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@spzala
Copy link
Member

spzala commented Oct 23, 2022

Just to be clearer, this PR is a partially backporting of #13747

This is a minor enhancement for the etcdctl del command. Usually we only backport bug fix, so we shouldn't backport this PR. But since it's just a minor enhancement and it's useful, so I will not object if other maintainers agree to backport it.

What's your opinion? @ptabor @spzala @serathius If there is no response, then I assume there is no interest on this PR for 3.5. Then we can close it.

@ahrtr I agree with your thoughts here. I am okay with backporting. Thanks!

Signed-off-by: kkkkun <scuzk373x@gmail.com>
@ahrtr
Copy link
Member

ahrtr commented Nov 5, 2022

Thanks @kkkkun

@ahrtr ahrtr merged commit c2378be into etcd-io:release-3.5 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants