Skip to content

Commit 0314c79

Browse files
author
yangweijian
committed
Update to upstream version
Bump to version 0.2.10(haizhi-rocksdb), 0.2.11+9.9.3(haizhi-librocksdb-sys) - update rocksdb version - fix some tests and clippy now the base versions: - rust-rocksdb: v0.23.0(upstream: 3525109) - librocksdb-sys/rocksdb: v9.9.3(upstream: 14d3046a53, head with our changes: 3370047e)
1 parent e06de2f commit 0314c79

14 files changed

+32
-41
lines changed

Diff for: .gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[submodule "librocksdb-sys/rocksdb"]
55
path = librocksdb-sys/rocksdb
66
url = https://github.com/haizhi-tech/rocksdb.git
7-
branch = v8.1.1-hz
7+
branch = v9.9.3-hz
88
[submodule "librocksdb-sys/lz4"]
99
path = librocksdb-sys/lz4
1010
url = https://github.com/lz4/lz4.git

Diff for: Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "haizhi-rocksdb"
33
description = "Rust wrapper for Facebook's RocksDB embeddable database"
4-
version = "0.2.8"
4+
version = "0.2.10"
55
edition = "2021"
66
rust-version = "1.71.1"
77
authors = ["Tyler Neely <[email protected]>", "David Greenberg <[email protected]>"]
@@ -40,7 +40,7 @@ lto = ["haizhi-librocksdb-sys/lto"]
4040

