-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
workload/ycsb: Use StmtContext instead of Stmt #39525
Conversation
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.
The reason for the deadline was the --duration
flag?
Reviewed 1 of 1 files at r1.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)
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.
context.DeadlineExceeded
comes from the --ramp
flag which gradually starts all workers with a rampCtx
then restarts them with the main context.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)
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.
context.DeadlineExceeded comes from the --ramp flag which gradually starts all workers with a rampCtx then restarts them with the main context.
👌
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)
pkg/workload/ycsb/ycsb.go
Outdated
return err | ||
}) | ||
if err == gosql.ErrNoRows { |
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.
if err == gosql.ErrNoRows && ctx.Err() != nil {
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 once that comment is addressed.
StmtContext allows context.DeadlineExceeded error to be returned consistently. Using Stmt would sometimes return "sql: transaction has already been committed or rolled back" causing the workload to fail. Additionally, sometimes a context cancellation during a transaction can result in sql.ErrNoRows instead of the appropriate context.DeadlineExceeded. In this case, we just return ctx.Err(). Release note: None
TFTRs! bors r+ |
39525: workload/ycsb: Use StmtContext instead of Stmt r=jeffrey-xiao a=jeffrey-xiao `StmtContext` allows `context.DeadlineExceeded` error to be returned consistently. Using `Stmt` would sometimes return `sql: transaction has already been committed or rolled back` causing the workload to fail. Additionally, sometimes a context cancellation during a transaction can result in sql.ErrNoRows instead of the appropriat econtext.DeadlineExceeded. In this case, we just return ctx.Err(). See lib/pq#874. Fixes #39521. `workload run ycsb --drop --insert-count=1000000 --splits=100 --workload=F --concurrency=64 --ramp=1m --duration=10m` terminates successfully with this change. Release note: None Co-authored-by: Jeffrey Xiao <jeffrey.xiao1998@gmail.com>
Build succeeded |
StmtContext
allowscontext.DeadlineExceeded
error to be returned consistently. UsingStmt
would sometimes returnsql: transaction has already been committed or rolled back
causing the workload to fail.Additionally, sometimes a context cancellation during a transaction can result in sql.ErrNoRows instead of the appropriat econtext.DeadlineExceeded. In this case, we just return ctx.Err().
See lib/pq#874.
Fixes #39521.
workload run ycsb --drop --insert-count=1000000 --splits=100 --workload=F --concurrency=64 --ramp=1m --duration=10m
terminates successfully with this change.Release note: None