Commit e370d0a9 authored by Sergei Petrunia's avatar Sergei Petrunia

MariaRocks port: Make rocksdb.compression_zstd test skip itself when ZSTD is not supported

- Introduce @@rocksdb_supported_compression_types read-only variable.
  It has a comma-separated list of compiled-in compression algorithms.

- Make rocksdb.compression_zstd test skip itself when ZSTD support
  is not compiled in
parent 75f00a33
......@@ -419,6 +419,9 @@ static uint32_t rocksdb_table_stats_sampling_pct;
static my_bool rocksdb_enable_bulk_load_api= 1;
static my_bool rpl_skip_tx_api_var= 0;
char *compression_types_val=
const_cast<char*>(get_rocksdb_supported_compression_types());
std::atomic<uint64_t> rocksdb_snapshot_conflict_errors(0);
static rocksdb::DBOptions rdb_init_rocksdb_db_options(void)
......@@ -1107,6 +1110,13 @@ static MYSQL_SYSVAR_STR(datadir,
"RocksDB data directory",
nullptr, nullptr, "./.rocksdb");
static MYSQL_SYSVAR_STR(supported_compression_types,
compression_types_val,
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
"Compression algorithms supported by RocksDB",
nullptr, nullptr,
compression_types_val);
static MYSQL_SYSVAR_UINT(
table_stats_sampling_pct,
rocksdb_table_stats_sampling_pct,
......@@ -1228,6 +1238,7 @@ static struct st_mysql_sys_var* rocksdb_system_variables[]= {
MYSQL_SYSVAR(compaction_sequential_deletes_count_sd),
MYSQL_SYSVAR(datadir),
MYSQL_SYSVAR(supported_compression_types),
MYSQL_SYSVAR(create_checkpoint),
MYSQL_SYSVAR(checksums_pct),
......
--rocksdb_default_cf_options=compression_per_level=kZSTDNotFinalCompression;compression_opts=-14:4:0
--source include/have_rocksdb.inc
let $no_zstd=`select @@rocksdb_supported_compression_types NOT LIKE '%ZSTD%'`;
if ($no_zstd)
{
-- Skip Requires RocksDB to be built with ZStandard Compression support
}
--let $_mysqld_option=--rocksdb_default_cf_options=compression_per_level=kZSTDNotFinalCompression;compression_opts=-14:4:0;
--source include/restart_mysqld_with_option.inc
create table t (id int primary key) engine=rocksdb;
drop table t;
......@@ -29,6 +29,17 @@
/* MyRocks header files */
#include "./ha_rocksdb.h"
/*
Both innobase/include/ut0counter.h and rocksdb/port/port_posix.h define
CACHE_LINE_SIZE.
*/
#ifdef CACHE_LINE_SIZE
# undef CACHE_LINE_SIZE
#endif
/* RocksDB header files */
#include "util/compression.h"
namespace myrocks {
/*
......@@ -310,4 +321,41 @@ bool rdb_database_exists(const std::string& db_name)
return true;
}
/*
@brief
Return a comma-separated string with compiled-in compression types.
Not thread-safe.
*/
const char *get_rocksdb_supported_compression_types()
{
static std::string compression_methods_buf;
static bool inited=false;
if (!inited)
{
inited= true;
std::vector<rocksdb::CompressionType> known_types=
{
rocksdb::kSnappyCompression,
rocksdb::kZlibCompression,
rocksdb::kBZip2Compression,
rocksdb::kLZ4Compression,
rocksdb::kLZ4HCCompression,
rocksdb::kXpressCompression,
rocksdb::kZSTDNotFinalCompression
};
for (auto typ : known_types)
{
if (CompressionTypeSupported(typ))
{
if (compression_methods_buf.size())
compression_methods_buf.append(",");
compression_methods_buf.append(CompressionTypeToString(typ));
}
}
}
return compression_methods_buf.c_str();
}
} // namespace myrocks
......@@ -205,4 +205,6 @@ std::string rdb_hexdump(const char *data, std::size_t data_len,
*/
bool rdb_database_exists(const std::string& db_name);
const char *get_rocksdb_supported_compression_types();
} // namespace myrocks
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment