From 940b3a9cb3e83eb458586445e0f67adae5cd0778 Mon Sep 17 00:00:00 2001 From: 3pointer Date: Mon, 23 Aug 2021 16:54:37 +0800 Subject: [PATCH 1/3] update size to tidb --- br/pkg/task/backup.go | 2 ++ br/pkg/task/restore.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/br/pkg/task/backup.go b/br/pkg/task/backup.go index 270859f027f4e..deb9f0563ea92 100644 --- a/br/pkg/task/backup.go +++ b/br/pkg/task/backup.go @@ -468,6 +468,8 @@ func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig } g.Record(summary.BackupDataSize, metawriter.ArchiveSize()) + //backup from tidb will fetch a general Size + g.Record("Size", metawriter.ArchiveSize()) failpoint.Inject("s3-outage-during-writing-file", func(v failpoint.Value) { log.Info("failpoint s3-outage-during-writing-file injected, " + "process will sleep for 3s and notify the shell to kill s3 service.") diff --git a/br/pkg/task/restore.go b/br/pkg/task/restore.go index 639ced86b220c..4195a7e700eef 100644 --- a/br/pkg/task/restore.go +++ b/br/pkg/task/restore.go @@ -267,6 +267,7 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf } archiveSize := reader.ArchiveSize(ctx, files) g.Record(summary.RestoreDataSize, archiveSize) + g.Record("Size", archiveSize) restoreTS, err := client.GetTS(ctx) if err != nil { return errors.Trace(err) @@ -277,6 +278,8 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf TTL: utils.DefaultBRGCSafePointTTL, ID: utils.MakeSafePointID(), } + g.Record("BackupTS", restoreTS) + // restore checksum will check safe point with its start ts, see details at // https://github.com/pingcap/tidb/blob/180c02127105bed73712050594da6ead4d70a85f/store/tikv/kv.go#L186-L190 // so, we should keep the safe point unchangeable. to avoid GC life time is shorter than transaction duration. From a2ffe278296b6369816144245dbebdf1d966b093 Mon Sep 17 00:00:00 2001 From: 3pointer Date: Mon, 23 Aug 2021 17:25:05 +0800 Subject: [PATCH 2/3] fix fmt issue --- br/pkg/task/restore.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/br/pkg/task/restore.go b/br/pkg/task/restore.go index 4195a7e700eef..90c004033dc83 100644 --- a/br/pkg/task/restore.go +++ b/br/pkg/task/restore.go @@ -279,7 +279,7 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf ID: utils.MakeSafePointID(), } g.Record("BackupTS", restoreTS) - + // restore checksum will check safe point with its start ts, see details at // https://github.com/pingcap/tidb/blob/180c02127105bed73712050594da6ead4d70a85f/store/tikv/kv.go#L186-L190 // so, we should keep the safe point unchangeable. to avoid GC life time is shorter than transaction duration. From 93d1afa99cbbbb9579b1517da89e5d76cd4e322f Mon Sep 17 00:00:00 2001 From: fengou1 Date: Tue, 24 Aug 2021 16:42:56 +0800 Subject: [PATCH 3/3] update --- br/pkg/task/backup.go | 8 ++++---- br/pkg/task/restore.go | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/br/pkg/task/backup.go b/br/pkg/task/backup.go index deb9f0563ea92..dd32df34d0cd5 100644 --- a/br/pkg/task/backup.go +++ b/br/pkg/task/backup.go @@ -466,10 +466,10 @@ func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig return errors.Trace(err) } } - - g.Record(summary.BackupDataSize, metawriter.ArchiveSize()) - //backup from tidb will fetch a general Size - g.Record("Size", metawriter.ArchiveSize()) + archiveSize := metawriter.ArchiveSize() + g.Record(summary.BackupDataSize, archiveSize) + //backup from tidb will fetch a general Size issue https://github.com/pingcap/tidb/issues/27247 + g.Record("Size", archiveSize) failpoint.Inject("s3-outage-during-writing-file", func(v failpoint.Value) { log.Info("failpoint s3-outage-during-writing-file injected, " + "process will sleep for 3s and notify the shell to kill s3 service.") diff --git a/br/pkg/task/restore.go b/br/pkg/task/restore.go index 90c004033dc83..1c45562071172 100644 --- a/br/pkg/task/restore.go +++ b/br/pkg/task/restore.go @@ -267,6 +267,7 @@ func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConf } archiveSize := reader.ArchiveSize(ctx, files) g.Record(summary.RestoreDataSize, archiveSize) + //restore from tidb will fetch a general Size issue https://github.com/pingcap/tidb/issues/27247 g.Record("Size", archiveSize) restoreTS, err := client.GetTS(ctx) if err != nil {