Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reconcile bug #131

Merged
merged 1 commit into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions pkg/controller/component/storaged_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ func (ss *storageScaler) balanceSpace(mc nebula.MetaInterface, nc *v1alpha1.Nebu
}
jobID, err := mc.BalanceData(spaceID)
if err != nil {
if jobID > 0 {
nc.Status.Storaged.LastBalanceJob = &v1alpha1.BalanceJob{
SpaceID: spaceID,
JobID: jobID,
}
}
return err
}
nc.Status.Storaged.LastBalanceJob = &v1alpha1.BalanceJob{
SpaceID: spaceID,
JobID: jobID,
}
return nil
}

Expand All @@ -229,12 +231,14 @@ func (ss *storageScaler) removeHost(
}
jobID, err := mc.RemoveHost(spaceID, hosts)
if err != nil {
if jobID > 0 {
nc.Status.Storaged.LastBalanceJob = &v1alpha1.BalanceJob{
SpaceID: spaceID,
JobID: jobID,
}
}
return err
}
nc.Status.Storaged.LastBalanceJob = &v1alpha1.BalanceJob{
SpaceID: spaceID,
JobID: jobID,
}
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/nebula/meta_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ func (m *metaClient) balance(req *meta.AdminJobReq) (int32, error) {
return 0, errors.Errorf("retry balance code %d", resp.Code)
}
log.Info("balance job running now")
return resp.GetResult_().GetJobID(), nil
return resp.GetResult_().GetJobID(), utilerrors.ReconcileErrorf("waiting for balance job %d finished", resp.GetResult_().GetJobID())
}
return resp.GetResult_().GetJobID(), errors.Errorf("balance code %d", resp.Code)
return 0, errors.Errorf("balance code %d", resp.Code)
}
log.Info("balance job running now")
return resp.GetResult_().GetJobID(), nil
return resp.GetResult_().GetJobID(), utilerrors.ReconcileErrorf("waiting for balance job %d finished", resp.GetResult_().GetJobID())
}

func (m *metaClient) BalanceData(spaceID nebula.GraphSpaceID) (int32, error) {
Expand Down