Skip to content

Commit d9a3fc0

Browse files
committed
final changes for 25.10+ object_disk.VersionFullObjectKey=5, fix #1290, add syncWriter to log_helper.go
Signed-off-by: Slach <[email protected]>
1 parent 9a36510 commit d9a3fc0

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

pkg/backup/create.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,11 +1044,6 @@ func (b *Backuper) uploadObjectDiskParts(ctx context.Context, backupName string,
10441044
}
10451045
var copyObjectErr error
10461046

1047-
// 25.10+ contains full path need make it relative, https://github.com/Altinity/clickhouse-backup/issues/1290
1048-
if storageObject.IsAbsolute && srcDiskConnection.GetRemotePath() != "" && srcDiskConnection.GetRemotePath() != "/" && strings.Contains(storageObject.ObjectPath, srcDiskConnection.GetRemotePath()) {
1049-
storageObject.ObjectPath = strings.TrimPrefix(storageObject.ObjectPath, srcDiskConnection.GetRemotePath())
1050-
}
1051-
10521047
srcKey := path.Join(srcDiskConnection.GetRemotePath(), storageObject.ObjectPath)
10531048

10541049
if b.resume {

pkg/backup/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ func (b *Backuper) downloadObjectDiskParts(ctx context.Context, backupName strin
21232123
if objectDiskPathErr != nil {
21242124
return objectDiskPathErr
21252125
}
2126-
// 25.10+ contains full path, need make it relative again, for properly copy, https://github.com/Altinity/clickhouse-backup/issues/1290
2126+
// 25.10+ contains full path, need make it relative again after rewrite, for properly copy, https://github.com/Altinity/clickhouse-backup/issues/1290
21272127
if storageObject.IsAbsolute {
21282128
objPathParts := strings.Split(storageObject.ObjectPath, "/")
21292129
if len(objPathParts) >= 2 {

pkg/log_helper/log_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,5 @@ func SetupLogger(out io.Writer) zerolog.Logger {
176176
}
177177
// Use custom writer
178178
writer := NewCustomWriter(out)
179-
return zerolog.New(writer).With().Timestamp().Caller().Logger()
179+
return zerolog.New(zerolog.SyncWriter(writer)).With().Timestamp().Caller().Logger()
180180
}

pkg/storage/object_disk/object_disk.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ func (m *Metadata) readFromFile(file io.Reader) error {
130130

131131
scanner.Scan()
132132
storageObject.ObjectPath = scanner.Text()
133+
// 25.10+ contains full path, need make it relative again, for properly backup/restore/delete, https://github.com/Altinity/clickhouse-backup/issues/1290
134+
if storageObject.IsAbsolute {
135+
objPathParts := strings.Split(storageObject.ObjectPath, "/")
136+
if len(objPathParts) >= 2 {
137+
storageObject.ObjectPath = strings.Join(objPathParts[len(objPathParts)-2:], "/")
138+
}
139+
}
140+
133141
m.StorageObjects = append(m.StorageObjects, storageObject)
134142
}
135143

0 commit comments

Comments
 (0)