Skip to content

Commit de0160c

Browse files
committed
починить TestReplicatedCopyToDetached (vibe-kanban 4516827b)
Сломался тест, используй `CLICKHOUSE_VERSION=25.12 RUN_TESTS=TestReplicatedCopyToDetached LOG_LEVEL=debug ./test/integration/run.sh` для запуска тестов вот лог последней ошибки \`\`\` 2026-01-21T08:27:49.3798142Z === CONT TestReplicatedCopyToDetached 2026-01-21T08:27:49.3804884Z integration\_test.go:3012: TestReplicatedCopyToDetached run in parallel mode project=project0 2026-01-21T08:27:53.8798644Z integration\_test.go:3056: 2026-01-21T08:27:53.8801256Z Error Trace: /home/runner/work/clickhouse-backup/clickhouse-backup/test/integration/integration\_test.go:3056 2026-01-21T08:27:53.8802030Z Error: Not equal: 2026-01-21T08:27:53.8802452Z expected: 0x0 2026-01-21T08:27:53.8802970Z actual : 0x64 2026-01-21T08:27:53.8803885Z Test: TestReplicatedCopyToDetached 2026-01-21T08:27:53.8804993Z Messages: Table should have no data after restore with --replicated-copy-to-detached \`\`\`
1 parent 7eba9a8 commit de0160c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pkg/backup/restore.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,10 +1999,19 @@ func (b *Backuper) restoreDataRegular(ctx context.Context, backupName string, ba
19991999
}
20002000

20012001
func (b *Backuper) restoreDataRegularByAttach(ctx context.Context, backupName string, backupMetadata metadata.BackupMetadata, table metadata.TableMetadata, diskMap, diskTypes map[string]string, disks []clickhouse.Disk, dstTable clickhouse.Table, skipProjections []string, logger zerolog.Logger, replicatedCopyToDetached bool) error {
2002-
if err := filesystemhelper.HardlinkBackupPartsToStorage(backupName, table, disks, diskMap, dstTable.DataPaths, skipProjections, b.ch, false); err != nil {
2002+
// For Replicated*MergeTree tables with replicatedCopyToDetached, copy parts to detached folder
2003+
copyToDetached := replicatedCopyToDetached && strings.Contains(dstTable.Engine, "Replicated")
2004+
if err := filesystemhelper.HardlinkBackupPartsToStorage(backupName, table, disks, diskMap, dstTable.DataPaths, skipProjections, b.ch, copyToDetached); err != nil {
2005+
if copyToDetached {
2006+
return errors.Wrapf(err, "can't copy data to detached '%s.%s'", table.Database, table.Table)
2007+
}
20032008
return errors.Wrapf(err, "can't copy data to storage '%s.%s'", table.Database, table.Table)
20042009
}
2005-
logger.Debug().Msg("data to 'storage' copied")
2010+
if copyToDetached {
2011+
logger.Debug().Msg("data to 'detached' copied")
2012+
} else {
2013+
logger.Debug().Msg("data to 'storage' copied")
2014+
}
20062015
var size int64
20072016
var err error
20082017
start := time.Now()

0 commit comments

Comments
 (0)