diff --git a/Cargo.lock b/Cargo.lock index 2833fced..0cd3d4d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1299,7 +1299,7 @@ dependencies = [ "humansize", "indicatif", "serde_json", - "surrealkv 0.7.0", + "surrealkv", ] [[package]] @@ -1356,26 +1356,6 @@ dependencies = [ "syn", ] -[[package]] -name = "surrealkv" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c651de39c5af29f5e4ba89a255b2247f470d8f3f059a5462ee4287f6c34588b1" -dependencies = [ - "ahash", - "async-channel", - "bytes", - "chrono", - "crc32fast", - "futures", - "lru", - "parking_lot", - "quick_cache", - "revision", - "tokio", - "vart 0.6.3", -] - [[package]] name = "surrealkv" version = "0.7.0" @@ -1400,10 +1380,9 @@ dependencies = [ "quick_cache", "rand 0.8.5", "revision", - "surrealkv 0.4.4", "tempdir", "tokio", - "vart 0.8.1", + "vart", "walkdir", "wasm-bindgen-futures", ] @@ -1492,12 +1471,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "vart" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52d02665a2dd16898d28bd1d314b067a97365facca5c39c370d55822bcbbfb48" - [[package]] name = "vart" version = "0.8.1" diff --git a/Cargo.toml b/Cargo.toml index fb19b1c8..d67f88ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,6 @@ libc = "0.2.155" fmmap = "0.3.3" memmap2 = "0.9.4" num_cpus = "1.16.0" -skv44 = { package = "surrealkv", version = "0.4.4" } walkdir = "2.5.0" [[bench]] diff --git a/src/store.rs b/src/store.rs index a66c23b0..0f6a779a 100644 --- a/src/store.rs +++ b/src/store.rs @@ -1774,93 +1774,6 @@ mod tests { store.close().await.unwrap(); } - #[tokio::test] - async fn test_tx_id_assignment_after_migration_from_skv44() { - // Create a temporary directory for testing - let temp_dir = create_temp_directory(); - - // Create store options with the test directory - let mut opts = skv44::Options::new(); - opts.dir = temp_dir.path().to_path_buf(); - - // Number of transactions - let num_transactions = 10; - // Number of keys per transaction - let keys_per_transaction = 5; - - let default_value = Bytes::from("default_value".to_string()); - - // Create a vector to store the generated keys - let mut keys: Vec = Vec::new(); - - for txn_id in 0..num_transactions { - for key_id in 0..keys_per_transaction { - // Generate a unique key for each transaction and key_id - let key_bytes = Bytes::from(format!("txn{}_key{}", txn_id, key_id)); - keys.push(key_bytes); - } - } - - // Insert multiple records in each transaction and close/reopen the store - for txn_id in 0..num_transactions { - // Create a new store instance with VariableKey as the key type - let store = skv44::Store::new(opts.clone()).expect("should create store"); - - // Start a new write transaction - let mut txn = store.begin().unwrap(); - for key_id in 0..keys_per_transaction { - let key = Bytes::from(format!("txn{}_key{}", txn_id, key_id)); - txn.set(&key, &default_value).unwrap(); - } - txn.commit().await.unwrap(); - - // Drop the store to simulate closing it - store.close().await.unwrap(); - } - - // Create a new store instance but with values read from disk - let mut opts = Options::new(); - opts.dir = temp_dir.path().to_path_buf(); - - let store = Store::new(opts).expect("should create store"); - - // Insert a new transaction into the reopened store - let new_key = Bytes::from("new_key"); - let new_value = Bytes::from("new_value"); - - { - // Start a new write transaction - let mut txn = store.begin().unwrap(); - txn.set(&new_key, &new_value).unwrap(); - txn.commit().await.unwrap(); - let (new_tx_id, _) = txn.get_versionstamp().unwrap(); - - let expected_tx_id = ((num_transactions - 1) * keys_per_transaction) + 2; - assert_eq!(expected_tx_id, new_tx_id); - } - - // Verify the new transaction - { - // Start a new read transaction - let mut txn = store.begin().unwrap(); - let val = txn.get(&new_key).unwrap().unwrap(); - // Assert that the value retrieved in txn matches new_value - assert_eq!(val, new_value.as_ref()); - } - - // Read the keys from the store to verify after reopening - for txn_id in 0..num_transactions { - for key_id in 0..keys_per_transaction { - let key = Bytes::from(format!("txn{}_key{}", txn_id, key_id)); - // Start a new read transaction - let mut txn = store.begin().unwrap(); - let val = txn.get(&key).unwrap().unwrap(); - // Assert that the value retrieved in txn matches default_value - assert_eq!(val, default_value.as_ref()); - } - } - } - #[tokio::test] async fn stop_task_runner_with_pending_tasks() { // Create a temporary directory for testing