Commit 9c10e82
Do not lazy-load TimeSeries tables so the cross-database move guard sees them
With lazy_load_tables=1 a TimeSeries table is reloaded as a StorageTableProxy.
DatabaseAtomic::renameTable guards a cross-database move with
dynamic_cast<StorageTimeSeries *>, which fails on the proxy, so a cross-database
RENAME TABLE of a lazy TimeSeries with inner tables was accepted: only the outer
table moved and the inner tables were orphaned in the source database.
MaterializedView avoids this entire class because shouldLazyLoad already excludes
it, so an MV is never a proxy and the sibling guard branch is safe. TimeSeries
owns inner tables and overrides renameInMemory the same way, so exclude it from
lazy load too. Plain tables keep lazy-loading; only the TimeSeries outer table is
loaded eagerly, which the guard can then see.
Extends the 04340 regression with a lazy_load_tables=1 cross-database move case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 04e8cb0 commit 9c10e82
3 files changed
Lines changed: 30 additions & 0 deletions
File tree
- src/Databases
- tests/queries/0_stateless
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
430 | 435 | | |
431 | 436 | | |
432 | 437 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
0 commit comments