Commit e0fb1138 authored by Rich Prohaska's avatar Rich Prohaska

#122 change default compression to zlib and add a session variable to control...

#122 change default compression to zlib and add a session variable to control create info row format
parent dc00dfd7
......@@ -6474,9 +6474,7 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
DBUG_RETURN(to);
}
static inline enum row_type
compression_method_to_row_type(enum toku_compression_method method)
{
static inline enum row_type compression_method_to_row_type(enum toku_compression_method method) {
switch (method) {
#if TOKU_INCLUDE_ROW_TYPE_COMPRESSION
case TOKU_NO_COMPRESSION:
......@@ -6500,28 +6498,22 @@ compression_method_to_row_type(enum toku_compression_method method)
}
}
static enum row_type
get_row_type_for_key(DB *file)
{
static enum row_type get_row_type_for_key(DB *file) {
enum toku_compression_method method;
int r = file->get_compression_method(file, &method);
assert(r == 0);
return compression_method_to_row_type(method);
}
enum row_type
#if MYSQL_VERSION_ID >= 50521
ha_tokudb::get_row_type(void) const
enum row_type ha_tokudb::get_row_type(void) const {
#else
ha_tokudb::get_row_type(void)
enum row_thype ha_tokudb::get_row_type(void) {
#endif
{
return get_row_type_for_key(share->file);
}
static inline enum toku_compression_method
row_type_to_compression_method(enum row_type type)
{
static inline enum toku_compression_method row_type_to_compression_method(enum row_type type) {
switch (type) {
#if TOKU_INCLUDE_ROW_TYPE_COMPRESSION
case ROW_TYPE_TOKU_UNCOMPRESSED:
......@@ -6538,9 +6530,9 @@ row_type_to_compression_method(enum row_type type)
return TOKU_FAST_COMPRESSION_METHOD;
#endif
default:
DBUG_PRINT("info", ("Ignoring ROW_FORMAT not used by TokuDB, using TOKUDB_FAST by default instead"));
DBUG_PRINT("info", ("Ignoring ROW_FORMAT not used by TokuDB, using TOKUDB_ZLIB by default instead"));
case ROW_TYPE_DEFAULT:
return TOKU_DEFAULT_COMPRESSION_METHOD;
return TOKU_ZLIB_WITHOUT_CHECKSUM_METHOD;
}
}
......@@ -6622,6 +6614,9 @@ void ha_tokudb::update_create_info(HA_CREATE_INFO* create_info) {
// show create table asks us to update this create_info, this makes it
// so we'll always show what compression type we're using
create_info->row_type = get_row_type();
if (create_info->row_type == ROW_TYPE_TOKU_ZLIB && THDVAR(ha_thd(), hide_default_row_format) != 0) {
create_info->row_type = ROW_TYPE_DEFAULT;
}
}
}
......@@ -6921,9 +6916,7 @@ int ha_tokudb::create_main_dictionary(const char* name, TABLE* form, DB_TXN* txn
return error;
}
static inline enum row_type
row_format_to_row_type(srv_row_format_t row_format)
{
static inline enum row_type row_format_to_row_type(srv_row_format_t row_format) {
#if TOKU_INCLUDE_ROW_TYPE_COMPRESSION
switch (row_format) {
case SRV_ROW_FORMAT_UNCOMPRESSED:
......@@ -6943,7 +6936,7 @@ row_format_to_row_type(srv_row_format_t row_format)
}
assert(0);
#endif
return ROW_TYPE_DEFAULT;;
return ROW_TYPE_DEFAULT;
}
//
......
......@@ -1309,6 +1309,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(last_lock_timeout),
MYSQL_SYSVAR(lock_timeout_debug),
MYSQL_SYSVAR(loader_memory_size),
MYSQL_SYSVAR(hide_default_row_format),
NULL
};
......
......@@ -329,7 +329,7 @@ static MYSQL_THDVAR_ENUM(row_format, PLUGIN_VAR_OPCMDARG,
"Specifies the compression method for a table during this session. "
"Possible values are TOKUDB_UNCOMPRESSED, TOKUDB_ZLIB, TOKUDB_QUICKLZ, "
"TOKUDB_LZMA, TOKUDB_FAST, TOKUDB_SMALL and TOKUDB_DEFAULT",
NULL, NULL, SRV_ROW_FORMAT_DEFAULT, &tokudb_row_format_typelib);
NULL, NULL, SRV_ROW_FORMAT_ZLIB, &tokudb_row_format_typelib);
static srv_row_format_t get_row_format(THD *thd) {
return (srv_row_format_t) THDVAR(thd, row_format);
......@@ -339,6 +339,8 @@ static MYSQL_THDVAR_UINT(lock_timeout_debug, 0, "TokuDB lock timeout debug", NUL
static MYSQL_THDVAR_STR(last_lock_timeout, PLUGIN_VAR_MEMALLOC, "last TokuDB lock timeout", NULL /*check*/, NULL /*update*/, NULL /*default*/);
static MYSQL_THDVAR_BOOL(hide_default_row_format, 0, "hide the default row format", NULL /*check*/, NULL /*update*/, false);
extern HASH tokudb_open_tables;
extern pthread_mutex_t tokudb_mutex;
extern pthread_mutex_t tokudb_meta_mutex;
......
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