jankotek / jankotek/mapdb

recid is not returned to RECID_LONG_STACK after preallocate+delete

Open
#985 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
5.1k
Forks
877
PR merge metrics
No merged PRs in 30d

Description

MapDb 3.0.8. StoreWAL and StoreDirect do not releaseRecid if oldSize == NULL_RECORD_SIZE, thus preallocating and deleting a recid (without ever writing a value to it) will cause the recid not to be reused.

Compare:

long r1 = store.preallocate();
store.update(r1, 1, Serializer.INTEGER);
store.delete(r1, Serializer.INTEGER);
long r2 = store.preallocate();

with:

long r1 = store.preallocate();
store.delete(r1, Serializer.INTEGER);
long r2 = store.preallocate();

In the first case r1==r2, but the second one results in r1!=r2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the preallocate and delete paths in StoreWAL and StoreDirect, focusing on handling when oldSize == NULL_RECORD_SIZE. Reproduce both examples from the issue and verify that deleting an unused preallocated recid allows the next preallocate call to return the same recid.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.