mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Redo how WAL/logs are limited by the DB
Adds a patch to the latest rocksdb.
This commit is contained in:
37
Cargo.lock
generated
37
Cargo.lock
generated
@@ -445,17 +445,16 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bindgen"
|
name = "bindgen"
|
||||||
version = "0.65.1"
|
version = "0.69.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
|
checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.4.2",
|
||||||
"cexpr",
|
"cexpr",
|
||||||
"clang-sys",
|
"clang-sys",
|
||||||
|
"itertools",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lazycell",
|
"lazycell",
|
||||||
"peeking_take_while",
|
|
||||||
"prettyplease 0.2.16",
|
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex",
|
"regex",
|
||||||
@@ -2954,7 +2953,7 @@ dependencies = [
|
|||||||
"httpdate",
|
"httpdate",
|
||||||
"itoa",
|
"itoa",
|
||||||
"pin-project-lite 0.2.13",
|
"pin-project-lite 0.2.13",
|
||||||
"socket2 0.4.10",
|
"socket2 0.5.5",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -3423,7 +3422,7 @@ dependencies = [
|
|||||||
"num_cpus",
|
"num_cpus",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
"regex",
|
"regex",
|
||||||
"rocksdb",
|
"rocksdb 0.21.0",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3938,9 +3937,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "librocksdb-sys"
|
name = "librocksdb-sys"
|
||||||
version = "0.11.0+8.1.1"
|
version = "0.16.0+8.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e"
|
checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"bzip2-sys",
|
"bzip2-sys",
|
||||||
@@ -3950,6 +3949,7 @@ dependencies = [
|
|||||||
"libz-sys",
|
"libz-sys",
|
||||||
"lz4-sys",
|
"lz4-sys",
|
||||||
"tikv-jemalloc-sys",
|
"tikv-jemalloc-sys",
|
||||||
|
"zstd-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4759,7 +4759,7 @@ version = "0.7.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
|
checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate 1.3.1",
|
"proc-macro-crate 3.1.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.52",
|
"syn 2.0.52",
|
||||||
@@ -5179,12 +5179,6 @@ dependencies = [
|
|||||||
"sha2",
|
"sha2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "peeking_take_while"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pem"
|
name = "pem"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
@@ -5986,8 +5980,15 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "rocksdb"
|
name = "rocksdb"
|
||||||
version = "0.21.0"
|
version = "0.21.0"
|
||||||
|
dependencies = [
|
||||||
|
"rocksdb 0.22.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rocksdb"
|
||||||
|
version = "0.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe"
|
checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"librocksdb-sys",
|
"librocksdb-sys",
|
||||||
@@ -7468,7 +7469,7 @@ name = "serai-db"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-db",
|
"parity-db",
|
||||||
"rocksdb",
|
"rocksdb 0.21.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ resolver = "2"
|
|||||||
members = [
|
members = [
|
||||||
# Version patches
|
# Version patches
|
||||||
"patches/zstd",
|
"patches/zstd",
|
||||||
|
"patches/rocksdb",
|
||||||
"patches/proc-macro-crate",
|
"patches/proc-macro-crate",
|
||||||
|
|
||||||
# std patches
|
# std patches
|
||||||
@@ -112,6 +113,8 @@ dockertest = { git = "https://github.com/kayabaNerve/dockertest-rs", branch = "a
|
|||||||
|
|
||||||
# wasmtime pulls in an old version for this
|
# wasmtime pulls in an old version for this
|
||||||
zstd = { path = "patches/zstd" }
|
zstd = { path = "patches/zstd" }
|
||||||
|
# Needed for WAL compression
|
||||||
|
rocksdb = { path = "patches/rocksdb" }
|
||||||
# proc-macro-crate 2 binds to an old version of toml for msrv so we patch to 3
|
# proc-macro-crate 2 binds to an old version of toml for msrv so we patch to 3
|
||||||
proc-macro-crate = { path = "patches/proc-macro-crate" }
|
proc-macro-crate = { path = "patches/proc-macro-crate" }
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ workspace = true
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
parity-db = { version = "0.4", default-features = false, optional = true }
|
parity-db = { version = "0.4", default-features = false, optional = true }
|
||||||
rocksdb = { version = "0.21", default-features = false, features = ["lz4"], optional = true }
|
rocksdb = { version = "0.21", default-features = false, features = ["zstd"], optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
parity-db = ["dep:parity-db"]
|
parity-db = ["dep:parity-db"]
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use rocksdb::{DBCompressionType, ThreadMode, SingleThreaded, Options, Transaction, TransactionDB};
|
use rocksdb::{
|
||||||
|
DBCompressionType, ThreadMode, SingleThreaded, LogLevel, Options, Transaction, TransactionDB,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
@@ -37,13 +39,16 @@ pub type RocksDB = Arc<TransactionDB<SingleThreaded>>;
|
|||||||
pub fn new_rocksdb(path: &str) -> RocksDB {
|
pub fn new_rocksdb(path: &str) -> RocksDB {
|
||||||
let mut options = Options::default();
|
let mut options = Options::default();
|
||||||
options.create_if_missing(true);
|
options.create_if_missing(true);
|
||||||
options.set_compression_type(DBCompressionType::Lz4);
|
options.set_compression_type(DBCompressionType::Zstd);
|
||||||
options.set_wal_size_limit_mb(128);
|
|
||||||
// 1 GB
|
|
||||||
options.set_max_total_wal_size(1 << 30);
|
|
||||||
// 128 MB
|
// 128 MB
|
||||||
options.set_max_log_file_size(1 << 27);
|
options.set_wal_compression_type(DBCompressionType::Zstd);
|
||||||
options.set_recycle_log_file_num(5);
|
options.set_max_total_wal_size(128 * 1024 * 1024);
|
||||||
options.set_keep_log_file_num(5);
|
|
||||||
|
// 1 MB
|
||||||
|
options.set_log_level(LogLevel::Warn);
|
||||||
|
options.set_max_log_file_size(1024 * 1024);
|
||||||
|
options.set_recycle_log_file_num(1);
|
||||||
|
|
||||||
Arc::new(TransactionDB::open(&options, &Default::default(), path).unwrap())
|
Arc::new(TransactionDB::open(&options, &Default::default(), path).unwrap())
|
||||||
}
|
}
|
||||||
|
|||||||
26
patches/rocksdb/Cargo.toml
Normal file
26
patches/rocksdb/Cargo.toml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[package]
|
||||||
|
name = "rocksdb"
|
||||||
|
version = "0.21.0"
|
||||||
|
description = "rocksdb which patches to the latest update"
|
||||||
|
license = "MIT"
|
||||||
|
repository = "https://github.com/serai-dex/serai/tree/develop/patches/rocksdb"
|
||||||
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
|
keywords = []
|
||||||
|
edition = "2021"
|
||||||
|
rust-version = "1.70"
|
||||||
|
|
||||||
|
[package.metadata.docs.rs]
|
||||||
|
all-features = true
|
||||||
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rocksdb = { version = "0.22", default-features = false }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
jemalloc = ["rocksdb/jemalloc"]
|
||||||
|
snappy = ["rocksdb/snappy"]
|
||||||
|
lz4 = ["rocksdb/lz4"]
|
||||||
|
zstd = ["rocksdb/zstd"]
|
||||||
|
zlib = ["rocksdb/zlib"]
|
||||||
|
bzip2 = ["rocksdb/bzip2"]
|
||||||
|
default = ["snappy", "lz4", "zstd", "zlib", "bzip2"]
|
||||||
1
patches/rocksdb/src/lib.rs
Normal file
1
patches/rocksdb/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pub use rocksdb::*;
|
||||||
Reference in New Issue
Block a user