Fix orphaned pvtdata missing entries from stale iterator during elg c…#5405
Fix orphaned pvtdata missing entries from stale iterator during elg c…#5405Ady0333 wants to merge 2 commits intohyperledger:mainfrom
Conversation
|
We need a test that would show the importance of your changes. |
|
Thanks for the feedback @pfi79 sir. I agree. I’ll add a unit test in pvtdatastorage that reproduces the eligibility-conversion + purge overlap and asserts that no orphaned eligible missing data entries are created. |
…onversion Re-create the LevelDB iterator after releasing and re-acquiring purgerLock in processCollElgEvents. The old snapshot-based iterator yields entries deleted by the purger during the unlock window, creating eligible missing data entries with no expiry entry that are never cleaned up. Signed-off-by: Ady0333 <[email protected]>
4c5c13c to
c30255c
Compare
|
Hello @pfi79 , For now as requested, I have added a test which would show importance of my changes. |
|
@Ady0333 Will you still be working on this pr? I remind you that in order for us to start considering pr, it is necessary that all conflicts are resolved and the pipeline is completely passed (in green). |
Signed-off-by: Aditya Shinde <[email protected]>
|
@pfi79 Yes, i will be working on this pr till final. Not only this pr but all the PRs which i have opened, I will work on them till end. |
Fix orphaned eligible missing private data entries during collection eligibility conversion
Type of change
Description
This PR fixes a race in private data storage that could silently create orphaned eligible missing data entries when a peer becomes newly eligible for a collection.
processCollElgEvents()converts ineligible missing data entries to eligible ones in batches. When the number of entries is large, it temporarily releasespurgerLockbetween batches. During this unlock window, a purge cycle may delete expired missing data entries.However, the conversion logic continued using a LevelDB iterator created before the lock was released. Because the iterator operates on a snapshot, it could still yield entries that were already deleted by the purger. Converting these stale entries recreates eligible prioritized missing data entries without corresponding expiry metadata, meaning they are never cleaned up by future purge cycles.
The fix re-creates the iterator after re-acquiring the lock so that only entries that still exist in the database are converted.
Additional details
processCollElgEvents()Tested with:
go test ./core/ledger/...Release Note
Fixes an issue where private data eligibility conversion could create
orphaned missing data entries that were never cleaned up by purge cycles.