Delete reuse space#1539
Merged
Merged
Conversation
The compression must work with previously deleted records with v < 23.12.1
The issue was invalid pointers while deleting multi chunk records. Some pages was defrag while the old pointers pointed to the old place
…record shrunk Issue #1391
The issue was with the missing deletion of the whole linked list segments. Only the head was deleted. This issue was found thanks to the CHECK DATABASE command.
This v1 algorithm keeps a list of max 20 pages with statistics of number of records and free space per page. When new space is needed (insert/update), then the list of pages is checked first to recycle space from old pages. The statistics are kept in a json file written at db closing, like the count file. This file is not crucial, can be lost, it's just an approx. cache of free space available.
The algorithm now searches first on the current page for new space
…e way space is reused
… real used records
…n no changes in the database was done
tae898
pushed a commit
to humemai/arcadedb-embedded-python
that referenced
this pull request
Jun 28, 2026
* first version of compress pages after a delete The compression must work with previously deleted records with v < 23.12.1 * chore: additional check on page pointer * Fixed issue with compacting holes The issue was invalid pointers while deleting multi chunk records. Some pages was defrag while the old pointers pointed to the old place * Fixed move of records in update * Fixed compression of page Issue ArcadeData#1391 * Fixed last issue with update in multi page record * feat: deleted extra space from multi-page records when on update the record shrunk Issue ArcadeData#1391 * test: added new test case that creates and delete multiple times a graph * test: added check database after test * fix: vertex delete left space allocated The issue was with the missing deletion of the whole linked list segments. Only the head was deleted. This issue was found thanks to the CHECK DATABASE command. * fix: fixed issue after merge * chore: updated code from latest sync with main * chore: fixed after PR merge * Fixed creation of new record using recycled RID The counter of total records in the page was always updated to the current record, instead of updating only when needed * test: fixed failing tests * Fixed bug on index cursor Once the cursor is created, it browses the 1st entry. If the 1st entry is deleted (negative rid), then the index was marked as empty (!) * Fixed issue with index range and new recycled RIDs * fix: used removed keys instead of rids * chore: updating changes from main * chore: updating changes from main * chore: updating changes from main * test: merged from main branch * fix: unique index comparison in transaction This could lead to duplicate entries in the index when the transaction was committed. * fix: empty edge linked list segment are now deleted and reused Issue ArcadeData#1391 * feat: implemented space reclaim from pages v1 This v1 algorithm keeps a list of max 20 pages with statistics of number of records and free space per page. When new space is needed (insert/update), then the list of pages is checked first to recycle space from old pages. The statistics are kept in a json file written at db closing, like the count file. This file is not crucial, can be lost, it's just an approx. cache of free space available. * test: added recycle space test Issue ArcadeData#1391 * test: increased buckets to support higher contention with recycled records * fix: fixed multi page record chain * fix: support deleted record on vertex delete * perf: optimized looking for new space in pages The algorithm now searches first on the current page for new space * fix: space allocation of current page * Speeded up structure to manage free space in pages * feat: new `arcadedb.bucketReuseSpaceMode` global setting to change the way space is reused * test: added more checks * chore: small refactoring to use the new reuse space mode setting * fix: wrong usage of recordCountInPage without taking into account the real used records * fix: changed order of deletion of vertices of linked list * fix: postponed the deletion of linked lists AFTER the edges * chore: added "medium" to BUCKET_REUSE_SPACE_MODE setting * Added test and fixed broken edges on delete * fix: writing of multi page record * test: set BUCKET_REUSE_SPACE_MODE to high * Fixed buffer allocation math * feat: introduced modification counter to avoid read of statistics when no changes in the database was done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pending PR to analyze differences after a long time working on this branch.
This PR is for #1391.