Commit edd5712
committed
MDEV-37913: disable_index_merge_plans causes SELECT data loss when more than 100 ORs
*DRAFT*
SEL_TREE* tree_or(SEL_TREE *X, SEL_TREE *Y) tries to conserve memory.
In certain cases it reuses the X object for the return value.
MDEV-34620 has added logic to disable construction of index_merge plans
for multi-way ORs. That logic interfered with the logic above and has
caused an error like this:
for parameters of:
X = SEL_TREE{ trees=[key1_treeA, key2_treeB]}
Y = SEL_TREE{ trees=[key1_treeC ] }
we would decide to to reuse object X.
for key1, we would produce key_or(key1_treeA, key1_treeC)
but key2_treeB would be just left there.
As as result, for "X OR Y" we would a SEL_TREE with key2_treeB.
If one tries to construct index merge, that's essentially only reading
rows matching one of OR-parts of Y and missing rows matching X.
Fixed by clearing out trees like key2_treeB.1 parent 21be9fb commit edd5712
File tree
4 files changed
+82
-0
lines changed- mysql-test/main
- sql
4 files changed
+82
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3736 | 3736 | | |
3737 | 3737 | | |
3738 | 3738 | | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
| 3745 | + | |
| 3746 | + | |
| 3747 | + | |
| 3748 | + | |
| 3749 | + | |
| 3750 | + | |
| 3751 | + | |
| 3752 | + | |
| 3753 | + | |
| 3754 | + | |
| 3755 | + | |
| 3756 | + | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
3739 | 3760 | | |
3740 | 3761 | | |
3741 | 3762 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2533 | 2533 | | |
2534 | 2534 | | |
2535 | 2535 | | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
2536 | 2562 | | |
2537 | 2563 | | |
2538 | 2564 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3725 | 3725 | | |
3726 | 3726 | | |
3727 | 3727 | | |
| 3728 | + | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
| 3745 | + | |
| 3746 | + | |
| 3747 | + | |
| 3748 | + | |
3728 | 3749 | | |
3729 | 3750 | | |
3730 | 3751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9979 | 9979 | | |
9980 | 9980 | | |
9981 | 9981 | | |
| 9982 | + | |
| 9983 | + | |
| 9984 | + | |
| 9985 | + | |
| 9986 | + | |
| 9987 | + | |
| 9988 | + | |
| 9989 | + | |
| 9990 | + | |
| 9991 | + | |
| 9992 | + | |
| 9993 | + | |
| 9994 | + | |
| 9995 | + | |
9982 | 9996 | | |
9983 | 9997 | | |
9984 | 9998 | | |
| |||
0 commit comments