Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Durability on page read/write #11

Open
myui opened this issue Jul 11, 2020 · 2 comments
Open

Better Durability on page read/write #11

myui opened this issue Jul 11, 2020 · 2 comments
Assignees

Comments

@myui
Copy link
Owner

myui commented Jul 11, 2020

BTreeNode.write and read operation should be atomic for a better Durability (sudden shutdown etc).

To do that, undo log is required.

@myui myui self-assigned this Jul 11, 2020
@myui myui changed the title Use Filelock for atomic read/write for a better Durability Better Durability on page read/write Jul 15, 2020
@plummip
Copy link

plummip commented Aug 18, 2020

Just an idea isnt it better to write insert/update/remove/search events to a file before performing them.
Insert("1", "Jane")
Insert("2", "John")
Execute(); // write to log and perform queued operations

Also try removing the RandomAccessFile.
Its slower than a SeekableByteChannel (Files.newByteChannel()).

@myui
Copy link
Owner Author

myui commented Aug 19, 2020

@plummip

Just an idea isnt it better to write insert/update/remove/search events to a file before performing them.
WAL Redo log can be done outside btree4j.

UNDO log of page is required when updating an old page P1 with new page entry P2.

P2 may be broken if page write failed in the middle of writes. For such case, we need to backup P1 to undolog so that we can rollback to P1 on recovery; write P1 to undo log before replacing P1 with P2 and remove the P1 undo entry from undo log when P2 write is successfully done. We need to add checksum for a page.

Recovery is being done when loading BTree from File.

Undo logging has a drawback in performance, undolog and checksum should be optional.

Just an idea isnt it better to write insert/update/remove/search events to a file before performing them.
Insert("1", "Jane")
Insert("2", "John")
Execute(); // write to log and perform queued operations

It's REDO log. It could be outside btree4j.

Also try removing the RandomAccessFile. Its slower than a SeekableByteChannel (Files.newByteChannel()).

Could you provide benchmark results for random access? I suspect no significant difference between them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants