Skip to content

Commit

Permalink
Adding support for ZSTD compression in MyRocks
Browse files Browse the repository at this point in the history
Summary:
This diff optionally links ZSTD compression library.
If not specified in build option, ZSTD is not linked and it
doesn't stop with warnings/errors even if ZSTD does not exist.

Differential Revision: https://reviews.facebook.net/D52107

fbshipit-source-id: 0512d8dba83
  • Loading branch information
yoshinorim authored and inikep committed Sep 2, 2021
1 parent de5eb85 commit 1c8f727
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mysql-test/suite/rocksdb/r/compression_zstd.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
create table t (id int primary key) engine=rocksdb;
drop table t;
1 change: 1 addition & 0 deletions mysql-test/suite/rocksdb/t/compression_zstd-master.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--rocksdb_default_cf_options=compression_per_level=kZSTDNotFinalCompression;compression_opts=-14:4:0
4 changes: 4 additions & 0 deletions mysql-test/suite/rocksdb/t/compression_zstd.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--source include/have_rocksdb.inc

create table t (id int primary key) engine=rocksdb;
drop table t;
6 changes: 6 additions & 0 deletions storage/rocksdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ ELSE()
SET(rocksdb_static_libs ${rocksdb_static_libs} bz2)
ENDIF()

# link ZSTD only if instructed
IF (NOT "$ENV{WITH_ZSTD}" STREQUAL "")
SET(rocksdb_static_libs ${rocksdb_static_libs} $ENV{WITH_ZSTD}/lib/libzstd.a)
ADD_DEFINITIONS(-DZSTD)
ENDIF()

SET(rocksdb_static_libs ${rocksdb_static_libs} ${ZLIB_LIBRARY})

MYSQL_ADD_PLUGIN(rocksdb_se ${ROCKSDB_SOURCES} STORAGE_ENGINE DEFAULT STATIC_ONLY
Expand Down

0 comments on commit 1c8f727

Please sign in to comment.