Skip to content

Commit

Permalink
cli: adjust error of upload-bin command
Browse files Browse the repository at this point in the history
Miscalculation leads to negative values in errors:
```
2024-10-17 11:26:56.790	failed to fetch the latest missing block index
 from container: search of index files failed for batch with indexes
 from -260000 to -250000: error during object IDs iteration: context
 deadline exceeded
```

Close #3621

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Oct 18, 2024
1 parent 0da1cc9 commit f6de1bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cli/util/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func retry(action func() error) error {

type searchResult struct {
startIndex int
endIndex int
numOIDs int
err error
}
Expand Down Expand Up @@ -258,14 +259,14 @@ func fetchLatestMissingBlockIndex(ctx context.Context, p *pool.Pool, containerID
objectIDs, err = neofs.ObjectSearch(ctx, p, priv, containerID.String(), prm)
return err
})
results[i] = searchResult{startIndex: startIndex, numOIDs: len(objectIDs), err: err}
results[i] = searchResult{startIndex: startIndex, endIndex: endIndex, numOIDs: len(objectIDs), err: err}

Check warning on line 262 in cli/util/uploader.go

View check run for this annotation

Codecov / codecov/patch

cli/util/uploader.go#L262

Added line #L262 was not covered by tests
}(i, startIndex, endIndex)
}
wg.Wait()

for i := len(results) - 1; i >= 0; i-- {
if results[i].err != nil {
return 0, fmt.Errorf("search of index files failed for batch with indexes from %d to %d: %w", batch*searchBatchSize, (batch+1)*searchBatchSize, results[i].err)
return 0, fmt.Errorf("search of index files failed for batch with indexes from %d to %d: %w", results[i].startIndex, results[i].endIndex-1, results[i].err)

Check warning on line 269 in cli/util/uploader.go

View check run for this annotation

Codecov / codecov/patch

cli/util/uploader.go#L269

Added line #L269 was not covered by tests
}
if results[i].numOIDs < searchBatchSize {
emptyBatchFound = true
Expand Down

0 comments on commit f6de1bb

Please sign in to comment.