-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
store: introduce Database::get_with_rc_stripped method (#7483)
Add get_with_rc_stripped method to the Database trait which strips the reference count from the returned value. Previously, Store::get method called get_raw_bytes and then (for reference counted columns) refcount::get_with_rc_logic to strip the reference count. With this change, it now calls either get_raw_bytes or get_with_rc_stripped as needed. The reason for this addition is to help with cold storage. We don’t want to keep refcounts in cold storage which means that we would need to append dummy refcount to get_raw_bytes calls against cold storage. By having a separate method which returns values without refcount, we won’t need to worry about this dummy count. As a side benefit, this removes a memory allocation when reading a reference counted column. Previosly get_payload method was used to strip the refcount: fn get_payload(value: Vec<u8>) -> Option<Vec<u8>> { decode_value_with_rc(&value).0.map(|v| v.to_vec()) } The issue with it is that it takes a Vec as argument, takes a slice of it and creates a new Vec from it. Now the vector is simply truncated by strip_refcount function.
- Loading branch information
Showing
3 changed files
with
38 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters