Commit 8406f1dc authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2614], make tokudb_prelock_empty a session variable

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@20227 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6b512e3b
...@@ -2850,7 +2850,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) { ...@@ -2850,7 +2850,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
ai_metadata_update_required = false; ai_metadata_update_required = false;
abort_loader = false; abort_loader = false;
if (share->try_table_lock) { if (share->try_table_lock) {
if (tokudb_prelock_empty && may_table_be_empty()) { if (get_prelock_empty(thd) && may_table_be_empty()) {
if (using_ignore || get_load_save_space(thd)) { if (using_ignore || get_load_save_space(thd)) {
acquire_table_lock(transaction, lock_write); acquire_table_lock(transaction, lock_write);
} }
......
...@@ -91,6 +91,13 @@ static MYSQL_THDVAR_BOOL(load_save_space, ...@@ -91,6 +91,13 @@ static MYSQL_THDVAR_BOOL(load_save_space,
NULL, NULL,
FALSE FALSE
); );
static MYSQL_THDVAR_BOOL(prelock_empty,
0,
"Tokudb Prelock Empty Table",
NULL,
NULL,
TRUE
);
static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer); static void tokudb_print_error(const DB_ENV * db_env, const char *db_errpfx, const char *buffer);
...@@ -144,7 +151,6 @@ static const int tokudb_hton_name_length = sizeof(tokudb_hton_name) - 1; ...@@ -144,7 +151,6 @@ static const int tokudb_hton_name_length = sizeof(tokudb_hton_name) - 1;
static u_int32_t tokudb_checkpointing_period; static u_int32_t tokudb_checkpointing_period;
u_int32_t tokudb_write_status_frequency; u_int32_t tokudb_write_status_frequency;
u_int32_t tokudb_read_status_frequency; u_int32_t tokudb_read_status_frequency;
my_bool tokudb_prelock_empty;
#ifdef TOKUDB_VERSION #ifdef TOKUDB_VERSION
char *tokudb_version = (char*) TOKUDB_VERSION; char *tokudb_version = (char*) TOKUDB_VERSION;
#else #else
...@@ -497,6 +503,9 @@ bool get_load_save_space(THD* thd) { ...@@ -497,6 +503,9 @@ bool get_load_save_space(THD* thd) {
return (THDVAR(thd, load_save_space) != 0); return (THDVAR(thd, load_save_space) != 0);
} }
bool get_prelock_empty(THD* thd) {
return (THDVAR(thd, prelock_empty) != 0);
}
typedef struct txn_progress_info { typedef struct txn_progress_info {
char status[200]; char status[200];
...@@ -1179,7 +1188,6 @@ static MYSQL_SYSVAR_STR(version, tokudb_version, PLUGIN_VAR_READONLY, "TokuDB Ve ...@@ -1179,7 +1188,6 @@ static MYSQL_SYSVAR_STR(version, tokudb_version, PLUGIN_VAR_READONLY, "TokuDB Ve
static MYSQL_SYSVAR_UINT(init_flags, tokudb_init_flags, PLUGIN_VAR_READONLY, "Sets TokuDB DB_ENV->open flags", NULL, NULL, tokudb_init_flags, 0, ~0, 0); static MYSQL_SYSVAR_UINT(init_flags, tokudb_init_flags, PLUGIN_VAR_READONLY, "Sets TokuDB DB_ENV->open flags", NULL, NULL, tokudb_init_flags, 0, ~0, 0);
static MYSQL_SYSVAR_UINT(checkpointing_period, tokudb_checkpointing_period, 0, "TokuDB Checkpointing period", NULL, NULL, 60, 0, ~0L, 0); static MYSQL_SYSVAR_UINT(checkpointing_period, tokudb_checkpointing_period, 0, "TokuDB Checkpointing period", NULL, NULL, 60, 0, ~0L, 0);
static MYSQL_SYSVAR_BOOL(prelock_empty, tokudb_prelock_empty, 0, "Tokudb Prelock Empty Table", NULL, NULL, TRUE);
static MYSQL_SYSVAR_UINT(write_status_frequency, tokudb_write_status_frequency, 0, "TokuDB frequency that show processlist updates status of writes", NULL, NULL, 1000, 0, ~0L, 0); static MYSQL_SYSVAR_UINT(write_status_frequency, tokudb_write_status_frequency, 0, "TokuDB frequency that show processlist updates status of writes", NULL, NULL, 1000, 0, ~0L, 0);
static MYSQL_SYSVAR_UINT(read_status_frequency, tokudb_read_status_frequency, 0, "TokuDB frequency that show processlist updates status of reads", NULL, NULL, 10000, 0, ~0L, 0); static MYSQL_SYSVAR_UINT(read_status_frequency, tokudb_read_status_frequency, 0, "TokuDB frequency that show processlist updates status of reads", NULL, NULL, 10000, 0, ~0L, 0);
static MYSQL_SYSVAR_INT(fs_reserve_percent, tokudb_fs_reserve_percent, PLUGIN_VAR_READONLY, "TokuDB file system space reserve (percent free required)", NULL, NULL, 5, 0, 100, 0); static MYSQL_SYSVAR_INT(fs_reserve_percent, tokudb_fs_reserve_percent, PLUGIN_VAR_READONLY, "TokuDB file system space reserve (percent free required)", NULL, NULL, 5, 0, 100, 0);
......
...@@ -15,11 +15,11 @@ ulonglong get_write_lock_wait_time (THD* thd); ...@@ -15,11 +15,11 @@ ulonglong get_write_lock_wait_time (THD* thd);
ulonglong get_read_lock_wait_time (THD* thd); ulonglong get_read_lock_wait_time (THD* thd);
uint get_pk_insert_mode(THD* thd); uint get_pk_insert_mode(THD* thd);
bool get_load_save_space(THD* thd); bool get_load_save_space(THD* thd);
bool get_prelock_empty(THD* thd);
extern HASH tokudb_open_tables; extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex; extern pthread_mutex_t tokudb_mutex;
extern pthread_mutex_t tokudb_meta_mutex; extern pthread_mutex_t tokudb_meta_mutex;
extern my_bool tokudb_prelock_empty;
extern u_int32_t tokudb_write_status_frequency; extern u_int32_t tokudb_write_status_frequency;
extern u_int32_t tokudb_read_status_frequency; extern u_int32_t tokudb_read_status_frequency;
#endif //#ifdef _HATOKU_HTON #endif //#ifdef _HATOKU_HTON
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