Release 0.19.0 (#669)

master
Oleksandr Anyshchenko 2 years ago committed by GitHub
parent 03f10c0d2a
commit 9118a60fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      CHANGELOG.md
  2. 2
      Cargo.toml
  3. 3
      README.md
  4. 13
      src/transactions/options.rs
  5. 32
      tests/test_optimistic_transaction_db.rs
  6. 36
      tests/test_transaction_db.rs

@ -2,9 +2,39 @@
## [Unreleased] ## [Unreleased]
## 0.19.0 (2022-08-05)
* Add support for building with `io_uring` on Linux (parazyd)
* Change iterators to return Result (mina86)
* Support RocksDB transaction (yiyuanliu)
* Avoid pulling in dependencies via static feature flag (niklasf)
* Bump `rocksdb` to 7.4.4 (niklasf)
* Bump `tikv-jemalloc-sys` to 0.5 (niklasf)
* Update `set_use_fsync` comment (nazar-pc)
* Introduce ReadOptions::set_iterate_range and PrefixRange (mina86)
* Bump `rocksdb` to 7.4.3 (aleksuss)
* Don’t hold onto ReadOptions.inner when iterating (mina86)
* Bump `zstd-sys` from 1.6 to 2.0 (slightknack)
* Enable a building on the iOS platform (dignifiedquire)
* Add DBRawIteratorWithThreadMode::item method (mina86)
* Use NonNull in DBRawIteratorWithThreadMode (mina86)
* Tiny refactoring including fix for UB (niklasf)
* Add batched version MultiGet API (yhchiang-sol)
* Upgrade to rocksdb v7.3.1 (yhchiang-sol)
* Consistently use `ffi_util::to_cpath` to convert `Path` to `CString` (mina86)
* Convert properties to `&CStr` (mina86)
* Allow passing `&CStr` arguments (mina86)
* Fix memory leak when reading properties and avoid memory allocation (mina86)
* Fix Windows UTF-8 build flag (rajivshah3)
* Use more target features to build librocksdb-sys (niklasf)
* Fix `bz_internal_error` symbol multiply defined (nanpuyue)
* Bump rocksdb to 7.1.2 (dignifiedquire)
* Add BlobDB options (dignifiedquire)
* Add snapshot `PinnableSlice` based API (zheland)
## 0.18.0 (2022-02-03) ## 0.18.0 (2022-02-03)
* Add open_cf_descriptor methods for Seoncdary and ReadOnly AccessType (steviez) * Add open_cf_descriptor methods for Secondary and ReadOnly AccessType (steviez)
* Make Ribbon filters available (niklasf) * Make Ribbon filters available (niklasf)
* Change versioning scheme of `librocksdb-sys` crate (aleksuss) * Change versioning scheme of `librocksdb-sys` crate (aleksuss)
* Upgrade to RocksDB 6.28.2 (akrylysov) * Upgrade to RocksDB 6.28.2 (akrylysov)
@ -30,7 +60,7 @@
* Support UTF-8 file paths on Windows (rajivshah3) * Support UTF-8 file paths on Windows (rajivshah3)
* Support building RocksDB with jemalloc (akrylysov) * Support building RocksDB with jemalloc (akrylysov)
* Add rocksdb WAL flush api (duarten) * Add rocksdb WAL flush api (duarten)
* Update rocksdb to v6.22.1 (#540) * Update rocksdb to v6.22.1 (duarten)
## 0.17.0 (2021-07-22) ## 0.17.0 (2021-07-22)

@ -1,7 +1,7 @@
[package] [package]
name = "rocksdb" name = "rocksdb"
description = "Rust wrapper for Facebook's RocksDB embeddable database" description = "Rust wrapper for Facebook's RocksDB embeddable database"
version = "0.18.0" version = "0.19.0"
edition = "2018" edition = "2018"
authors = ["Tyler Neely <t@jujit.su>", "David Greenberg <dsg123456789@gmail.com>"] authors = ["Tyler Neely <t@jujit.su>", "David Greenberg <dsg123456789@gmail.com>"]
repository = "https://github.com/rust-rocksdb/rust-rocksdb" repository = "https://github.com/rust-rocksdb/rust-rocksdb"

@ -5,6 +5,7 @@ rust-rocksdb
[![documentation](https://docs.rs/rocksdb/badge.svg)](https://docs.rs/rocksdb) [![documentation](https://docs.rs/rocksdb/badge.svg)](https://docs.rs/rocksdb)
[![license](https://img.shields.io/crates/l/rocksdb.svg)](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/LICENSE) [![license](https://img.shields.io/crates/l/rocksdb.svg)](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/LICENSE)
[![Gitter chat](https://badges.gitter.im/rust-rocksdb/gitter.png)](https://gitter.im/rust-rocksdb/lobby) [![Gitter chat](https://badges.gitter.im/rust-rocksdb/gitter.png)](https://gitter.im/rust-rocksdb/lobby)
![rust 1.60.0 required](https://img.shields.io/badge/rust-1.60.0-blue.svg?label=MSRV)
![GitHub commits (since latest release)](https://img.shields.io/github/commits-since/rust-rocksdb/rust-rocksdb/latest.svg) ![GitHub commits (since latest release)](https://img.shields.io/github/commits-since/rust-rocksdb/rust-rocksdb/latest.svg)
@ -42,7 +43,7 @@ default-features = false
features = ["lz4"] features = ["lz4"]
``` ```
## Multi-threaded ColumnFamily alternation ## Multithreaded ColumnFamily alternation
The underlying RocksDB does allow column families to be created and dropped The underlying RocksDB does allow column families to be created and dropped
from multiple threads concurrently. But this crate doesn't allow it by default from multiple threads concurrently. But this crate doesn't allow it by default

@ -14,7 +14,6 @@
// //
use crate::ffi; use crate::ffi;
use core::panic;
pub struct TransactionOptions { pub struct TransactionOptions {
pub(crate) inner: *mut ffi::rocksdb_transaction_options_t, pub(crate) inner: *mut ffi::rocksdb_transaction_options_t,
@ -51,7 +50,7 @@ impl TransactionOptions {
/// ///
/// If a transaction has a snapshot set, the transaction will ensure that /// If a transaction has a snapshot set, the transaction will ensure that
/// any keys successfully written(or fetched via `get_for_update`) have not /// any keys successfully written(or fetched via `get_for_update`) have not
/// been modified outside of this transaction since the time the snapshot was /// been modified outside this transaction since the time the snapshot was
/// set. /// set.
/// If a snapshot has not been set, the transaction guarantees that keys have /// If a snapshot has not been set, the transaction guarantees that keys have
/// not been modified since the time each key was first written (or fetched via /// not been modified since the time each key was first written (or fetched via
@ -149,7 +148,7 @@ impl Default for TransactionDBOptions {
let txn_db_opts = unsafe { ffi::rocksdb_transactiondb_options_create() }; let txn_db_opts = unsafe { ffi::rocksdb_transactiondb_options_create() };
assert!( assert!(
!txn_db_opts.is_null(), !txn_db_opts.is_null(),
"Could not create RocksDB transactiondb options" "Could not create RocksDB transaction_db options"
); );
Self { inner: txn_db_opts } Self { inner: txn_db_opts }
} }
@ -161,7 +160,7 @@ impl TransactionDBOptions {
} }
/// Specifies the wait timeout in milliseconds when writing a key /// Specifies the wait timeout in milliseconds when writing a key
/// outside of a transaction (ie. by calling `TransactionDB::put` directly). /// outside a transaction (i.e. by calling `TransactionDB::put` directly).
/// ///
/// If 0, no waiting is done if a lock cannot instantly be acquired. /// If 0, no waiting is done if a lock cannot instantly be acquired.
/// If negative, there is no timeout and will block indefinitely when acquiring /// If negative, there is no timeout and will block indefinitely when acquiring
@ -183,8 +182,8 @@ impl TransactionDBOptions {
} }
} }
/// Specifies the default wait timeout in milliseconds when a stransaction /// Specifies the default wait timeout in milliseconds when a transaction
/// attempts to lock a key if not secified in `TransactionOptions`. /// attempts to lock a key if not specified in `TransactionOptions`.
/// ///
/// If 0, no waiting is done if a lock cannot instantly be acquired. /// If 0, no waiting is done if a lock cannot instantly be acquired.
/// If negative, there is no timeout. Not using a timeout is not recommended /// If negative, there is no timeout. Not using a timeout is not recommended
@ -266,7 +265,7 @@ impl OptimisticTransactionOptions {
/// ///
/// If a transaction has a snapshot set, the transaction will ensure that /// If a transaction has a snapshot set, the transaction will ensure that
/// any keys successfully written(or fetched via `get_for_update`) have not /// any keys successfully written(or fetched via `get_for_update`) have not
/// been modified outside of this transaction since the time the snapshot was /// been modified outside the transaction since the time the snapshot was
/// set. /// set.
/// If a snapshot has not been set, the transaction guarantees that keys have /// If a snapshot has not been set, the transaction guarantees that keys have
/// not been modified since the time each key was first written (or fetched via /// not been modified since the time each key was first written (or fetched via

@ -269,13 +269,13 @@ fn iterator_test() {
]; ];
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test that it's idempotent // Test that it's idempotent
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test in reverse // Test in reverse
let iter = db.iterator(IteratorMode::End); let iter = db.iterator(IteratorMode::End);
@ -290,13 +290,16 @@ fn iterator_test() {
(k3.clone(), v3.clone()), (k3.clone(), v3.clone()),
(k4.clone(), v4.clone()), (k4.clone(), v4.clone()),
]; ];
assert_eq!(old_iter.collect::<Vec<_>>(), expected); assert_eq!(old_iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected2); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected2);
let iter = db.iterator(IteratorMode::From(b"k3", Direction::Forward)); let iter = db.iterator(IteratorMode::From(b"k3", Direction::Forward));
assert_eq!(iter.collect::<Vec<_>>(), vec![(k3, v3), (k4, v4)]); assert_eq!(
iter.map(Result::unwrap).collect::<Vec<_>>(),
vec![(k3, v3), (k4, v4)]
);
} }
} }
@ -344,7 +347,7 @@ fn prefix_extract_and_iterate_test() {
.into_iter() .into_iter()
.map(|(k, v)| (k.to_vec().into_boxed_slice(), v.to_vec().into_boxed_slice())) .map(|(k, v)| (k.to_vec().into_boxed_slice(), v.to_vec().into_boxed_slice()))
.collect(); .collect();
assert_eq!(expected, iter.collect::<Vec<_>>()); assert_eq!(expected, iter.map(Result::unwrap).collect::<Vec<_>>());
} }
} }
@ -448,13 +451,13 @@ fn transaction_iterator() {
let txn = db.transaction(); let txn = db.transaction();
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test that it's idempotent // Test that it's idempotent
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test in reverse // Test in reverse
let iter = txn.iterator(IteratorMode::End); let iter = txn.iterator(IteratorMode::End);
@ -469,13 +472,16 @@ fn transaction_iterator() {
(k3.clone(), v3.clone()), (k3.clone(), v3.clone()),
(k4.clone(), v4.clone()), (k4.clone(), v4.clone()),
]; ];
assert_eq!(old_iter.collect::<Vec<_>>(), expected); assert_eq!(old_iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected2); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected2);
let iter = txn.iterator(IteratorMode::From(b"k3", Direction::Forward)); let iter = txn.iterator(IteratorMode::From(b"k3", Direction::Forward));
assert_eq!(iter.collect::<Vec<_>>(), vec![(k3, v3), (k4, v4)]); assert_eq!(
iter.map(Result::unwrap).collect::<Vec<_>>(),
vec![(k3, v3), (k4, v4)]
);
} }
} }

