remove the sleeps and busy loop more times when waiting for missing objects
This commit is contained in:
parent
1726eb993c
commit
3597192d58
@ -930,13 +930,12 @@ func (s *SplitStore) doCompact(curTs *types.TipSet) error {
|
|||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
for len(missing) > 0 {
|
for len(missing) > 0 {
|
||||||
if try >= 5 {
|
if try >= 100 {
|
||||||
return xerrors.Errorf("missing %d objects after %d attempts; giving up", len(missing), try)
|
return xerrors.Errorf("missing %d objects after %d attempts; giving up", len(missing), try)
|
||||||
}
|
}
|
||||||
try++
|
try++
|
||||||
|
|
||||||
// wait a bit
|
// wait a bit
|
||||||
time.Sleep(time.Minute)
|
|
||||||
log.Infow("marking missing objects", "attempt", try, "missing", len(missing), "marked", count)
|
log.Infow("marking missing objects", "attempt", try, "missing", len(missing), "marked", count)
|
||||||
|
|
||||||
towalk := missing
|
towalk := missing
|
||||||
@ -1406,7 +1405,7 @@ func (s *SplitStore) purge(curTs *types.TipSet, cids []cid.Cid) error {
|
|||||||
again:
|
again:
|
||||||
s.txnLk.Lock()
|
s.txnLk.Lock()
|
||||||
if len(s.txnMissing) > 0 {
|
if len(s.txnMissing) > 0 {
|
||||||
if try >= 5 {
|
if try >= 100 {
|
||||||
count := len(s.txnMissing)
|
count := len(s.txnMissing)
|
||||||
s.txnLk.Unlock()
|
s.txnLk.Unlock()
|
||||||
return xerrors.Errorf("error purging: missing %d objects after %d attempts; giving up", count, try)
|
return xerrors.Errorf("error purging: missing %d objects after %d attempts; giving up", count, try)
|
||||||
@ -1418,9 +1417,6 @@ func (s *SplitStore) purge(curTs *types.TipSet, cids []cid.Cid) error {
|
|||||||
s.txnMissing = make(map[cid.Cid]struct{})
|
s.txnMissing = make(map[cid.Cid]struct{})
|
||||||
s.txnLk.Unlock()
|
s.txnLk.Unlock()
|
||||||
|
|
||||||
if try > 1 {
|
|
||||||
time.Sleep(time.Minute)
|
|
||||||
}
|
|
||||||
err := protectMissing(missing)
|
err := protectMissing(missing)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("purge error: error protecting missing objects: %w", err)
|
return xerrors.Errorf("purge error: error protecting missing objects: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user