Skip to content

Commit

Permalink
Merge pull request #53 from kqzh/master
Browse files Browse the repository at this point in the history
  • Loading branch information
kqzh committed Dec 21, 2022
2 parents 7ea9282 + 8885214 commit cef8e0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func newFullBackupCmd() *cobra.Command {
fmt.Println("Start to backup cluster...")
backupName, err := b.Backup()
if err != nil {
fmt.Println("Backup failed, will try to clean the remaining garbage...")
fmt.Printf("Backup failed: %v, will try to clean the remaining garbage...\n", err)

if backupName != "" {
cleanCfg := &config.CleanupConfig{
Expand Down
11 changes: 8 additions & 3 deletions pkg/clients/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,17 @@ func (m *NebulaMeta) RestoreMeta(metaAddr *nebula.HostAddr, hostMap []*meta.Host
req.Hosts = hostMap
req.Files = byteFiles

for try := 1; try <= 3; try++ {
// meta startup time may be very long, so add retry for up to 10 times
for try := 1; try <= 10; try++ {
client, err := connect(metaAddr)
if err != nil {
numsec := 1 << try
if numsec > 32 {
numsec = 32
}
log.WithError(err).WithField("addr", utils.StringifyAddr(metaAddr)).
Errorf("Connect to metad failed, try times %d.", try)
time.Sleep(time.Second * 2)
Errorf("Connect to metad failed, will try after %d seconds, try times %d.", numsec, try)
time.Sleep(time.Second * time.Duration(numsec))
continue
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ func (r *Restore) cleanupOriginalData() error {

// backup_root/backup_name
// - meta
// - xxx.sst
// - ...
// - xxx.sst
// - ...
// - data
// - backup_name.meta
func (r *Restore) Restore() error {
Expand Down Expand Up @@ -579,7 +579,7 @@ func (r *Restore) Restore() error {
if err != nil {
return fmt.Errorf("start meta service failed: %w", err)
}
time.Sleep(time.Second * 3)
time.Sleep(time.Second * 10)
log.Info("Start meta service successfully.")

// restore meta service by map
Expand Down

0 comments on commit cef8e0c

Please sign in to comment.