Skip to content

Commit 7b031f4

Browse files
committed
Merge branch 'master' into rocksdict-v2
2 parents 9604376 + 961abc8 commit 7b031f4

11 files changed

Lines changed: 189 additions & 182 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ default = ["snappy", "lz4", "zstd", "zlib", "bzip2"]
2525
jemalloc = ["librocksdb-sys/jemalloc"]
2626
io-uring = ["librocksdb-sys/io-uring"]
2727
valgrind = []
28+
mt_static = ["librocksdb-sys/mt_static"]
2829
snappy = ["librocksdb-sys/snappy"]
2930
lz4 = ["librocksdb-sys/lz4"]
3031
zstd = ["librocksdb-sys/zstd"]
@@ -36,11 +37,11 @@ serde1 = ["serde"]
3637

3738
[dependencies]
3839
libc = "0.2"
39-
librocksdb-sys = { path = "librocksdb-sys", version = "0.16.0" }
40+
librocksdb-sys = { path = "librocksdb-sys", version = "0.17.0" }
4041
serde = { version = "1", features = [ "derive" ], optional = true }
4142

4243
[dev-dependencies]
43-
trybuild = "1.0"
44+
trybuild = "<=1.0.89" # trybuild 1.0.90 needs MSRV 1.70
4445
tempfile = "3.1"
4546
pretty_assertions = "1.0"
4647
bincode = "1.3"

