Skip to content

Commit e81ee31

Browse files
committed
fix #1093, add ClicHouse 25.2 to CI/CD
Signed-off-by: Slach <[email protected]>
1 parent 957c595 commit e81ee31

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ jobs:
106106
- '23.8'
107107
- '24.3'
108108
- '24.8'
109+
- '25.2'
109110
steps:
110111
- name: Checkout project
111112
uses: actions/checkout@v4
@@ -215,6 +216,7 @@ jobs:
215216
- '23.8'
216217
- '24.3'
217218
- '24.8'
219+
- '25.2'
218220
steps:
219221
- name: Checkout project
220222
uses: actions/checkout@v4

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v2.6.7
2+
- improve workaround for `metdata_path` field change behavior in 25.1+, look details in https://github.com/ClickHouse/ClickHouse/issues/76546, fix [1093](https://github.com/Altinity/clickhouse-backup/issues/1093)
3+
14
# v2.6.6
25

36
IMPROVEMENTS

pkg/backup/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ func (b *Backuper) restoreDataRegularByParts(ctx context.Context, backupName str
14681468
log.Info().Str("duration", utils.HumanizeDuration(time.Since(start))).Str("size", utils.FormatBytes(uint64(size))).Msg("download object_disks finish")
14691469
// Skip ATTACH PART for Replicated*MergeTree tables if replicatedCopyToDetached is true
14701470
if !replicatedCopyToDetached || !strings.Contains(dstTable.Engine, "Replicated") {
1471-
if err := b.ch.AttachDataParts(table, dstTable, disks); err != nil {
1471+
if err := b.ch.AttachDataParts(table, dstTable); err != nil {
14721472
return fmt.Errorf("can't attach data parts for table '%s.%s': %v", table.Database, table.Table, err)
14731473
}
14741474
} else {

pkg/clickhouse/clickhouse.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ func (ch *ClickHouse) getMetadataPath(ctx context.Context) (string, error) {
259259
return "", fmt.Errorf("can't get metadata_path from system.tables or system.databases")
260260
}
261261
metadataPath := strings.Split(result[0].MetadataPath, "/")
262-
if strings.Contains(result[0].MetadataPath, "/store/") {
262+
// https://github.com/ClickHouse/ClickHouse/issues/76546
263+
if ch.version >= 25000000 && strings.HasSuffix(result[0].MetadataPath, "/store/") {
264+
result[0].MetadataPath = path.Join(metadataPath[:len(metadataPath)-2]...)
265+
result[0].MetadataPath = path.Join(result[0].MetadataPath, "metadata")
266+
} else if strings.Contains(result[0].MetadataPath, "/store/") {
263267
result[0].MetadataPath = path.Join(metadataPath[:len(metadataPath)-4]...)
264268
result[0].MetadataPath = path.Join(result[0].MetadataPath, "metadata")
265269
} else {
@@ -763,7 +767,7 @@ func (ch *ClickHouse) FreezeTable(ctx context.Context, table *Table, name string
763767
}
764768

765769
// AttachDataParts - execute ALTER TABLE ... ATTACH PART command for specific table
766-
func (ch *ClickHouse) AttachDataParts(table metadata.TableMetadata, dstTable Table, disks []Disk) error {
770+
func (ch *ClickHouse) AttachDataParts(table metadata.TableMetadata, dstTable Table) error {
767771
if dstTable.Database != "" && dstTable.Database != table.Database {
768772
table.Database = dstTable.Database
769773
}

0 commit comments

Comments
 (0)