Skip to content

Commit a2c406f

Browse files
committed
fix slowdown and corner cases, for incremental backup creation, affected 2.6.30+, fix #1249
Signed-off-by: Slach <[email protected]>
1 parent aae0c39 commit a2c406f

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v2.6.37
2+
BUG FIXES
3+
- fix slowdown and corner cases, for incremental backup creation, affected 2.6.30+, fix https://github.com/Altinity/clickhouse-backup/issues/1249
4+
15
# v2.6.36
26
IMPROVEMENTS
37
- add `GCS_SA_EMAIL` option to support service account authorization, fix [1246](https://github.com/Altinity/clickhouse-backup/pull/1246) thanks @kamushadenes

pkg/filesystemhelper/filesystemhelper.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -392,24 +392,27 @@ func IsSkipProjections(skipProjections []string, relativePath string) bool {
392392
func addRequiredPartIfNotExists(parts []metadata.Part, relativePath string, tableDiffFromRemote metadata.TableMetadata, disk clickhouse.Disk) ([]metadata.Part, bool, bool) {
393393
isRequiredPartFound := false
394394
exists := false
395-
for _, p := range parts {
396-
if p.Name == relativePath || strings.HasPrefix(relativePath, p.Name+"/") {
397-
exists = true
395+
for _, diffPart := range tableDiffFromRemote.Parts[disk.Name] {
396+
if diffPart.Name == relativePath || strings.HasPrefix(relativePath, diffPart.Name+"/") {
397+
isRequiredPartFound = true
398398
break
399399
}
400-
for _, diffPart := range tableDiffFromRemote.Parts[disk.Name] {
401-
if diffPart.Name == relativePath || strings.HasPrefix(relativePath, diffPart.Name+"/") {
402-
isRequiredPartFound = true
400+
}
401+
if isRequiredPartFound {
402+
for _, p := range parts {
403+
if p.Name == relativePath || strings.HasPrefix(relativePath, p.Name+"/") {
404+
exists = true
405+
break
403406
}
404407
}
408+
if !exists {
409+
parts = append(parts, metadata.Part{
410+
Name: relativePath,
411+
Required: true,
412+
})
413+
}
405414
}
406-
// we use relativePath here cause during Walk, directory will walked first
407-
if !exists && isRequiredPartFound {
408-
parts = append(parts, metadata.Part{
409-
Name: relativePath,
410-
Required: true,
411-
})
412-
}
415+
413416
return parts, isRequiredPartFound, exists
414417
}
415418

0 commit comments

Comments
 (0)