Skip to content

Commit

Permalink
cherry pick pingcap#2926 to release-1.1
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
lichunzhu authored and ti-srebot committed Jul 17, 2020
1 parent 73744b6 commit 5d948aa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmd/backup-manager/app/backup/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ func (bm *Manager) performBackup(backup *v1alpha1.Backup, db *sql.DB) error {
if oldTikvGCTimeDuration < tikvGCTimeDuration {
err = bm.SetTikvGCLifeTime(db, oldTikvGCTime)
if err != nil {
if backupErr != nil {
errs = append(errs, backupErr)
}
errs = append(errs, err)
klog.Errorf("cluster %s reset tikv GC life time to %s failed, err: %s", bm, oldTikvGCTime, err)
uerr := bm.StatusUpdater.Update(backup, &v1alpha1.BackupCondition{
Expand Down
5 changes: 4 additions & 1 deletion cmd/backup-manager/app/export/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (bm *BackupManager) performBackup(backup *v1alpha1.Backup, db *sql.DB) erro
}

if oldTikvGCTimeDuration < tikvGCTimeDuration {
err = bm.SetTikvGCLifeTime(db, constants.TikvGCLifeTime)
err = bm.SetTikvGCLifeTime(db, tikvGCLifeTime)
if err != nil {
errs = append(errs, err)
klog.Errorf("cluster %s set tikv GC life time to %s failed, err: %s", bm, constants.TikvGCLifeTime, err)
Expand All @@ -239,6 +239,9 @@ func (bm *BackupManager) performBackup(backup *v1alpha1.Backup, db *sql.DB) erro
if oldTikvGCTimeDuration < tikvGCTimeDuration {
err = bm.SetTikvGCLifeTime(db, oldTikvGCTime)
if err != nil {
if backupErr != nil {
errs = append(errs, backupErr)
}
errs = append(errs, err)
klog.Errorf("cluster %s reset tikv GC life time to %s failed, err: %s", bm, oldTikvGCTime, err)
uerr := bm.StatusUpdater.Update(backup, &v1alpha1.BackupCondition{
Expand Down
3 changes: 3 additions & 0 deletions cmd/backup-manager/app/restore/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ func (rm *Manager) performRestore(restore *v1alpha1.Restore, db *sql.DB) error {
if oldTikvGCTimeDuration < tikvGCTimeDuration {
err = rm.SetTikvGCLifeTime(db, oldTikvGCTime)
if err != nil {
if restoreErr != nil {
errs = append(errs, restoreErr)
}
errs = append(errs, err)
klog.Errorf("cluster %s reset tikv GC life time to %s failed, err: %s", rm, oldTikvGCTime, err)
uerr := rm.StatusUpdater.Update(restore, &v1alpha1.RestoreCondition{
Expand Down
4 changes: 4 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11748,6 +11748,10 @@ spec:
format: date-time
name: Completed
type: string
- JSONPath: .status.commitTs
description: The commit ts of tidb cluster restore
name: CommitTS
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
Expand Down
8 changes: 7 additions & 1 deletion pkg/util/crdutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ var (
Description: "The time at which the restore was completed",
JSONPath: ".status.timeCompleted",
}
restoreCommitTSColumn = extensionsobj.CustomResourceColumnDefinition{
Name: "CommitTS",
Type: "string",
Description: "The commit ts of tidb cluster restore",
JSONPath: ".status.commitTs",
}
bksAdditionalPrinterColumns []extensionsobj.CustomResourceColumnDefinition
bksScheduleColumn = extensionsobj.CustomResourceColumnDefinition{
Name: "Schedule",
Expand Down Expand Up @@ -227,7 +233,7 @@ func init() {
tidbClusterTiKVColumn, tidbClusterTiKVStorageColumn, tidbClusterTiKVReadyColumn, tidbClusterTiKVDesireColumn,
tidbClusterTiDBColumn, tidbClusterTiDBReadyColumn, tidbClusterTiDBDesireColumn, tidbClusterStatusMessageColumn, ageColumn)
backupAdditionalPrinterColumns = append(backupAdditionalPrinterColumns, backupPathColumn, backupBackupSizeColumn, backupCommitTSColumn, backupStartedColumn, backupCompletedColumn, ageColumn)
restoreAdditionalPrinterColumns = append(restoreAdditionalPrinterColumns, restoreStartedColumn, restoreCompletedColumn, ageColumn)
restoreAdditionalPrinterColumns = append(restoreAdditionalPrinterColumns, restoreStartedColumn, restoreCompletedColumn, restoreCommitTSColumn, ageColumn)
bksAdditionalPrinterColumns = append(bksAdditionalPrinterColumns, bksScheduleColumn, bksMaxBackups, bksLastBackup, bksLastBackupTime, ageColumn)
tidbInitializerPrinterColumns = append(tidbInitializerPrinterColumns, tidbInitializerPhase, ageColumn)
autoScalerPrinterColumns = append(autoScalerPrinterColumns, autoScalerTiDBMaxReplicasColumn, autoScalerTiDBMinReplicasColumn,
Expand Down

0 comments on commit 5d948aa

Please sign in to comment.