Compare commits

...

3 commits

Author SHA1 Message Date
90a90c2820 [#684] node: Add skipped objects count to evacuation result
All checks were successful
Build / Build Components (1.21) (pull_request) Successful in 2m47s
Build / Build Components (1.20) (pull_request) Successful in 3m15s
DCO action / DCO (pull_request) Successful in 4m26s
Vulncheck / Vulncheck (pull_request) Successful in 5m1s
Tests and linters / Lint (pull_request) Successful in 5m20s
Tests and linters / Staticcheck (pull_request) Successful in 5m53s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m11s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m44s
Tests and linters / Tests with -race (pull_request) Successful in 8m23s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-11-03 10:56:07 +03:00
9b51843aa5 [#684] cli: Add skipped count to evacuation status output
All checks were successful
DCO action / DCO (pull_request) Successful in 1m10s
Vulncheck / Vulncheck (pull_request) Successful in 3m3s
Build / Build Components (1.21) (pull_request) Successful in 3m41s
Build / Build Components (1.20) (pull_request) Successful in 4m17s
Tests and linters / Staticcheck (pull_request) Successful in 4m38s
Tests and linters / Lint (pull_request) Successful in 5m16s
Tests and linters / Tests (1.20) (pull_request) Successful in 6m25s
Tests and linters / Tests (1.21) (pull_request) Successful in 6m32s
Tests and linters / Tests with -race (pull_request) Successful in 7m13s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-11-02 18:13:01 +03:00
01d9ed66e1 [#684] proto: Add skipped count to evacuation status response
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-11-02 17:57:12 +03:00
9 changed files with 34 additions and 6 deletions

View file

@ -220,12 +220,12 @@ func appendEstimation(sb *strings.Builder, resp *control.GetShardEvacuationStatu
if resp.GetBody().GetStatus() != control.GetShardEvacuationStatusResponse_Body_RUNNING ||
resp.GetBody().GetDuration() == nil ||
resp.GetBody().GetTotal() == 0 ||
resp.GetBody().GetEvacuated()+resp.GetBody().GetFailed() == 0 {
resp.GetBody().GetEvacuated()+resp.GetBody().GetFailed()+resp.Body.GetSkipped() == 0 {
return
}
durationSeconds := float64(resp.GetBody().GetDuration().GetSeconds())
evacuated := float64(resp.GetBody().GetEvacuated() + resp.GetBody().GetFailed())
evacuated := float64(resp.GetBody().GetEvacuated() + resp.GetBody().GetFailed() + resp.GetBody().GetSkipped())
avgObjEvacuationTimeSeconds := durationSeconds / evacuated
objectsLeft := float64(resp.GetBody().GetTotal()) - evacuated
leftSeconds := avgObjEvacuationTimeSeconds * objectsLeft
@ -285,10 +285,11 @@ func appendShardIDs(sb *strings.Builder, resp *control.GetShardEvacuationStatusR
}
func appendCounts(sb *strings.Builder, resp *control.GetShardEvacuationStatusResponse) {
sb.WriteString(fmt.Sprintf(" Evacuated %d object out of %d, failed to evacuate %d objects.",
sb.WriteString(fmt.Sprintf(" Evacuated %d objects out of %d, failed to evacuate: %d, skipped: %d.",
resp.GetBody().GetEvacuated(),
resp.Body.GetTotal(),
resp.Body.GetFailed()))
resp.GetBody().GetTotal(),
resp.GetBody().GetFailed(),
resp.GetBody().GetSkipped()))
}
func initControlEvacuationShardCmd() {

View file

@ -41,6 +41,7 @@ type EvacuateShardRes struct {
evacuated *atomic.Uint64
total *atomic.Uint64
failed *atomic.Uint64
skipped *atomic.Uint64
}
// NewEvacuateShardRes creates new EvacuateShardRes instance.
@ -49,6 +50,7 @@ func NewEvacuateShardRes() *EvacuateShardRes {
evacuated: new(atomic.Uint64),
total: new(atomic.Uint64),
failed: new(atomic.Uint64),
skipped: new(atomic.Uint64),
}
}
@ -97,6 +99,14 @@ func (p *EvacuateShardRes) Failed() uint64 {
return p.failed.Load()
}
// Skipped returns count of skipped objects.
func (p *EvacuateShardRes) Skipped() uint64 {
if p == nil {
return 0
}
return p.skipped.Load()
}
// DeepCopy returns deep copy of result instance.
func (p *EvacuateShardRes) DeepCopy() *EvacuateShardRes {
if p == nil {
@ -107,11 +117,13 @@ func (p *EvacuateShardRes) DeepCopy() *EvacuateShardRes {
evacuated: new(atomic.Uint64),
total: new(atomic.Uint64),
failed: new(atomic.Uint64),
skipped: new(atomic.Uint64),
}
res.evacuated.Store(p.evacuated.Load())
res.total.Store(p.total.Load())
res.failed.Store(p.failed.Load())
res.skipped.Store(p.skipped.Load())
return res
}
@ -224,6 +236,7 @@ func (e *StorageEngine) evacuateShards(ctx context.Context, shardIDs []string, p
zap.Uint64("total", res.Total()),
zap.Uint64("evacuated", res.Evacuated()),
zap.Uint64("failed", res.Failed()),
zap.Uint64("skipped", res.Skipped()),
)
return nil
}
@ -404,6 +417,9 @@ func (e *StorageEngine) tryEvacuateObjectLocal(ctx context.Context, addr oid.Add
evacuationOperationLogField,
zap.String("trace_id", tracingPkg.GetTraceID(ctx)))
}
if exists {
res.skipped.Add(1)
}
return true, nil
}
}

View file

@ -55,6 +55,13 @@ func (s *EvacuationState) Failed() uint64 {
return s.result.Failed()
}
func (s *EvacuationState) Skipped() uint64 {
if s == nil {
return 0
}
return s.result.Skipped()
}
func (s *EvacuationState) ProcessingStatus() EvacuateProcessState {
if s == nil {
return EvacuateProcessStateUndefined

View file

@ -55,6 +55,7 @@ func stateToResponse(state *engine.EvacuationState) (*control.GetShardEvacuation
StartedAt: startedAt,
Duration: duration,
ErrorMessage: state.ErrorMessage(),
Skipped: state.Skipped(),
},
}, nil
}

Binary file not shown.

View file

@ -362,7 +362,7 @@ message GetShardEvacuationStatusResponse {
int64 seconds = 1;
}
// Total objects to evacuate count. The value is approximate, so evacuated + failed == total is not guaranteed after completion.
// Total objects to evacuate count. The value is approximate, so evacuated + failed + skipped == total is not guaranteed after completion.
uint64 total = 1;
// Evacuated objects count.
uint64 evacuated = 2;
@ -379,6 +379,9 @@ message GetShardEvacuationStatusResponse {
UnixTimestamp started_at = 7;
// Error message if evacuation failed.
string error_message = 8;
// Skipped objects count.
uint64 skipped = 9;
}
Body body = 1;

Binary file not shown.

Binary file not shown.

Binary file not shown.