4141
[dependencies]
4242
libc = "0.2"
43-
haizhi-librocksdb-sys = { path = "librocksdb-sys", version = "0.2.7", default-features = false, features = [
43+
haizhi-librocksdb-sys = { path = "librocksdb-sys", version = "0.2.11", default-features = false, features = [
4444
"static",
4545
] }
4646
serde = { version = "1", features = ["derive"], optional = true }

Diff for: librocksdb-sys/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "haizhi-librocksdb-sys"
3-
version = "0.2.7+9.9.3"
3+
version = "0.2.11+9.9.3"
44
edition = "2021"
55
rust-version = "1.71.1"
66
authors = [

Diff for: librocksdb-sys/tests/ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
unused_variables
2424
)]
2525

26+
use haizhi_librocksdb_sys::*;
2627
use libc::*;
27-
use librocksdb_sys::*;
2828
use std::borrow::Cow;
2929
use std::env;
3030
use std::ffi::{CStr, CString};

Diff for: src/checkpoint.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
//! [1]: https://github.com/facebook/rocksdb/wiki/Checkpoints
1919
2020
use crate::AsColumnFamilyRef;
21-
use crate::{ffi, Error, DB};
22-
use libc::{c_char, int32_t};
21+
use crate::{ffi, Error};
22+
use libc::c_char;
2323

2424
use crate::db::DBInner;
2525
use crate::ffi_util::to_cpath;
26-
use crate::{ColumnFamily, DBCommon, ThreadMode};
26+
use crate::{DBCommon, ThreadMode};
2727
use std::ffi::{CStr, CString};
2828
use std::fs::File;
2929
use std::io::{Read, Write};
@@ -215,14 +215,11 @@ impl<'db> Checkpoint<'db> {
215215
export_dir: P,
216216
) -> Result<ExportImportFilesMetaData, Error> {
217217
let path = export_dir.as_ref();
218-
let cpath = if let Ok(c) = CString::new(path.to_string_lossy().as_bytes()) {
219-
c
220-
} else {
221-
return Err(Error::new(
222-
"Failed to convert path to CString when creating DB checkpoint".to_owned(),
223-
));
224-
};
225-
218+
let cpath = CString::new(path.to_string_lossy().as_bytes()).map_err(|err| {
219+
Error::new(format!(
220+
"Failed to convert path to CString when creating DB checkpoint: {err}"
221+
))
222+
})?;
226223
let inner: *mut ffi::rocksdb_export_import_files_metadata_t;
227224

228225
unsafe {

Diff for: src/db.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ impl<T: ThreadMode, D: DBInner> DBCommon<T, D> {
23632363
true,
23642364
true,
23652365
files_size_error_margin,
2366-
))
2366+
));
23672367
}
23682368
Ok(sizes)
23692369
}
@@ -2549,13 +2549,11 @@ impl<T: ThreadMode, D: DBInner> DBCommon<T, D> {
25492549
opts: &Options,
25502550
metadata: &ExportImportFilesMetaData,
25512551
) -> Result<*mut ffi::rocksdb_column_family_handle_t, Error> {
2552-
let cf_name = if let Ok(c) = CString::new(name.as_bytes()) {
2553-
c
2554-
} else {
2555-
return Err(Error::new(
2556-
"Failed to convert path to CString when creating cf".to_owned(),
2557-
));
2558-
};
2552+
let cf_name = CString::new(name.as_bytes()).map_err(|err| {
2553+
Error::new(format!(
2554+
"Failed to convert path to CString when creating cf: {err}",
2555+
))
2556+
})?;
25592557
Ok(unsafe {
25602558
ffi_try!(ffi::rocksdb_create_column_family_with_import(
25612559
self.inner.inner(),

Diff for: src/db_options.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1138,12 +1138,6 @@ impl Options {
11381138
}
11391139
}
11401140

1141-
pub fn set_periodic_compaction_seconds(&mut self, sec: u64) {
1142-
unsafe {
1143-
ffi::rocksdb_options_set_periodic_compaction_seconds(self.inner, sec);
1144-
}
1145-
}
1146-
11471141
/// If true, the database will be created if it is missing.
11481142
///
11491143
/// Default: `false`
@@ -4770,7 +4764,7 @@ mod tests {
47704764
#[test]
47714765
fn test_set_write_buffer_manager() {
47724766
let mut opts = Options::default();
4773-
let lrucache = Cache::new_lru_cache(100);
4767+
let lrucache = Cache::new_lru_cache(100).unwrap();
47744768
let write_buffer_manager =
47754769
WriteBufferManager::new_write_buffer_manager_with_cache(100, false, lrucache);
47764770
assert_eq!(write_buffer_manager.get_buffer_size(), 100);

Diff for: tests/fail/open_with_multiple_refs_as_single_threaded.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ error[E0596]: cannot borrow `*db_ref1` as mutable, as it is behind a `&` referen
77
help: consider changing this to be a mutable reference
88
|
99
6 | let db_ref1 = &mut db;
10-
| ~~~~~~~
10+
| +++
1111

1212
error[E0596]: cannot borrow `*db_ref2` as mutable, as it is behind a `&` reference
1313
--> tests/fail/open_with_multiple_refs_as_single_threaded.rs:10:5
@@ -18,4 +18,4 @@ error[E0596]: cannot borrow `*db_ref2` as mutable, as it is behind a `&` referen
1818
help: consider changing this to be a mutable reference
1919
|
2020
7 | let db_ref2 = &mut db;
21-
| ~~~~~~~
21+
| +++

Diff for: tests/test_checkpoint.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ use pretty_assertions::assert_eq;
1818

1919
use haizhi_rocksdb as rocksdb;
2020

21-
use rocksdb::{
22-
checkpoint::{Checkpoint, ExportImportFilesMetaData},
23-
Options, DB,
24-
};
21+
use rocksdb::{checkpoint::Checkpoint, Options, DB};
2522
use util::DBPath;
2623

2724
#[test]

Diff for: tests/test_optimistic_transaction_db_memory_usage.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
mod util;
1717

18+
use haizhi_rocksdb as rocksdb;
19+
1820
use rocksdb::{OptimisticTransactionDB, Options, SingleThreaded};
1921
use util::DBPath;
2022

@@ -27,7 +29,7 @@ fn test_optimistic_transaction_db_memory_usage() {
2729
options.enable_statistics();
2830

2931
// setup cache:
30-
let cache = rocksdb::Cache::new_lru_cache(1 << 20); // 1 MB cache
32+
let cache = rocksdb::Cache::new_lru_cache(1 << 20).unwrap(); // 1 MB cache
3133
let mut block_based_options = rocksdb::BlockBasedOptions::default();
3234
block_based_options.set_block_cache(&cache);
3335
options.set_block_based_table_factory(&block_based_options);

Diff for: tests/test_transaction_db_memory_usage.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
mod util;
1616

17+
use haizhi_rocksdb as rocksdb;
18+
1719
use pretty_assertions::assert_eq;
1820

1921
use rocksdb::{perf, Options, TransactionDB, TransactionDBOptions};
@@ -33,7 +35,7 @@ fn test_transaction_db_memory_usage() {
3335
options.enable_statistics();
3436

3537
// setup cache:
36-
let cache = rocksdb::Cache::new_lru_cache(1 << 20); // 1 MB cache
38+
let cache = rocksdb::Cache::new_lru_cache(1 << 20).unwrap(); // 1 MB cache
3739
let mut block_based_options = rocksdb::BlockBasedOptions::default();
3840
block_based_options.set_block_cache(&cache);
3941
options.set_block_based_table_factory(&block_based_options);

Diff for: tests/test_transaction_db_property.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
mod util;
1616

17+
use haizhi_rocksdb as rocksdb;
18+
1719
use pretty_assertions::assert_eq;
1820

1921
use rocksdb::{properties, Options, TransactionDB, TransactionDBOptions};

Diff for: tests/util/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::{
88
};
99

1010
use rocksdb::{Error, Options, DB};
11-
use std::path::{Path, PathBuf};
1211

1312
/// Temporary database path which calls DB::Destroy when DBPath is dropped.
1413
pub struct DBPath {

0 commit comments

Comments
 (0)