Skip to content

Commit

Permalink
Don't set default compression as it forces us to require the compress…
Browse files Browse the repository at this point in the history
…ion library when linking or at runtime. Let RocksBb pick the best default.
  • Loading branch information
bhartnett committed Mar 29, 2024
1 parent 90027f1 commit 47d613d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion rocksdb/columnfamily/cfopts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ proc setCreateMissingColumnFamilies*(cfOpts: ColFamilyOptionsRef, flag: bool) =
proc defaultColFamilyOptions*(): ColFamilyOptionsRef =
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)

# Enable creating column families if they do not exist
Expand Down
11 changes: 4 additions & 7 deletions rocksdb/lib/librocksdb.nim
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,12 @@ when defined(rocksdb_static_linking):
topLevelPath = currentSourcePath.parentDir().parentDir().parentDir()
libsDir = topLevelPath.replace('\\', '/') & "/build/lib"

{.passL: libsDir & "/librocksdb.a".}
{.passL: libsDir & "/liblz4.a".}
{.passL: libsDir & "/libzstd.a".}

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 & "/liblz4.a".}
{.passL: libsDir & "/libzstd.a".}

else:
when shouldUseNativeLinking():
Expand Down
2 changes: 1 addition & 1 deletion rocksdb/options/backupopts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ proc cPtr*(engineOpts: BackupEngineOptionsRef): BackupEngineOptionsPtr =

proc defaultBackupEngineOptions*(): BackupEngineOptionsRef {.inline.} =
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)
opts

Expand Down
2 changes: 1 addition & 1 deletion rocksdb/options/dbopts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ proc setCreateMissingColumnFamilies*(dbOpts: DbOptionsRef, flag: bool) =
proc defaultDbOptions*(): DbOptionsRef =
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)

# Optimize RocksDB. This is the easiest way to get RocksDB to perform well:
Expand Down

0 comments on commit 47d613d

Please sign in to comment.