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

708 attach timestamp to deletion record and use it to find newest records #746

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bob versions changelog

#### Changed
- Use cargo workspace to declare dependencies to avoid their duplication (#821)
- Record timestamp is now passed to Pearl level and used to find newest record in get and exist functions (#708)

#### Fixed

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ tokio = { version = "1.28", features = [] }

# pearl
[workspace.dependencies.pearl]
version = "0.19.0"
version = "0.20.0"
ikopylov marked this conversation as resolved.
Show resolved Hide resolved


[profile.release]
Expand Down
7 changes: 3 additions & 4 deletions bob-backend/src/pearl/holder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl Holder {
counter!(PEARL_PUT_COUNTER, 1);
let data_size = Self::calc_data_size(&data);
let timer = Instant::now();
let res = storage.write(key, data.to_serialized_bytes()).await;
let res = storage.write(key, data.to_serialized_bytes(), BlobRecordTimestamp::new(data.meta().timestamp())).await;
let res = match res {
Err(e) => {
counter!(PEARL_PUT_ERROR_COUNTER, 1);
Expand Down Expand Up @@ -505,15 +505,14 @@ impl Holder {
.with_context(|| format!("cannot build pearl by path: {:?}", &self.inner.disk_path))
}

pub async fn delete(&self, key: BobKey, _meta: &BobMeta, force_delete: bool) -> Result<u64, Error> {
pub async fn delete(&self, key: BobKey, meta: &BobMeta, force_delete: bool) -> Result<u64, Error> {
let state = self.storage.read().await;
if let Some(storage) = state.get() {
trace!("Vdisk: {}, delete key: {}", self.inner.vdisk, key);
counter!(PEARL_DELETE_COUNTER, 1);
let timer = Instant::now();
// TODO: use meta
let res = storage
.delete(Key::from(key), !force_delete)
.delete(Key::from(key), BlobRecordTimestamp::new(meta.timestamp()), !force_delete)
.await
.map_err(|e| {
trace!("error on delete: {:?}", e);
Expand Down