Skip to content

Commit

Permalink
708 attach timestamp to deletion record and use it to find newest rec…
Browse files Browse the repository at this point in the history
…ords (#746)

* [708] Pass timestamp to write and delete operations inside pearl holder

* [708] Update changelog

* [708] Fix changelog after merge

* [708] Update pearl version
  • Loading branch information
ikopylov authored Oct 19, 2023
1 parent 8e8c794 commit e07c650
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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
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

0 comments on commit e07c650

Please sign in to comment.