Skip to content
Permalink
Browse files

Fix assertion whitelist == nullptr for rocksdb_read_free_rpl_tables (#…

…887)

Summary:
It is valid for NULL to be passed in as an argument for
read_free_rpl_tables and skip_unique_check. Handle NULL arguments in
these functions by treating it as the default value.

Addresses #844
Pull Request resolved: #887

Differential Revision: D10392551

Pulled By: hermanlee

fbshipit-source-id: 18d2c0b
  • Loading branch information
hermanlee authored and facebook-github-bot committed Nov 21, 2018
1 parent 04d444a commit 274bad39f0c14aa4fbe5a90bcc320e9897a64e28
@@ -61,5 +61,7 @@ SET @@session.ROCKSDB_READ_FREE_RPL_TABLES = @start_session_value;
SELECT @@session.ROCKSDB_READ_FREE_RPL_TABLES;
@@session.ROCKSDB_READ_FREE_RPL_TABLES

SET GLOBAL ROCKSDB_READ_FREE_RPL_TABLES=NULL;
SET GLOBAL ROCKSDB_READ_FREE_RPL_TABLES=DEFAULT;
DROP TABLE valid_values;
DROP TABLE invalid_values;
@@ -61,5 +61,7 @@ SET @@session.ROCKSDB_SKIP_UNIQUE_CHECK_TABLES = @start_session_value;
SELECT @@session.ROCKSDB_SKIP_UNIQUE_CHECK_TABLES;
@@session.ROCKSDB_SKIP_UNIQUE_CHECK_TABLES
.*
SET GLOBAL ROCKSDB_SKIP_UNIQUE_CHECK_TABLES=NULL;
SET GLOBAL ROCKSDB_SKIP_UNIQUE_CHECK_TABLES=DEFAULT;
DROP TABLE valid_values;
DROP TABLE invalid_values;
@@ -11,5 +11,8 @@ CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam;
--let $session=1
--source ../include/rocksdb_sys_var.inc

SET GLOBAL ROCKSDB_READ_FREE_RPL_TABLES=NULL;
SET GLOBAL ROCKSDB_READ_FREE_RPL_TABLES=DEFAULT;

DROP TABLE valid_values;
DROP TABLE invalid_values;
@@ -11,5 +11,8 @@ CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam;
--let $session=1
--source ../include/rocksdb_sys_var.inc

SET GLOBAL ROCKSDB_SKIP_UNIQUE_CHECK_TABLES=NULL;
SET GLOBAL ROCKSDB_SKIP_UNIQUE_CHECK_TABLES=DEFAULT;

DROP TABLE valid_values;
DROP TABLE invalid_values;
@@ -806,10 +806,11 @@ static MYSQL_THDVAR_STR(tmpdir, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
"Directory for temporary files during DDL operations.",
nullptr, nullptr, "");

#define DEFAULT_SKIP_UNIQUE_CHECK_TABLES ".*"
static MYSQL_THDVAR_STR(
skip_unique_check_tables, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"Skip unique constraint checking for the specified tables", nullptr,
nullptr, ".*");
nullptr, DEFAULT_SKIP_UNIQUE_CHECK_TABLES);

static MYSQL_THDVAR_BOOL(
commit_in_the_middle, PLUGIN_VAR_RQCMDARG,
@@ -823,11 +824,12 @@ static MYSQL_THDVAR_BOOL(
" Blind delete is disabled if the table has secondary key",
nullptr, nullptr, FALSE);

#define DEFAULT_READ_FREE_RPL_TABLES ""
static MYSQL_THDVAR_STR(
read_free_rpl_tables, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"List of tables that will use read-free replication on the slave "
"(i.e. not lookup a row during replication)",
nullptr, nullptr, "");
nullptr, nullptr, DEFAULT_READ_FREE_RPL_TABLES);

static MYSQL_THDVAR_BOOL(skip_bloom_filter_on_read, PLUGIN_VAR_RQCMDARG,
"Skip using bloom filter for reads", nullptr, nullptr,
@@ -6448,31 +6450,32 @@ void ha_rocksdb::free_key_buffers() {
}

void ha_rocksdb::set_use_read_free_rpl(const char *const whitelist) {
DBUG_ASSERT(whitelist != nullptr);
const char *const wl = whitelist ? whitelist : DEFAULT_READ_FREE_RPL_TABLES;

#if defined(HAVE_PSI_INTERFACE)
Regex_list_handler regex_handler(key_rwlock_read_free_rpl_tables);
#else
Regex_list_handler regex_handler;
#endif

if (!regex_handler.set_patterns(whitelist)) {
if (!regex_handler.set_patterns(wl)) {
warn_about_bad_patterns(&regex_handler, "read_free_rpl_tables");
}

m_use_read_free_rpl = regex_handler.matches(m_tbl_def->base_tablename());
}

void ha_rocksdb::set_skip_unique_check_tables(const char *const whitelist) {
DBUG_ASSERT(whitelist != nullptr);
const char *const wl =
whitelist ? whitelist : DEFAULT_SKIP_UNIQUE_CHECK_TABLES;

#if defined(HAVE_PSI_INTERFACE)
Regex_list_handler regex_handler(key_rwlock_skip_unique_check_tables);
#else
Regex_list_handler regex_handler;
#endif

if (!regex_handler.set_patterns(whitelist)) {
if (!regex_handler.set_patterns(wl)) {
warn_about_bad_patterns(&regex_handler, "skip_unique_check_tables");
}

0 comments on commit 274bad3

Please sign in to comment.
You can’t perform that action at this time.