Skip to content
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

Merged
merged 5 commits into from Nov 25, 2022
Merged

fix: gc to continue on retrieval error #3585

merged 5 commits into from Nov 25, 2022

Conversation

istae
Copy link
Member

@istae istae commented Nov 24, 2022

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):


This change is Reviewable

@istae istae requested review from a team, mrekucci, notanatol and aloknerurkar and removed request for a team November 24, 2022 19:48
@istae istae changed the title fix: gc to continue on retreieval error fix: gc to continue on retreival error Nov 24, 2022
@istae istae changed the title fix: gc to continue on retreival error fix: gc to continue on retrieval error Nov 24, 2022
@@ -466,6 +466,11 @@ func (db *DB) addToCache(
batch *leveldb.Batch,
item shed.Item,
) (int64, error) {

err := db.pullIndex.DeleteInBatch(batch, item)
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Member Author

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.

pkg/localstore/gc.go Show resolved Hide resolved
@istae istae merged commit ee07475 into master Nov 25, 2022
@istae istae deleted the gc-continue branch November 25, 2022 10:00
@aloknerurkar aloknerurkar added this to the 1.10.0 milestone Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants