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

fix: return correct count of ErrNotExecuted #22273

Merged
merged 5 commits into from
Aug 24, 2021
Merged

Conversation

davidby-influx
Copy link
Contributor

@davidby-influx davidby-influx commented Aug 21, 2021

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

@@ -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++ {
Copy link
Contributor

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

Copy link
Contributor Author

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.

}
for i := 0; i < len(q.Statements); i++ {
closing = make(chan struct{})
testFn("executor", i, &executorFailIndex)
Copy link
Contributor

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)

if result.Err == query.ErrNotExecuted {
cnt++
if result.StatementID <= failIndex {
t.Fatalf("StatementID for ErrNotExecuted is wrong index: %d", result.StatementID)
Copy link
Contributor

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.

t.Fatalf("StatementID for ErrNotExecuted is wrong index: %d", result.StatementID)
}
}
r++
Copy link
Contributor

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
@davidby-influx davidby-influx merged commit 0090c5b into master-1.x Aug 24, 2021
@davidby-influx davidby-influx deleted the DSB_off_by_one branch August 24, 2021 18:27
davidby-influx added a commit that referenced this pull request Aug 24, 2021
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

(cherry-picked from commit 0090c5b)

closes #22274
davidby-influx added a commit that referenced this pull request Aug 24, 2021
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

(cherry-picked from commit 0090c5b)

closes #22274
chengshiwen pushed a commit to chengshiwen/influxdb that referenced this pull request Aug 11, 2024
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
chengshiwen pushed a commit to chengshiwen/influxdb that referenced this pull request Aug 27, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Off By One Error in query/exector.go
2 participants