-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix: return correct count of ErrNotExecuted #22273
Conversation
@@ -380,7 +380,7 @@ LOOP: | |||
} | |||
|
|||
// Send error results for any statements which were not executed. | |||
for ; i < len(query.Statements)-1; i++ { | |||
for i++; i < len(query.Statements); i++ { |
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.
I ran your new tests and they pass without this change, which is concerning
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.
Have simplified tests conditions, complicated test failure modes. Now can differentiate between previous and new code, as well as correcting a few other small bugs.
query/executor_test.go
Outdated
} | ||
for i := 0; i < len(q.Statements); i++ { | ||
closing = make(chan struct{}) | ||
testFn("executor", i, &executorFailIndex) |
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.
nitpick: I'd prefer to see:
executorFailIndex = i
testFn("executor", i)
query/executor_test.go
Outdated
if result.Err == query.ErrNotExecuted { | ||
cnt++ | ||
if result.StatementID <= failIndex { | ||
t.Fatalf("StatementID for ErrNotExecuted is wrong index: %d", result.StatementID) |
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.
Should we just check that all the indexes we expect to fail are actually failing (build a list of fail indexes and compare to the expected list?) Here we could be missing if one index shows up twice and another is missing.
query/executor_test.go
Outdated
t.Fatalf("StatementID for ErrNotExecuted is wrong index: %d", result.StatementID) | ||
} | ||
} | ||
r++ |
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.
Looks like r
is unused?
executeQuery() iterates over statements until each is processed or if an error is encountered that causes the loop to exit pre-maturely. It should return ErrNotExecuted for each remaining statement in the query closes #19136
b3aa31b
to
203a4dd
Compare
executeQuery() iterates over statements until each is processed or if an error is encountered that causes the loop to exit pre-maturely. It should return ErrNotExecuted for each remaining statement in the query closes influxdata#19136
executeQuery() iterates over statements until each is processed or if an error is encountered that causes the loop to exit pre-maturely. It should return ErrNotExecuted for each remaining statement in the query closes influxdata#19136
executeQuery() iterates over statements until each is
processed or if an error is encountered that causes
the loop to exit pre-maturely. It should return
ErrNotExecuted for each remaining statement in the
query
closes #19136