-
Notifications
You must be signed in to change notification settings - Fork 35
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
Implement failpoint counter #58
Conversation
Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com> Signed-off-by: Prasad Chandrasekaran <prasadc@vmware.com> Co-authored-by: Marek Siarkowicz <marek.siarkowicz@protonmail.com> Co-authored-by: Benjamin Wang <wachao@vmware.com>
runtime/http.go
Outdated
lines[i] = fps[i] + "=" + s | ||
} | ||
w.Write([]byte(strings.Join(lines, "\n") + "\n")) | ||
} else if strings.HasSuffix(key, "/execution-count") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think the change from "/count" to "/execution-count" was needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recovered to "/count"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge it and start using in robustness tests so we can iterate.
Please fix the failures |
dc10eb8
to
e2975e9
Compare
lint failures fixed, please review |
e2975e9
to
e8dcc53
Compare
cc @ahrtr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good with two minor comments. Thanks.
doc/design.md
Outdated
@@ -69,6 +69,16 @@ Similarly, you can set multiple failpoints using endpoint `/failpoints`, | |||
curl http://127.0.0.1:22381/failpoints -X PUT -d'failpoint1=return("hello");failpoint2=sleep(10)' | |||
``` | |||
|
|||
You can get the execution count of the failpoint in the dynamic way, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
You can get the execution count of the failpoint in the dynamic way, | |
You can get the execution count of a failpoint in the dynamic way, |
runtime/terms_test.go
Outdated
// This example tests mods which allows users to restrict the | ||
// number of failpoint actions as against their callsite executions. | ||
// This is the reason why wantCount < runAfterEnabling | ||
// In a real world example you can hit a code spot a million times but | ||
// using mods restrict the associated fallpoint actions to run twice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good test case, but the comment isn't clear to me.
// This example tests mods which allows users to restrict the | |
// number of failpoint actions as against their callsite executions. | |
// This is the reason why wantCount < runAfterEnabling | |
// In a real world example you can hit a code spot a million times but | |
// using mods restrict the associated fallpoint actions to run twice. | |
// Note the chain of terms is allowed to be executed 11 times at most, | |
// including 10 times for the first term `10*sleep(10)` and 1 time for | |
// the second term `1*return("abc")`. So it's only evaluated 11 times | |
// even it's triggered 12 times. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for your suggestions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @ZhouJianMS. Looks good, one minor suggestion below.
runtime/http.go
Outdated
fp := key[:len(key)-len("/count")] | ||
_, count, err := status(fp) | ||
if err != nil { | ||
if err == ErrNoExist { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit - Suggest errors.Is
.
if err == ErrNoExist { | |
if errors.Is(err, io.ErrNoExist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for your suggestion!
Signed-off-by: ZhouJianMS <zhoujian@microsoft.com>
e8dcc53
to
88b6b0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks.
This is PR based out of @ramil600 PR #37 and @pchan PR #47 and is intended to address etcd-io/etcd#14729.
New changes include:
cc: @ramil600 @pchan @serathius @ahrtr @lavacat