mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-22 09:19:08 +00:00
cli: add warning for duplicated index files in upload-bin
As we are not afraid of duplicates this is not a critical error anymore. BlockFetcher will take the first returned by search. Close #3762 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
24f81a7f3e
commit
c669ae343b
1 changed files with 7 additions and 11 deletions
|
@ -281,20 +281,16 @@ func searchIndexFile(ctx *cli.Context, p poolWrapper, containerID cid.ID, privKe
|
||||||
filters.AddFilter("IndexSize", fmt.Sprintf("%d", indexFileSize), object.MatchStringEqual)
|
filters.AddFilter("IndexSize", fmt.Sprintf("%d", indexFileSize), object.MatchStringEqual)
|
||||||
for i := 0; ; i++ {
|
for i := 0; ; i++ {
|
||||||
indexIDs := searchObjects(ctx.Context, p, containerID, privKeys, attributeKey, uint(i), uint(i+1), 1, maxRetries, debug, errCh, filters)
|
indexIDs := searchObjects(ctx.Context, p, containerID, privKeys, attributeKey, uint(i), uint(i+1), 1, maxRetries, debug, errCh, filters)
|
||||||
count := 0
|
resOIDs := make([]oid.ID, 0, 1)
|
||||||
for range indexIDs {
|
for id := range indexIDs {
|
||||||
count++
|
resOIDs = append(resOIDs, id)
|
||||||
if count > 1 {
|
|
||||||
select {
|
|
||||||
case errCh <- fmt.Errorf("duplicated index file %d found", i):
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if count == 0 {
|
if len(resOIDs) == 0 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if len(resOIDs) > 1 {
|
||||||
|
fmt.Fprintf(ctx.App.Writer, "WARN: %d duplicated index files with index %d found: %s\n", len(resOIDs), i, resOIDs)
|
||||||
|
}
|
||||||
existingIndexCount++
|
existingIndexCount++
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.App.Writer, "Current index files count: %d\n", existingIndexCount)
|
fmt.Fprintf(ctx.App.Writer, "Current index files count: %d\n", existingIndexCount)
|
||||||
|
|
Loading…
Reference in a new issue