@ -296,17 +296,17 @@ fn iterator_test() {
]; ];
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test that it's idempotent // Test that it's idempotent
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test in reverse // Test in reverse
let iter = db.iterator(IteratorMode::End); let iter = db.iterator(IteratorMode::End);
let mut tmp_vec = iter.collect::<Vec<_>>(); let mut tmp_vec = iter.map(Result::unwrap).collect::<Vec<_>>();
tmp_vec.reverse(); tmp_vec.reverse();
let old_iter = db.iterator(IteratorMode::Start); let old_iter = db.iterator(IteratorMode::Start);
@ -317,13 +317,16 @@ fn iterator_test() {
(k3.clone(), v3.clone()), (k3.clone(), v3.clone()),
(k4.clone(), v4.clone()), (k4.clone(), v4.clone()),
]; ];
assert_eq!(old_iter.collect::<Vec<_>>(), expected); assert_eq!(old_iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = db.iterator(IteratorMode::Start); let iter = db.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected2); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected2);
let iter = db.iterator(IteratorMode::From(b"k3", Direction::Forward)); let iter = db.iterator(IteratorMode::From(b"k3", Direction::Forward));
assert_eq!(iter.collect::<Vec<_>>(), vec![(k3, v3), (k4, v4)]); assert_eq!(
iter.map(Result::unwrap).collect::<Vec<_>>(),
vec![(k3, v3), (k4, v4)]
);
} }
} }
@ -372,7 +375,7 @@ fn prefix_extract_and_iterate_test() {
.into_iter() .into_iter()
.map(|(k, v)| (k.to_vec().into_boxed_slice(), v.to_vec().into_boxed_slice())) .map(|(k, v)| (k.to_vec().into_boxed_slice(), v.to_vec().into_boxed_slice()))
.collect(); .collect();
assert_eq!(expected, iter.collect::<Vec<_>>()); assert_eq!(expected, iter.map(Result::unwrap).collect::<Vec<_>>());
} }
} }
@ -469,17 +472,17 @@ fn transaction_iterator() {
let txn = db.transaction(); let txn = db.transaction();
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test that it's idempotent // Test that it's idempotent
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
// Test in reverse // Test in reverse
let iter = txn.iterator(IteratorMode::End); let iter = txn.iterator(IteratorMode::End);
let mut tmp_vec = iter.collect::<Vec<_>>(); let mut tmp_vec = iter.map(Result::unwrap).collect::<Vec<_>>();
tmp_vec.reverse(); tmp_vec.reverse();
let old_iter = txn.iterator(IteratorMode::Start); let old_iter = txn.iterator(IteratorMode::Start);
@ -490,13 +493,16 @@ fn transaction_iterator() {
(k3.clone(), v3.clone()), (k3.clone(), v3.clone()),
(k4.clone(), v4.clone()), (k4.clone(), v4.clone()),
]; ];
assert_eq!(old_iter.collect::<Vec<_>>(), expected); assert_eq!(old_iter.map(Result::unwrap).collect::<Vec<_>>(), expected);
let iter = txn.iterator(IteratorMode::Start); let iter = txn.iterator(IteratorMode::Start);
assert_eq!(iter.collect::<Vec<_>>(), expected2); assert_eq!(iter.map(Result::unwrap).collect::<Vec<_>>(), expected2);
let iter = txn.iterator(IteratorMode::From(b"k3", Direction::Forward)); let iter = txn.iterator(IteratorMode::From(b"k3", Direction::Forward));
assert_eq!(iter.collect::<Vec<_>>(), vec![(k3, v3), (k4, v4)]); assert_eq!(
iter.map(Result::unwrap).collect::<Vec<_>>(),
vec![(k3, v3), (k4, v4)]
);
} }
} }

Loading…
Cancel
Save