Commit 252b8a1
committed
Fix schema version mismatch for index restore with AlterTableIndex
Problem:
- After restoring index impl tables, schema version mismatch occurred
- Index metadata expected version X but impl table had version X+1
- Tests failed with: "schema version mismatch during metadata loading"
Root Cause:
- Index impl table restore incremented the impl table's schema version
- Parent index metadata AlterVersion was not updated
- This caused a mismatch when querying the restored table
Solution:
- Added AlterTableIndex operation after each index impl table restore
- Mirrors CDC stream pattern for avoiding additional alterVersion
- AlterTableIndex operation syncs index metadata with impl table version
- Sets index state to Ready, which increments the index AlterVersion
The fix creates two operations per index restore:
1. Restore impl table (increments impl table schema version)
2. AlterTableIndex at parent table (syncs index metadata AlterVersion)
Reference pattern from schemeshard__operation_create_cdc_stream.cpp:
When working on index impl tables, create AlterTableIndex operation
to avoid schema version mismatch between index and impl table.1 parent 0197f82 commit 252b8a1
File tree
1 file changed
+33
-0
lines changed- ydb/core/tx/schemeshard
1 file changed
+33
-0
lines changedLines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
857 | 857 | | |
858 | 858 | | |
859 | 859 | | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
860 | 893 | | |
861 | 894 | | |
862 | 895 | | |
| |||
0 commit comments