diff options
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/index_counter.rs | 2 | ||||
-rw-r--r-- | src/model/k2v/item_table.rs | 25 | ||||
-rw-r--r-- | src/model/s3/block_ref_table.rs | 2 | ||||
-rw-r--r-- | src/model/s3/object_table.rs | 2 | ||||
-rw-r--r-- | src/model/s3/version_table.rs | 2 |
5 files changed, 15 insertions, 18 deletions
diff --git a/src/model/index_counter.rs b/src/model/index_counter.rs index 4fec1138..48f616f7 100644 --- a/src/model/index_counter.rs +++ b/src/model/index_counter.rs @@ -121,7 +121,7 @@ impl<T: CounterSchema> TableSchema for CounterTable<T> { _tx: &mut db::Transaction, _old: Option<&Self::E>, _new: Option<&Self::E>, - ) -> db::Result<()> { + ) -> db::TxOpResult<()> { // nothing for now Ok(()) } diff --git a/src/model/k2v/item_table.rs b/src/model/k2v/item_table.rs index 77446f64..991fe66d 100644 --- a/src/model/k2v/item_table.rs +++ b/src/model/k2v/item_table.rs @@ -227,7 +227,7 @@ impl TableSchema for K2VItemTable { tx: &mut db::Transaction, old: Option<&Self::E>, new: Option<&Self::E>, - ) -> db::Result<()> { + ) -> db::TxOpResult<()> { // 1. Count let (old_entries, old_conflicts, old_values, old_bytes) = match old { None => (0, 0, 0, 0), @@ -245,7 +245,7 @@ impl TableSchema for K2VItemTable { .map(|e| &e.partition.partition_key) .unwrap_or_else(|| &new.unwrap().partition.partition_key); - match self.counter_table.count( + let counter_res = self.counter_table.count( tx, &count_pk, count_sk, @@ -255,18 +255,15 @@ impl TableSchema for K2VItemTable { (VALUES, new_values - old_values), (BYTES, new_bytes - old_bytes), ], - ) { - Ok(()) => (), - Err(db::TxError::Db(e)) => return Err(e), - Err(db::TxError::Abort(e)) => { - // This result can be returned by `counter_table.count()` for instance - // if messagepack serialization or deserialization fails at some step. - // Warn admin but ignore this error for now, that's all we can do. - error!( - "Unable to update K2V item counter for bucket {:?} partition {}: {}. Index values will be wrong!", - count_pk, count_sk, e - ); - } + ); + if let Err(e) = db::unabort(counter_res)? { + // This result can be returned by `counter_table.count()` for instance + // if messagepack serialization or deserialization fails at some step. + // Warn admin but ignore this error for now, that's all we can do. + error!( + "Unable to update K2V item counter for bucket {:?} partition {}: {}. Index values will be wrong!", + count_pk, count_sk, e + ); } // 2. Notify diff --git a/src/model/s3/block_ref_table.rs b/src/model/s3/block_ref_table.rs index 2c06bc96..1134922e 100644 --- a/src/model/s3/block_ref_table.rs +++ b/src/model/s3/block_ref_table.rs @@ -58,7 +58,7 @@ impl TableSchema for BlockRefTable { tx: &mut db::Transaction, old: Option<&Self::E>, new: Option<&Self::E>, - ) -> db::Result<()> { + ) -> db::TxOpResult<()> { #[allow(clippy::or_fun_call)] let block = old.or(new).unwrap().block; let was_before = old.map(|x| !x.deleted.get()).unwrap_or(false); diff --git a/src/model/s3/object_table.rs b/src/model/s3/object_table.rs index f3bd9892..62f5d8d9 100644 --- a/src/model/s3/object_table.rs +++ b/src/model/s3/object_table.rs @@ -239,7 +239,7 @@ impl TableSchema for ObjectTable { _tx: &mut db::Transaction, old: Option<&Self::E>, new: Option<&Self::E>, - ) -> db::Result<()> { + ) -> db::TxOpResult<()> { let version_table = self.version_table.clone(); let old = old.cloned(); let new = new.cloned(); diff --git a/src/model/s3/version_table.rs b/src/model/s3/version_table.rs index d168c2c2..881c245a 100644 --- a/src/model/s3/version_table.rs +++ b/src/model/s3/version_table.rs @@ -144,7 +144,7 @@ impl TableSchema for VersionTable { _tx: &mut db::Transaction, old: Option<&Self::E>, new: Option<&Self::E>, - ) -> db::Result<()> { + ) -> db::TxOpResult<()> { let block_ref_table = self.block_ref_table.clone(); let old = old.cloned(); let new = new.cloned(); |