Don't set default compression as it forces us to require the compression library when linking or at runtime. Let RocksBb pick the best default. (#41)

This commit is contained in:
web3-developer 2024-03-30 00:26:12 +08:00 committed by GitHub
parent 90027f1875
commit f37d7d486c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 10 deletions

View File

@ -35,7 +35,7 @@ proc setCreateMissingColumnFamilies*(cfOpts: ColFamilyOptionsRef, flag: bool) =
proc defaultColFamilyOptions*(): ColFamilyOptionsRef = proc defaultColFamilyOptions*(): ColFamilyOptionsRef =
let opts = newColFamilyOptions() let opts = newColFamilyOptions()
rocksdb_options_set_compression(opts.cPtr, rocksdb_lz4_compression) # rocksdb_options_set_compression(opts.cPtr, rocksdb_lz4_compression)
# rocksdb_options_set_bottommost_compression(opts.cPtr, rocksdb_zstd_compression) # rocksdb_options_set_bottommost_compression(opts.cPtr, rocksdb_zstd_compression)
# Enable creating column families if they do not exist # Enable creating column families if they do not exist

View File

@ -120,16 +120,13 @@ when defined(rocksdb_static_linking):
topLevelPath = currentSourcePath.parentDir().parentDir().parentDir() topLevelPath = currentSourcePath.parentDir().parentDir().parentDir()
libsDir = topLevelPath.replace('\\', '/') & "/build/lib" libsDir = topLevelPath.replace('\\', '/') & "/build/lib"
when defined(windows):
{.passL: "-lshlwapi -lrpcrt4".}
{.passL: libsDir & "/rocksdb.lib".}
{.passL: libsDir & "/lz4.lib".}
{.passL: libsDir & "/zstd.lib".}
else:
{.passL: libsDir & "/librocksdb.a".} {.passL: libsDir & "/librocksdb.a".}
{.passL: libsDir & "/liblz4.a".} {.passL: libsDir & "/liblz4.a".}
{.passL: libsDir & "/libzstd.a".} {.passL: libsDir & "/libzstd.a".}
when defined(windows):
{.passL: "-lshlwapi -lrpcrt4".}
else: else:
when shouldUseNativeLinking(): when shouldUseNativeLinking():
{.pragma: importrocks, importc, cdecl.} {.pragma: importrocks, importc, cdecl.}

View File

@ -32,7 +32,7 @@ proc cPtr*(engineOpts: BackupEngineOptionsRef): BackupEngineOptionsPtr =
proc defaultBackupEngineOptions*(): BackupEngineOptionsRef {.inline.} = proc defaultBackupEngineOptions*(): BackupEngineOptionsRef {.inline.} =
let opts = newBackupEngineOptions() let opts = newBackupEngineOptions()
rocksdb_options_set_compression(opts.cPtr, rocksdb_lz4_compression) # rocksdb_options_set_compression(opts.cPtr, rocksdb_lz4_compression)
# rocksdb_options_set_bottommost_compression(opts.cPtr, rocksdb_zstd_compression) # rocksdb_options_set_bottommost_compression(opts.cPtr, rocksdb_zstd_compression)
opts opts

View File

@ -50,7 +50,7 @@ proc setCreateMissingColumnFamilies*(dbOpts: DbOptionsRef, flag: bool) =
proc defaultDbOptions*(): DbOptionsRef = proc defaultDbOptions*(): DbOptionsRef =
let opts: DbOptionsRef = newDbOptions() let opts: DbOptionsRef = newDbOptions()
rocksdb_options_set_compression(opts.cPtr, rocksdb_lz4_compression) # rocksdb_options_set_compression(opts.cPtr, rocksdb_lz4_compression)
# rocksdb_options_set_bottommost_compression(opts.cPtr, rocksdb_zstd_compression) # rocksdb_options_set_bottommost_compression(opts.cPtr, rocksdb_zstd_compression)
# Optimize RocksDB. This is the easiest way to get RocksDB to perform well: # Optimize RocksDB. This is the easiest way to get RocksDB to perform well: