RocksDB stress test fixes + find_merge_thread() bugfix
This commit is contained in:
@@ -29,11 +29,12 @@ pub struct HashedValue<T: Deserialize> {
|
||||
pub inner: T,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum AssertValue {
|
||||
U32(u32),
|
||||
U64(u64),
|
||||
Hash(u64),
|
||||
Some,
|
||||
None,
|
||||
}
|
||||
|
||||
@@ -47,6 +48,12 @@ pub trait ToAssertValue {
|
||||
fn to_assert_value(&self) -> AssertValue;
|
||||
}
|
||||
|
||||
impl ToAssertValue for AssertValue {
|
||||
fn to_assert_value(&self) -> AssertValue {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl ToAssertValue for () {
|
||||
fn to_assert_value(&self) -> AssertValue {
|
||||
AssertValue::None
|
||||
@@ -84,6 +91,7 @@ impl AssertValue {
|
||||
AssertValue::U64(v) => bytes.len() == U64_LEN && u64::deserialize(bytes).unwrap() == *v,
|
||||
AssertValue::Hash(v) => xxhash_rust::xxh3::xxh3_64(bytes) == *v,
|
||||
AssertValue::None => false,
|
||||
AssertValue::Some => true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,21 @@ impl BatchBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
impl Batch {
|
||||
pub fn is_atomic(&self) -> bool {
|
||||
!self.ops.iter().any(|op| {
|
||||
matches!(
|
||||
op,
|
||||
Operation::AssertValue { .. }
|
||||
| Operation::Value {
|
||||
class: ValueClass::ReservedId,
|
||||
op: ValueOp::Set(_)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BatchBuilder {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
|
||||
Reference in New Issue
Block a user