Commit 53b68a4
committed
MB-70998 Fix issues with auto prepare
Several issues were identified with Auto Prepare functionality
while working on plan stability.
1. With auto-prepared plan, we do not attempt to reprepare if
plan verification fails, instead, we should proceed to normal
processing as if the auto-prepared statement were not there.
However, current code still returns the prepared statement to
the caller and attempt to execute that prepared statement fails
resulting in an error for the statement.
The fix for this part is to detect verification failure and
return a nil for prepared statement.
2. If a statement has references to query parameters, e.g.
named parameter and/or positional parameter, auto prepare
should skip attempting to prepare such a statement. However,
current code would skip auto prepare of a statement if there
are any named/positional parameters defined in the environment,
even if the statement itself does not reference any of the
query parameters.
The fix for this part is to check for actual query parameter
references in the statement, instead of just query parameters
defined in the environment.
3. Auto prepare currently takes DDL statements, which is
unnecessary. We backport the functionality from plan stability
to skip DDL statements for auto prepare.
Change-Id: I443a52c9eab520a45706a77f06cb840d034b2208
Reviewed-on: https://review.couchbase.org/c/query/+/241858
Tested-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com>
Well-Formed: Restriction Checker
Reviewed-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com>1 parent b43c56d commit 53b68a4
5 files changed
Lines changed: 45 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
426 | | - | |
| 426 | + | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
632 | 636 | | |
633 | 637 | | |
634 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1474 | 1474 | | |
1475 | 1475 | | |
1476 | 1476 | | |
1477 | | - | |
| 1477 | + | |
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
| |||
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
1507 | 1515 | | |
1508 | 1516 | | |
1509 | 1517 | | |
| |||
0 commit comments