Skip to content

Commit aa33df3

Browse files
committed
add more debug logs
Signed-off-by: Slach <[email protected]>
1 parent a2c406f commit aa33df3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pkg/backup/create.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@ func (b *Backuper) AddTableToLocalBackup(ctx context.Context, backupName string,
939939
diffTableMetadata = tablesDiffFromRemote[metadata.TableTitle{Database: table.Database, Table: table.Name}]
940940
}
941941
// If partitionsIdsMap is not empty, only parts in this partition will back up.
942+
start := time.Now()
942943
parts, size, newChecksums, err := filesystemhelper.MoveShadowToBackup(shadowPath, backupShadowPath, partitionsIdsMap, table, diffTableMetadata, disk, skipProjections, version)
943944
if err != nil {
944945
return nil, nil, nil, nil, err
@@ -950,9 +951,9 @@ func (b *Backuper) AddTableToLocalBackup(ctx context.Context, backupName string,
950951
checksums[pName] = c
951952
}
952953

953-
logger.Debug().Str("disk", disk.Name).Msg("shadow moved")
954+
logger.Debug().Str("disk", disk.Name).Str("duration", utils.HumanizeDuration(time.Since(start))).Msg("shadow moved")
954955
if len(parts) > 0 && (b.isDiskTypeObject(disk.Type) || b.isDiskTypeEncryptedObject(disk, diskList)) {
955-
start := time.Now()
956+
start = time.Now()
956957
if size, err = b.uploadObjectDiskParts(ctx, backupName, diffTableMetadata, backupShadowPath, disk); err != nil {
957958
return nil, nil, nil, nil, err
958959
}

pkg/common/common.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package common
22

33
import (
4-
"github.com/rs/zerolog/log"
54
"hash/crc64"
65
"io"
76
"math/rand"
@@ -11,6 +10,9 @@ import (
1110
"reflect"
1211
"strings"
1312
"time"
13+
14+
"github.com/Altinity/clickhouse-backup/v2/pkg/utils"
15+
"github.com/rs/zerolog/log"
1416
)
1517

1618
func TablePathEncode(str string) string {
@@ -127,6 +129,7 @@ func AddRandomJitter(duration time.Duration, jitterPercent int8) time.Duration {
127129

128130
// CalculateChecksum calculates checksum for a file on a given disk
129131
func CalculateChecksum(diskPath string, relativePath string) (uint64, error) {
132+
start := time.Now()
130133
fullPath := path.Join(diskPath, relativePath)
131134
file, err := os.Open(fullPath)
132135
if err != nil {
@@ -143,6 +146,6 @@ func CalculateChecksum(diskPath string, relativePath string) (uint64, error) {
143146
if _, err := io.Copy(hash, file); err != nil {
144147
return 0, err
145148
}
146-
149+
log.Debug().Str("duration", utils.HumanizeDuration(time.Since(start))).Str("fullPath", fullPath).Msg("checksum calculated")
147150
return hash.Sum64(), nil
148151
}

0 commit comments

Comments
 (0)