Commit 7c9c366
authored
[fix](cloud) Normalize SC rowset graph before delete bitmap capture (#63960)
## Proposed changes
This PR fixes the remaining MOW schema-change delete-bitmap path after
#62256.
#62256, whose master commit is
`dd59f479af5a855401e3f862c751e8416070a1e2`, fixed the final
schema-change commit path by deleting local rowsets in `[2,
alter_version]` before adding the schema-change output rowsets to the
real new tablet. That keeps the committed tablet rowset graph aligned
with the Meta Service result.
However, the delete-bitmap recompute path still builds and uses a
temporary tablet in `CloudSchemaChangeJob::_process_delete_bitmap()`.
That temporary tablet is initialized with the schema-change output
rowsets, but after each `sync_tablet_rowsets(tmp_tablet)` it can again
contain non-schema-change local rowsets in `[2, alter_version]`, such as
double-write rowsets or compaction output rowsets.
If the temporary tablet graph contains both:
- schema-change output rowsets, for example `[2]`, `[3]`, ...
- a wider local/compaction rowset, for example `[2-3]`
then `capture_consistent_rowsets()` can choose the wider
non-schema-change rowset from the temporary graph instead of the
schema-change output rowsets. The delete bitmap is then recomputed
against a rowset path that is not the one finally committed for the
schema-changed tablet. A later MOW compaction may observe delete-bitmap
coverage inconsistent with the visible rowset graph and fail
row-count/delete-bitmap correctness checks.
The fix is to normalize the temporary tablet rowset graph immediately
after every `sync_tablet_rowsets(tmp_tablet)` and before capturing
rowsets for delete-bitmap recomputation.
Concretely this PR:
- extracts `CloudTablet::replace_rowsets_with_schema_change_output()`;
- removes non-schema-change local rowsets in `[2, alter_version]` from
both `_rs_version_map` and the version graph before adding schema-change
output rowsets;
- reuses the helper in the real schema-change commit path;
- calls the same helper after both tmp-tablet syncs in
`_process_delete_bitmap()`;
- keeps cache/delete-bitmap cleanup only for the real tablet, while the
temporary tablet only normalizes its local graph;
- adds a unit test that simulates a polluted tmp graph with `[2]`,
`[3]`, and a stale compaction rowset `[2-3]`.
## Root cause
#62256 fixed the final commit graph but not the earlier delete-bitmap
recompute graph.
The final tablet graph and the temporary delete-bitmap tablet graph must
use the same schema-change output rowset path for historical versions.
Otherwise delete bitmap recomputation may be based on a different rowset
path from the one that becomes visible after schema change.
This is why the issue can surface in a compaction after schema change
has finished: the compaction output itself does not need to contain
duplicate rows. The failure comes from delete bitmap state being
recomputed from a polluted temporary rowset graph and later being
applied to the committed schema-change graph.
## Testing
```
./run-be-ut.sh --run --filter=CloudTabletDeleteRowsetsForSchemaChangeTest.* -j100
```1 parent d073c95 commit 7c9c366
4 files changed
Lines changed: 111 additions & 35 deletions
File tree
- be
- src/cloud
- test/cloud
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
| 553 | + | |
| 554 | + | |
576 | 555 | | |
577 | 556 | | |
578 | 557 | | |
| |||
619 | 598 | | |
620 | 599 | | |
621 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
622 | 606 | | |
623 | 607 | | |
624 | 608 | | |
| |||
628 | 612 | | |
629 | 613 | | |
630 | 614 | | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | 615 | | |
636 | 616 | | |
637 | 617 | | |
| |||
644 | 624 | | |
645 | 625 | | |
646 | 626 | | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
647 | 632 | | |
648 | 633 | | |
649 | 634 | | |
650 | 635 | | |
651 | 636 | | |
652 | 637 | | |
653 | 638 | | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | 639 | | |
659 | 640 | | |
660 | 641 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
96 | 107 | | |
97 | 108 | | |
98 | 109 | | |
| |||
491 | 502 | | |
492 | 503 | | |
493 | 504 | | |
494 | | - | |
| 505 | + | |
| 506 | + | |
495 | 507 | | |
496 | 508 | | |
497 | 509 | | |
| |||
514 | 526 | | |
515 | 527 | | |
516 | 528 | | |
517 | | - | |
518 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
519 | 558 | | |
520 | 559 | | |
521 | 560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
168 | 180 | | |
169 | 181 | | |
170 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1469 | 1469 | | |
1470 | 1470 | | |
1471 | 1471 | | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
1472 | 1516 | | |
1473 | 1517 | | |
1474 | 1518 | | |
| |||
0 commit comments