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: gc to continue on retrieval error #3585
Conversation
pkg/localstore/mode_put.go
Outdated
@@ -466,6 +466,11 @@ func (db *DB) addToCache( | |||
batch *leveldb.Batch, | |||
item shed.Item, | |||
) (int64, error) { | |||
|
|||
err := db.pullIndex.DeleteInBatch(batch, item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So moving these doesnt make any difference. The index is only updated when the Batch is written. So order doesnt matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we have early returns from the function due to the pin check, this should not affect the chunk being removed from the reserve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So on L481 we return if there is an existing pinIndex. In this case, we dont put the item to gcIndex and hence we should not delete the pullIndex.
pkg/localstore/mode_set.go
Outdated
@@ -365,6 +365,10 @@ func (db *DB) setUnpin(batch *leveldb.Batch, addr swarm.Address) (gcSizeChange i | |||
item.StoreTimestamp = i.StoreTimestamp | |||
item.BinID = i.BinID | |||
item.BatchID = i.BatchID | |||
err = db.pullIndex.DeleteInBatch(batch, item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so here if an item is in the pushIndex, it should not affect the reserve, this is why it's moved above the pushIndex check.
Checklist
Description
Open API Spec Version Changes (if applicable)
Motivation and Context (Optional)
Related Issue (Optional)
Screenshots (if appropriate):
This change is