README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
rust-rocksdb
2-
============
3-
![RocksDB build](https://github.com/rust-rocksdb/rust-rocksdb/workflows/RocksDB%20build/badge.svg?branch=master)
1+
# rust-rocksdb
2+
3+
[![RocksDB build](https://github.com/rust-rocksdb/rust-rocksdb/actions/workflows/rust.yml/badge.svg?branch=master)](https://github.com/rust-rocksdb/rust-rocksdb/actions/workflows/rust.yml)
44
[![crates.io](https://img.shields.io/crates/v/rocksdb.svg)](https://crates.io/crates/rocksdb)
55
[![documentation](https://docs.rs/rocksdb/badge.svg)](https://docs.rs/rocksdb)
66
[![license](https://img.shields.io/crates/l/rocksdb.svg)](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/LICENSE)
7-
[![Gitter chat](https://badges.gitter.im/rust-rocksdb/gitter.png)](https://gitter.im/rust-rocksdb/lobby)
7+
[![Gitter chat](https://badges.gitter.im/rust-rocksdb/gitter.svg)](https://gitter.im/rust-rocksdb/lobby)
88
![rust 1.66.0 required](https://img.shields.io/badge/rust-1.66.0-blue.svg?label=MSRV)
99

10-
1110
![GitHub commits (since latest release)](https://img.shields.io/github/commits-since/rust-rocksdb/rust-rocksdb/latest.svg)
1211

1312
## Requirements
@@ -16,7 +15,7 @@ rust-rocksdb
1615

1716
## Contributing
1817

19-
Feedback and pull requests welcome! If a particular feature of RocksDB is
18+
Feedback and pull requests welcome! If a particular feature of RocksDB is
2019
important to you, please let me know by opening an issue, and I'll
2120
prioritize it.
2221

@@ -26,28 +25,38 @@ This binding is statically linked with a specific version of RocksDB. If you
2625
want to build it yourself, make sure you've also cloned the RocksDB and
2726
compression submodules:
2827

29-
git submodule update --init --recursive
28+
```shell
29+
git submodule update --init --recursive
30+
```
3031

3132
## Compression Support
32-
By default, support for the [Snappy](https://github.com/google/snappy),
33+
34+
By default, support for [Snappy](https://github.com/google/snappy),
3335
[LZ4](https://github.com/lz4/lz4), [Zstd](https://github.com/facebook/zstd),
3436
[Zlib](https://zlib.net), and [Bzip2](http://www.bzip.org) compression
35-
is enabled through crate features. If support for all of these compression
37+
is enabled through crate features. If support for all of these compression
3638
algorithms is not needed, default features can be disabled and specific
3739
compression algorithms can be enabled. For example, to enable only LZ4
3840
compression support, make these changes to your Cargo.toml:
3941

40-
```
42+
```toml
4143
[dependencies.rocksdb]
4244
default-features = false
4345
features = ["lz4"]
4446
```
4547

4648
## Multithreaded ColumnFamily alternation
4749

48-
The underlying RocksDB does allow column families to be created and dropped
49-
from multiple threads concurrently. But this crate doesn't allow it by default
50+
RocksDB allows column families to be created and dropped
51+
from multiple threads concurrently, but this crate doesn't allow it by default
5052
for compatibility. If you need to modify column families concurrently, enable
51-
crate feature called `multi-threaded-cf`, which makes this binding's
52-
data structures to use RwLock by default. Alternatively, you can directly create
53+
the crate feature `multi-threaded-cf`, which makes this binding's
54+
data structures use `RwLock` by default. Alternatively, you can directly create
5355
`DBWithThreadMode<MultiThreaded>` without enabling the crate feature.
56+
57+
## Switch between /MT or /MD run time library (Only for Windows)
58+
59+
The feature `mt_static` will request the library to be built with [/MT](https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170)
60+
flag, which results in library using the static version of the run-time library.
61+
*This can be useful in case there's a conflict in the dependecy tree between different
62+
run-time versions.*

librocksdb-sys/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "librocksdb-sys"
3-
version = "0.16.0+8.10.0"
3+
version = "0.17.0+9.0.0"
44
edition = "2018"
55
rust-version = "1.66.0"
66
authors = ["Karl Hobley <karlhobley10@gmail.com>", "Arkadiy Paronyan <arkadiy@ethcore.io>"]
@@ -16,6 +16,7 @@ links = "rocksdb"
1616
default = [ "static" ]
1717
jemalloc = ["tikv-jemalloc-sys"]
1818
static = ["libz-sys?/static", "bzip2-sys?/static"]
19+
mt_static = []
1920
io-uring = ["pkg-config"]
2021
snappy = []
2122
lz4 = ["lz4-sys"]

librocksdb-sys/build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ fn build_rocksdb() {
230230
}
231231

232232
if target.contains("msvc") {
233+
if cfg!(feature = "mt_static") {
234+
config.static_crt(true);
235+
}
233236
config.flag("-EHsc");
234237
config.flag("-std:c++17");
235238
} else {
@@ -245,7 +248,10 @@ fn build_rocksdb() {
245248
config.flag("-Wno-strict-aliasing");
246249
config.flag("-Wno-invalid-offsetof");
247250
}
248-
251+
if target.contains("riscv64gc") {
252+
// link libatomic required to build for riscv64gc
253+
println!("cargo:rustc-link-lib=atomic");
254+
}
249255
for file in lib_sources {
250256
config.file(format!("rocksdb/{file}"));
251257
}
@@ -269,6 +275,9 @@ fn build_snappy() {
269275

270276
if target.contains("msvc") {
271277
config.flag("-EHsc");
278+
if cfg!(feature = "mt_static") {
279+
config.static_crt(true);
280+
}
272281
} else {
273282
// Snappy requires C++11.
274283
// See: https://github.com/google/snappy/blob/master/CMakeLists.txt#L32-L38

librocksdb-sys/build_version.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88

99
// The build script may replace these values with real values based
1010
// on whether or not GIT is available and the platform settings
11-
static const std::string rocksdb_build_git_sha = "54d628602706c0c718cf81f87202e0b8f6615faf";
12-
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:v8.10.0";
11+
static const std::string rocksdb_build_git_sha = "f4441966592636253fd5ab0bb9ed44fc2697fc53";
12+
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:v9.0.0";
1313
#define HAS_GIT_CHANGES 0
1414
#if HAS_GIT_CHANGES == 0
1515
// If HAS_GIT_CHANGES is 0, the GIT date is used.
1616
// Use the time the branch/tag was last modified
17-
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-12-15 13:01:14";
17+
static const std::string rocksdb_build_date = "rocksdb_build_date:2024-03-11 11:26:24";
1818
#else
1919
// If HAS_GIT_CHANGES is > 0, the branch/tag has modifications.
2020
// Use the time the build was created.
21-
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-12-15 13:01:14";
21+
static const std::string rocksdb_build_date = "rocksdb_build_date:2024-03-11 11:26:24";
2222
#endif
2323

2424
std::unordered_map<std::string, ROCKSDB_NAMESPACE::RegistrarFunc> ROCKSDB_NAMESPACE::ObjectRegistry::builtins_ = {};

librocksdb-sys/rocksdb

Submodule rocksdb updated 639 files

src/backup.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ pub struct RestoreOptions {
4848
inner: *mut ffi::rocksdb_restore_options_t,
4949
}
5050

51+
// BackupEngine is a simple pointer wrapper, so it's safe to send to another thread
52+
// since the underlying RocksDB backup engine is thread-safe.
53+
unsafe impl Send for BackupEngine {}
54+
5155
impl BackupEngine {
5256
/// Open a backup engine with the specified options and RocksDB Env.
5357
pub fn open(opts: &BackupEngineOptions, env: &Env) -> Result<Self, Error> {

src/db_options.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,17 +2861,6 @@ impl Options {
28612861
}
28622862
}
28632863

2864-
/// Specifies the file access pattern once a compaction is started.
2865-
///
2866-
/// It will be applied to all input files of a compaction.
2867-
///
2868-
/// Default: Normal
2869-
pub fn set_access_hint_on_compaction_start(&mut self, pattern: AccessHint) {
2870-
unsafe {
2871-
ffi::rocksdb_options_set_access_hint_on_compaction_start(self.inner, pattern as c_int);
2872-
}
2873-
}
2874-
28752864
/// Enable/disable adaptive mutex, which spins in the user space before resorting to kernel.
28762865
///
28772866
/// This could reduce context switch when the mutex is not
@@ -3998,17 +3987,6 @@ pub enum DBRecoveryMode {
39983987
SkipAnyCorruptedRecord = ffi::rocksdb_skip_any_corrupted_records_recovery as isize,
39993988
}
40003989

4001-
/// File access pattern once a compaction has started
4002-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
4003-
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
4004-
#[repr(i32)]
4005-
pub enum AccessHint {
4006-
None = 0,
4007-
Normal,
4008-
Sequential,
4009-
WillNeed,
4010-
}
4011-
40123990
pub struct FifoCompactOptions {
40133991
pub(crate) inner: *mut ffi::rocksdb_fifo_compaction_options_t,
40143992
}

0 commit comments

Comments
 (0)