Commit 0197f82
committed
Fix index discovery for nested tables and tighten path matching
Addresses two critical PR review comments:
1. Fix nested table path discovery (CRITICAL BUG):
- Previous: Only looked 1 level deep in __ydb_backup_meta/indexes/
- Impact: Tables in subdirectories (e.g. /Root/Dir/Foo) had indexes silently skipped
- Fix: Implemented recursive DiscoverIndexesRecursive() that:
* Traverses the full directory tree under indexes/
* Accumulates relative path as it descends (Root -> Root/Dir -> Root/Dir/Foo)
* Matches against target tables at each level
* Creates index operations when match found
Example:
Backup structure: __ydb_backup_meta/indexes/Root/Dir/Foo/index1
Old behavior: Only saw "Root", failed to match, skipped all indexes
New behavior: Descends to "Root/Dir/Foo", matches table, restores indexes
2. Fix path matching to prevent false positives:
- Previous: itemPath.EndsWith(relativeTablePath)
- Problem: /Root/FooBar matched "Bar", /Root/users_table matched "table"
- Fix: Only accept exact match OR suffix preceded by "/"
* itemPath == relativeTablePath
* itemPath.EndsWith("/" + relativeTablePath)
Changes:
- Added DiscoverIndexesRecursive() helper for recursive directory traversal
- Updated FindTargetTablePath() to use exact matching logic
- Updated DiscoverAndCreateIndexRestoreOperations() to call recursive helper
Files modified:
- schemeshard_impl.h: Added DiscoverIndexesRecursive() declaration
- schemeshard_incremental_restore_scan.cpp: Implemented recursive discovery
Both issues validated and confirmed as correct feedback.1 parent d32e711 commit 0197f82
File tree
2 files changed
+70
-29
lines changed- ydb/core/tx/schemeshard
2 files changed
+70
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1205 | 1214 | | |
1206 | 1215 | | |
1207 | 1216 | | |
| |||
Lines changed: 61 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | | - | |
626 | | - | |
627 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
635 | 683 | | |
636 | 684 | | |
637 | 685 | | |
| |||
663 | 711 | | |
664 | 712 | | |
665 | 713 | | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
692 | 724 | | |
693 | 725 | | |
694 | 726 | | |
| |||
0 commit comments