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

replace original file and rebuilt index after merge #255

Merged
merged 9 commits into from
Aug 17, 2023
Merged

replace original file and rebuilt index after merge #255

merged 9 commits into from
Aug 17, 2023

Conversation

Jeremy-Run
Copy link
Contributor

I have two ideas for this function:

  1. After the merge is completed, replace the file and rebuild the index from disk.
    Advantages: Memory usage does not increase.
    Disadvantages: The whole process requires a write lock, and the db cannot be read or written externally.

  2. Put the written index data into the temporary storage area during the merge process (like copy-on-write), and build an index while building the hint file. When the merge ends, the index of the temporary storage area and the hint index to combine.
    Advantages: DB's write lock time is smooth and can be merged smoothly.
    Disadvantage: There may be more than twice the memory overhead.

Based on the shortcomings of bitcase, I chose the first option.

@Jeremy-Run Jeremy-Run marked this pull request as draft August 10, 2023 09:49
@Jeremy-Run Jeremy-Run marked this pull request as ready for review August 10, 2023 12:37
merge.go Outdated Show resolved Hide resolved
merge.go Show resolved Hide resolved
merge_test.go Outdated Show resolved Hide resolved
merge_test.go Outdated Show resolved Hide resolved
merge.go Outdated Show resolved Hide resolved
@roseduan roseduan merged commit 3a218c2 into rosedblabs:main Aug 17, 2023
2 checks passed
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.

None yet

2 participants