Skip to content

Delete the default session's data in deleteCore - #133

Merged
chm-diederichs merged 1 commit into
mainfrom
fix/delete-core-data
Oct 6, 2026
Merged

chm-diederichs merged 1 commit into
mainfrom
fix/delete-core-data

Conversation

@Drache93

@Drache93 Drache93 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

deleteCore clears the core's rows and its named sessions' data, but not the default session's data (blocks, tree, bitfield, user data). With the core rows gone that data is unreachable, so it leaks: a purged hypercore left 151 of its 157 keys behind.

  • Also delete core.data(ptr.dataPointer).
  • Test checks the core and data key ranges are empty afterwards and other cores are untouched.

Needed for hypercore's purge(): holepunchto/hypercore#881.

Open question: corestore's staticify() creates a second core sharing the same corePointer/dataPointer. deleteCore on either already removes the shared core rows, so this doesn't make that case worse, but it may want explicit handling.

🤖

deleteCore cleared the core's own rows and the data of its named sessions,
but not the data of the default session, so blocks, tree nodes, bitfield
pages and user data of a deleted core stayed in the store forever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chm-diederichs
chm-diederichs merged commit 09892d2 into main Oct 6, 2026
4 checks passed
@chm-diederichs
chm-diederichs deleted the fix/delete-core-data branch October 6, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants