Skip to content

Commit

Permalink
Merge branch 'master' into rocksdict
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Dec 14, 2023
2 parents f788b75 + 66f04df commit fc0e8c3
Show file tree
Hide file tree
Showing 12 changed files with 390 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ serde1 = ["serde"]

[dependencies]
libc = "0.2"
librocksdb-sys = { path = "librocksdb-sys", version = "0.13.0" }
librocksdb-sys = { path = "librocksdb-sys", version = "0.15.0" }
serde = { version = "1", features = [ "derive" ], optional = true }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions librocksdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "librocksdb-sys"
version = "0.13.0+8.6.7"
version = "0.15.0+8.9.1"
edition = "2018"
rust-version = "1.66.0"
authors = ["Karl Hobley <karlhobley10@gmail.com>", "Arkadiy Paronyan <arkadiy@ethcore.io>"]
Expand Down Expand Up @@ -38,6 +38,6 @@ uuid = { version = "1.0", features = ["v4"] }

[build-dependencies]
cc = { version = "1.0", features = ["parallel"] }
bindgen = { version = "0.68", default-features = false, features = ["runtime"] }
bindgen = { version = "0.69", default-features = false, features = ["runtime"] }
glob = "0.3"
pkg-config = { version = "0.3", optional = true }
6 changes: 3 additions & 3 deletions librocksdb-sys/build_version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

// The build script may replace these values with real values based
// on whether or not GIT is available and the platform settings
static const std::string rocksdb_build_git_sha = "cb7a5e02edeb883193eb5b4901d5943f58e9add9";
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:v8.6.7";
static const std::string rocksdb_build_git_sha = "49ce8a1064dd1ad89117899839bf136365e49e79";
static const std::string rocksdb_build_git_tag = "rocksdb_build_git_tag:v8.9.1";
#define HAS_GIT_CHANGES 0
#if HAS_GIT_CHANGES == 0
// If HAS_GIT_CHANGES is 0, the GIT date is used.
// Use the time the branch/tag was last modified
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-09-26 15:51:19";
static const std::string rocksdb_build_date = "rocksdb_build_date:2023-12-08 12:44:09";
#else
// If HAS_GIT_CHANGES is > 0, the branch/tag has modifications.
// Use the time the build was created.
Expand Down
2 changes: 1 addition & 1 deletion librocksdb-sys/rocksdb
Submodule rocksdb updated 157 files
1 change: 1 addition & 0 deletions librocksdb-sys/rocksdb_lib_sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ options/cf_options.cc
options/configurable.cc
options/customizable.cc
options/db_options.cc
options/offpeak_time_info.cc
options/options.cc
options/options_helper.cc
options/options_parser.cc
Expand Down
20 changes: 19 additions & 1 deletion src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
ColumnFamily, ColumnFamilyDescriptor, CompactOptions, DBIteratorWithThreadMode,
DBPinnableSlice, DBRawIteratorWithThreadMode, DBWALIterator, Direction, Error, FlushOptions,
IngestExternalFileOptions, IteratorMode, Options, ReadOptions, SnapshotWithThreadMode,
WriteBatch, WriteOptions, DEFAULT_COLUMN_FAMILY_NAME,
WaitForCompactOptions, WriteBatch, WriteOptions, DEFAULT_COLUMN_FAMILY_NAME,
};

use crate::ffi_util::CSlice;
Expand Down Expand Up @@ -1752,6 +1752,24 @@ impl<T: ThreadMode, D: DBInner> DBCommon<T, D> {
}
}

/// Wait for all flush and compactions jobs to finish. Jobs to wait include the
/// unscheduled (queued, but not scheduled yet).
///
/// NOTE: This may also never return if there's sufficient ongoing writes that
/// keeps flush and compaction going without stopping. The user would have to
/// cease all the writes to DB to make this eventually return in a stable
/// state. The user may also use timeout option in WaitForCompactOptions to
/// make this stop waiting and return when timeout expires.
pub fn wait_for_compact(&self, opts: &WaitForCompactOptions) -> Result<(), Error> {
unsafe {
ffi_try!(ffi::rocksdb_wait_for_compact(
self.inner.inner(),
opts.inner
));
}
Ok(())
}

pub fn set_options(&self, opts: &[(&str, &str)]) -> Result<(), Error> {
let copts = convert_options(opts)?;
let cnames: Vec<*const c_char> = copts.iter().map(|opt| opt.0.as_ptr()).collect();
Expand Down
14 changes: 9 additions & 5 deletions src/db_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,19 @@ impl<'a, D: DBAccess> DBRawIteratorWithThreadMode<'a, D> {

/// Seeks to the next key.
pub fn next(&mut self) {
unsafe {
ffi::rocksdb_iter_next(self.inner.as_ptr());
if self.valid() {
unsafe {
ffi::rocksdb_iter_next(self.inner.as_ptr());
}
}
}

/// Seeks to the previous key.
pub fn prev(&mut self) {
unsafe {
ffi::rocksdb_iter_prev(self.inner.as_ptr());
if self.valid() {
unsafe {
ffi::rocksdb_iter_prev(self.inner.as_ptr());
}
}
}

Expand Down Expand Up @@ -554,7 +558,7 @@ impl Iterator for DBWALIterator {

// if the initial sequence number is what was requested we skip it to
// only provide changes *after* it
if seq == self.start_seq_number {
while seq <= self.start_seq_number {
unsafe {
ffi::rocksdb_wal_iter_next(self.inner);
}
Expand Down
Loading

0 comments on commit fc0e8c3

Please sign in to comment.