8000 Support no-compression on rocksdb for Windows by cpuchainorg · Pull Request #1259 · trezor/blockbook · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support no-compression on rocksdb for Windows #1259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion db/dboptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package db

// #include "rocksdb/c.h"
import "C"
import "flag"
import "github.com/linxGnu/grocksdb"

/*
Expand Down Expand Up @@ -38,6 +39,10 @@ func boolToChar(b bool) C.uchar {
7553 }
*/

var (
noCompression = flag.Bool("noCompression", false, "disable rocksdb compression when rocksdb library can't find compression library linked with binary")
)

func createAndSetDBOptions(bloomBits int, c *grocksdb.Cache, maxOpenFiles int) *grocksdb.Options {
blockOpts := grocksdb.NewDefaultBlockBasedTableOptions()
blockOpts.SetBlockSize(32 << 10) // 32kB
Expand All @@ -57,6 +62,11 @@ func createAndSetDBOptions(bloomBits int, c *grocksdb.Cache, maxOpenFiles int) *
opts.SetWriteBufferSize(1 << 27) // 128MB
opts.SetMaxBytesForLevelBase(1 << 27) // 128MB
opts.SetMaxOpenFiles(maxOpenFiles)
opts.SetCompression(grocksdb.LZ4HCCompression)
if *noCompression {
// resolve error rocksDB: Invalid argument: Compression type LZ4HC is not linked with the binary
opts.SetCompression(grocksdb.NoCompression)
} else {
opts.SetCompression(grocksdb.LZ4HCCompression)
}
return opts
}
0