Skip to content

Delete reuse space#1539

Merged
lvca merged 80 commits into
mainfrom
delete-reuse-space
Feb 28, 2025
Merged

Delete reuse space#1539
lvca merged 80 commits into
mainfrom
delete-reuse-space

Conversation

@lvca

@lvca lvca commented Apr 5, 2024

Copy link
Copy Markdown
Member

Pending PR to analyze differences after a long time working on this branch.

This PR is for #1391.

@lvca lvca self-assigned this Apr 5, 2024
@lvca lvca added the enhancement New feature or request label Apr 5, 2024
lvca added 5 commits April 4, 2024 23:02
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.
lvca added 25 commits February 15, 2025 18:24
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
@lvca lvca modified the milestones: 25.2.1, 25.3.1 Feb 27, 2025
@lvca lvca merged commit bcaad22 into main Feb 28, 2025
@lvca lvca deleted the delete-reuse-space branch February 28, 2025 04:46
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant