-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Use directly leveldb batch #1507
Conversation
This commit improves the leveldbhelper.UpdateBatch by replacing the map that it maintains by the actual leveldb batch. This reduces the memory consumed and a sorting of key-values is avoided if the data added is already in sorted order (such as loading the data from snapshot files) Signed-off-by: manish <manish.sethi@gmail.com>
// WriteBatch writes a batch in an atomic way | ||
func (h *DBHandle) WriteBatch(batch *UpdateBatch, sync bool) error { | ||
if len(batch.KVs) == 0 { | ||
if batch == nil || batch.Len() == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR. I was checking whether leveldb.WriteBatch
returns err when the batch is nil (it does). You might be aware of the following. Then, I found that they use transaction (OpenTransaction()
, Commit()
) when the batch size is large to skip writing to journal. I remember once you said that we need to look at disabling the journal writes as we have a block store.
@Mergifyio backport release-2.2 |
Command
|
This commit improves the leveldbhelper.UpdateBatch by replacing the map that it maintains by the actual leveldb batch. This reduces the memory consumed and a sorting of key-values is avoided if the data added is already in sorted order (such as loading the data from snapshot files) Signed-off-by: manish <manish.sethi@gmail.com> (cherry picked from commit 1ad6d5b)
This commit improves the leveldbhelper.UpdateBatch by replacing the map that it maintains by the actual leveldb batch. This reduces the memory consumed and a sorting of key-values is avoided if the data added is already in sorted order (such as loading the data from snapshot files) Signed-off-by: manish <manish.sethi@gmail.com>
This commit improves the leveldbhelper.UpdateBatch by replacing the map that it maintains by the actual leveldb batch. This reduces the memory consumed and a sorting of key-values is avoided if the data added is already in sorted order (such as loading the data from snapshot files) Signed-off-by: manish <manish.sethi@gmail.com>
Signed-off-by: manish manish.sethi@gmail.com
Type of change
Description
This PR improves the
leveldbhelper.UpdateBatch
by replacing the map that it maintains by the actual leveldb batch.This reduces the memory consumed and a sorting of key-values is avoided if the data added is already in sorted order (such as loading the data from snapshot files)