Commit b07e9c2
Merge #148549
148549: sql: fix COPY with some concurrent schema changes r=yuzefovich a=yuzefovich
Previously, if we had COPY running concurrently with some schema changes
that require usage of Puts (via ForcePut on the index), like ALTER
PRIMARY KEY, we could hit an internal error because the vectorized
encoder didn't support it. This commit adds the support for it, but it
also actually disables using the vectorized encoder for COPY when
ForcePut option is observed on at least one writable index. This is the
case since I observed many different corruption-like failures when
stressing the extended test, which aren't present if we use the
row-by-row insert.
Existing `TestLargeCopy` has been extended so that sometimes it also
performs ALTER PRIMARY KEY concurrently with the COPY as well as
randomized `copy_from_atomic_enabled` value. Note that in some cases
we're hitting "duplicate key" violation while there is a schema change,
and it seems somewhat expected to me, so I didn't look deeper and simply
made the test ignore such errors.
Fixes: #147955.
Release note (bug fix): CockroachDB could previously encounter "vector
encoder doesn't support ForcePut yet" error when performing COPY command
concurrently with some schema changes. The bug has been present since
before 23.2 and is now fixed.
Co-authored-by: Yahor Yuzefovich <[email protected]>File tree
4 files changed
+71
-18
lines changed- pkg/sql
- colenc
- copy
4 files changed
+71
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 128 | | |
134 | 129 | | |
135 | 130 | | |
| |||
484 | 479 | | |
485 | 480 | | |
486 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
487 | 489 | | |
488 | 490 | | |
489 | 491 | | |
| |||
510 | 512 | | |
511 | 513 | | |
512 | 514 | | |
513 | | - | |
| 515 | + | |
514 | 516 | | |
515 | 517 | | |
516 | 518 | | |
| |||
576 | 578 | | |
577 | 579 | | |
578 | 580 | | |
579 | | - | |
| 581 | + | |
580 | 582 | | |
581 | 583 | | |
582 | 584 | | |
583 | 585 | | |
584 | 586 | | |
585 | | - | |
| 587 | + | |
586 | 588 | | |
587 | 589 | | |
588 | 590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
707 | 708 | | |
708 | | - | |
| 709 | + | |
709 | 710 | | |
710 | 711 | | |
711 | 712 | | |
| |||
719 | 720 | | |
720 | 721 | | |
721 | 722 | | |
| 723 | + | |
| 724 | + | |
722 | 725 | | |
723 | | - | |
724 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
725 | 730 | | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
732 | 770 | | |
733 | 771 | | |
734 | 772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
431 | 444 | | |
432 | 445 | | |
433 | 446 | | |
| |||
0 commit comments