// ProcessBackup used to process the backup logic
ProcessBackup used to process the backup logic
// ProcessBackup used to process the backup logic
func (bm *BackupManager) ProcessBackup() error {
	backup, err := bm.backupLister.Backups(bm.Namespace).Get(bm.BackupName)
	if err != nil {
		klog.Errorf("can't find cluster %s backup %s CRD object, err: %v", bm, bm.BackupName, err)
		return bm.StatusUpdater.Update(backup, &v1alpha1.BackupCondition{
			Type:    v1alpha1.BackupFailed,
			Status:  corev1.ConditionTrue,
			Reason:  "GetBackupCRFailed",
			Message: err.Error(),
		})
	}
	var db *sql.DB
	err = wait.PollImmediate(constants.PollInterval, constants.CheckTimeout, func() (done bool, err error) {
		db, err = util.OpenDB(bm.getDSN(constants.TidbMetaDB))
		if err != nil {
			klog.Warningf("can't open connection to tidb cluster %s, err: %v", bm, err)
			return false, nil
		}
		if err := db.Ping(); err != nil {
			klog.Warningf("can't connect to tidb cluster %s, err: %s", bm, err)
			return false, nil
		}
		return true, nil
	})
	if err != nil {
		klog.Errorf("cluster %s connect failed, err: %s", bm, err)
		return bm.StatusUpdater.Update(backup, &v1alpha1.BackupCondition{
			Type:    v1alpha1.BackupFailed,
			Status:  corev1.ConditionTrue,
			Reason:  "ConnectTidbFailed",
			Message: err.Error(),
		})
	}
	defer db.Close()
	return bm.performBackup(backup.DeepCopy(), db)
}
func ( bm * BackupManager ) ProcessBackup ( ) error { backup , err := bm . backupLister . Backups ( bm . Namespace ) . Get ( bm . BackupName ) if err != nil { klog . Errorf ( " " , bm , bm . BackupName , err ) return bm . StatusUpdater . Update ( backup , & v1alpha1 . BackupCondition { Type : v1alpha1 . BackupFailed , Status : corev1 . ConditionTrue , Reason : " " , Message : err . Error ( ) , } ) } var db * sql . DB err = wait . PollImmediate ( constants . PollInterval , constants . CheckTimeout , func ( ) ( done bool , err error ) { db , err = util . OpenDB ( bm . getDSN ( constants . TidbMetaDB ) ) if err != nil { klog . Warningf ( " " , bm , err ) return false , nil } if err := db . Ping ( ) ; err != nil { klog . Warningf ( " " , bm , err ) return false , nil } return true , nil } ) if err != nil { klog . Errorf ( " " , bm , err ) return bm . StatusUpdater . Update ( backup , & v1alpha1 . BackupCondition { Type : v1alpha1 . BackupFailed , Status : corev1 . ConditionTrue , Reason : " " , Message : err . Error ( ) , } ) } defer db . Close ( ) return bm . performBackup ( backup . DeepCopy ( ) , db ) }
ProcessBackup used to process the backup logic
ProcessBackup used to process the backup logic