diff --git a/Cargo.lock b/Cargo.lock index a99057e5..cd8c442d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -434,6 +434,7 @@ dependencies = [ "page_size 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)", "rocksdb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1183,6 +1184,15 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rocksdb" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "librocksdb-sys 6.6.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rocksdb" version = "0.13.0" @@ -1869,6 +1879,7 @@ dependencies = [ "checksum regex 1.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048" "checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum rocksdb 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d65bee9fe606c76fd90d6cc33b86bdafde0981b8a6b2d190ec1267e0d065baf8" "checksum rocksdb 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12069b106981c6103d3eab7dd1c86751482d0779a520b7c14954c8b586c1e643" "checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" diff --git a/Cargo.toml b/Cargo.toml index a00c8f4a..3bfb15a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,9 @@ readme = "README.md" edition = "2018" [features] -default = [] +default = [ "rocksdb" ] liquid = ["elements", "lazy_static"] +oldcpu = [ "rocksdb-oldcpu" ] [dependencies] arraydeque = "0.4" @@ -39,7 +40,8 @@ num_cpus = "1.12.0" page_size = "0.4.2" prometheus = "0.7" rayon = "1.3.0" -rocksdb = "0.13.0" +rocksdb = { version = "0.13.0", optional = true } +rocksdb-oldcpu = { version = "0.12.4", optional = true, package = "rocksdb" } rust-crypto = "0.2" serde = "1.0.104" serde_derive = "1.0.104" diff --git a/src/lib.rs b/src/lib.rs index c758ed94..83eacb82 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,7 +17,6 @@ extern crate num_cpus; extern crate page_size; extern crate prometheus; extern crate rayon; -extern crate rocksdb; extern crate serde; extern crate stderrlog; extern crate sysconf; @@ -25,6 +24,12 @@ extern crate time; extern crate tiny_http; extern crate url; +// See https://github.com/romanz/electrs/issues/193 & https://github.com/rust-rocksdb/rust-rocksdb/issues/327 +#[cfg(not(feature = "oldcpu"))] +extern crate rocksdb; +#[cfg(feature = "oldcpu")] +extern crate rocksdb_oldcpu as rocksdb; + #[macro_use] extern crate chan; #[macro_use]