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

Off By One Error in query/exector.go #19136

Closed
ayang64 opened this issue Jul 29, 2020 · 0 comments · Fixed by #22273
Closed

Off By One Error in query/exector.go #19136

ayang64 opened this issue Jul 29, 2020 · 0 comments · Fixed by #22273
Assignees
Labels

Comments

@ayang64
Copy link
Contributor

ayang64 commented Jul 29, 2020

executeQuery() iterates over statements until each is processed or if an error is encountered that causes the loop to exit pre-maturely.

In that case (early exit) there is a loop that is meant send an appropriate response for any remaining statements (ErrNotExecuted).

// Send error results for any statements which were not executed.
for ; i < len(query.Statements)-1; i++ {
 if err := ctx.send(&Result{
  StatementID: i,
  Err:         ErrNotExecuted,
 }); err == ErrQueryAborted {
  return
 }
}

It looks like removing the -1 from the condition part of the for loop would work but i is sometimes set to the index of the previously successfully executed statement.

I've tried a few ways of fixing this but I think this requires a little more thought to fix properly.

The impact of this bug is that remaining statements aren't properly handled.

@ayang64 ayang64 self-assigned this Jul 29, 2020
@ayang64 ayang64 added the 1.x label Jul 29, 2020
@ayang64 ayang64 added this to the 1.8.1 milestone Jul 29, 2020
@ayang64 ayang64 closed this as completed Aug 26, 2020
@ayang64 ayang64 reopened this Aug 26, 2020
@ayang64 ayang64 modified the milestones: 1.8.1, 1.9 Sep 10, 2020
@psteinbachs psteinbachs removed this from the 1.9 milestone Jul 6, 2021
@psteinbachs psteinbachs assigned davidby-influx and unassigned ayang64 Jul 6, 2021
davidby-influx added a commit that referenced this issue 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
@davidby-influx davidby-influx linked a pull request Aug 21, 2021 that will close this issue
4 tasks
davidby-influx added a commit that referenced this issue 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
davidby-influx added a commit that referenced this issue 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
davidby-influx added a commit that referenced this issue 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 issue 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 issue 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-cluster that referenced this issue Aug 25, 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/influxdb#19136
chengshiwen pushed a commit to chengshiwen/influxdb that referenced this issue 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
chengshiwen pushed a commit to chengshiwen/influxdb-cluster that referenced this issue Aug 28, 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/influxdb#19136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants