diff options
author | Will DeVries <wdevries@clustrix.com> | 2020-02-13 13:42:25 -0800 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2020-03-10 11:22:33 +0300 |
commit | ff60d07c84b84e010f7609a9b0606a6c31ce28a5 (patch) | |
tree | 1112bc90a12f95d3d311f9a964fafa4b323f2301 | |
parent | e176abf37eac4c9aace1cf1f3c34852564a99aab (diff) | |
download | mariadb-git-ff60d07c84b84e010f7609a9b0606a6c31ce28a5.tar.gz |
Fix more spacing issues and formatting issues.
-rw-r--r-- | storage/xpand/ha_xpand.cc | 97 | ||||
-rw-r--r-- | storage/xpand/ha_xpand_pushdown.cc | 69 | ||||
-rw-r--r-- | storage/xpand/ha_xpand_pushdown.h | 59 | ||||
-rw-r--r-- | storage/xpand/xpand_connection.cc | 31 |
4 files changed, 124 insertions, 132 deletions
diff --git a/storage/xpand/ha_xpand.cc b/storage/xpand/ha_xpand.cc index d19e117d1c8..3852bae1933 100644 --- a/storage/xpand/ha_xpand.cc +++ b/storage/xpand/ha_xpand.cc @@ -153,46 +153,46 @@ static MYSQL_THDVAR_UINT // Per thread select handler knob static MYSQL_THDVAR_BOOL( - select_handler, - PLUGIN_VAR_NOCMDARG, - "", - NULL, - NULL, - 1 + select_handler, + PLUGIN_VAR_NOCMDARG, + "", + NULL, + NULL, + 1 ); // Per thread derived handler knob static MYSQL_THDVAR_BOOL( - derived_handler, - PLUGIN_VAR_NOCMDARG, - "", - NULL, - NULL, - 1 + derived_handler, + PLUGIN_VAR_NOCMDARG, + "", + NULL, + NULL, + 1 ); static MYSQL_THDVAR_BOOL( - enable_direct_update, - PLUGIN_VAR_NOCMDARG, - "", - NULL, - NULL, - 1 + enable_direct_update, + PLUGIN_VAR_NOCMDARG, + "", + NULL, + NULL, + 1 ); bool select_handler_setting(THD* thd) { - return ( thd == NULL ) ? false : THDVAR(thd, select_handler); + return ( thd == NULL ) ? false : THDVAR(thd, select_handler); } bool derived_handler_setting(THD* thd) { - return ( thd == NULL ) ? false : THDVAR(thd, derived_handler); + return ( thd == NULL ) ? false : THDVAR(thd, derived_handler); } uint row_buffer_setting(THD* thd) { - return THDVAR(thd, row_buffer); + return THDVAR(thd, row_buffer); } /**************************************************************************** @@ -223,8 +223,8 @@ size_t estimate_row_size(TABLE *table) **/ static void decode_objectname(char *buf, const char *path, size_t buf_size) { - size_t new_path_len = filename_to_tablename(path, buf, buf_size); - buf[new_path_len] = '\0'; + size_t new_path_len = filename_to_tablename(path, buf, buf_size); + buf[new_path_len] = '\0'; } static void decode_file_path(const char *path, char *decoded_dbname, @@ -326,11 +326,11 @@ int ha_xpand::create(const char *name, TABLE *form, HA_CREATE_INFO *info) // To syncronize the schemas of MDB FE and XPD BE. if (form->s && form->s->db.length) { - String createdb_stmt; - createdb_stmt.append("CREATE DATABASE IF NOT EXISTS `"); - createdb_stmt.append(form->s->db.str, form->s->db.length); - createdb_stmt.append("`"); - trx->run_query(createdb_stmt); + String createdb_stmt; + createdb_stmt.append("CREATE DATABASE IF NOT EXISTS `"); + createdb_stmt.append(form->s->db.str, form->s->db.length); + createdb_stmt.append("`"); + trx->run_query(createdb_stmt); } error_code = trx->run_query(create_table_stmt); @@ -489,8 +489,7 @@ int ha_xpand::write_row(const uchar *buf) /* XXX: Xpand may needs to return HA_ERR_AUTOINC_ERANGE if we hit that error. */ ulonglong last_insert_id = 0; - if ((error_code = trx->write_row(xpand_table_oid, - packed_new_row, packed_size, + if ((error_code = trx->write_row(xpand_table_oid, packed_new_row, packed_size, &last_insert_id))) goto err; @@ -687,8 +686,7 @@ int ha_xpand::info(uint flag) if (stats.records == 0) stats.mean_rec_length = 0; else - stats.mean_rec_length = (ulong) - (stats.data_file_length / stats.records); + stats.mean_rec_length = (ulong) (stats.data_file_length / stats.records); } if (flag & HA_STATUS_CONST) @@ -780,8 +778,7 @@ int ha_xpand::index_read(uchar * buf, const uchar * key, uint key_len, table->read_set, packed_key, packed_key_len, &rowdata, &rowdata_length); if (!error_code) - error_code = unpack_row_to_buf(rgi, table, buf, rowdata, - table->read_set, + error_code = unpack_row_to_buf(rgi, table, buf, rowdata, table->read_set, rowdata + rowdata_length); } else { is_scan = true; @@ -790,7 +787,7 @@ int ha_xpand::index_read(uchar * buf, const uchar * key, uint key_len, &scan_fields, packed_key, packed_key_len, THDVAR(thd, row_buffer), &scan_cur); if (!error_code) - error_code = rnd_next(buf); + error_code = rnd_next(buf); } if (rowdata) @@ -1056,7 +1053,7 @@ int ha_xpand::external_lock(THD *thd, int lock_type) int error_code; xpand_connection *trx = get_trx(thd, &error_code); if (error_code) - DBUG_RETURN(error_code); + DBUG_RETURN(error_code); if (lock_type == F_WRLCK) xpd_lock_type = XPAND_EXCLUSIVE; @@ -1069,7 +1066,7 @@ int ha_xpand::external_lock(THD *thd, int lock_type) if (!trx->has_open_transaction()) { error_code = trx->begin_transaction_next(); if (error_code) - DBUG_RETURN(error_code); + DBUG_RETURN(error_code); } trans_register_ha(thd, FALSE, xpand_hton); @@ -1349,18 +1346,18 @@ static struct st_mysql_storage_engine xpand_storage_engine = maria_declare_plugin(xpand) { - MYSQL_STORAGE_ENGINE_PLUGIN, /* Plugin Type */ - &xpand_storage_engine, /* Plugin Descriptor */ - "XPAND", /* Plugin Name */ - "MariaDB", /* Plugin Author */ - "Xpand storage engine", /* Plugin Description */ - PLUGIN_LICENSE_GPL, /* Plugin Licence */ - xpand_init, /* Plugin Entry Point */ - xpand_deinit, /* Plugin Deinitializer */ - 0x0001, /* Hex Version Number (0.1) */ - NULL /* xpand_status_vars */, /* Status Variables */ - xpand_system_variables, /* System Variables */ - "0.1", /* String Version */ - MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* Maturity Level */ + MYSQL_STORAGE_ENGINE_PLUGIN, /* Plugin Type */ + &xpand_storage_engine, /* Plugin Descriptor */ + "XPAND", /* Plugin Name */ + "MariaDB", /* Plugin Author */ + "Xpand storage engine", /* Plugin Description */ + PLUGIN_LICENSE_GPL, /* Plugin Licence */ + xpand_init, /* Plugin Entry Point */ + xpand_deinit, /* Plugin Deinitializer */ + 0x0001, /* Hex Version Number (0.1) */ + NULL /* xpand_status_vars */, /* Status Variables */ + xpand_system_variables, /* System Variables */ + "0.1", /* String Version */ + MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* Maturity Level */ } maria_declare_plugin_end; diff --git a/storage/xpand/ha_xpand_pushdown.cc b/storage/xpand/ha_xpand_pushdown.cc index cd4291ce08e..de43d4bd75b 100644 --- a/storage/xpand/ha_xpand_pushdown.cc +++ b/storage/xpand/ha_xpand_pushdown.cc @@ -30,7 +30,8 @@ extern uint xpand_row_buffer; * metadata_size int or -1 in case of error ************************************************************/ int get_field_types(THD *thd, TABLE *table__, SELECT_LEX *sl, uchar *fieldtype, - uchar *field_metadata, uchar *null_bits, const int num_null_bytes, const uint fields_count) + uchar *field_metadata, uchar *null_bits, + const int num_null_bytes, const uint fields_count) { int field_metadata_size = 0; int metadata_index = 0; @@ -85,7 +86,6 @@ err: return field_metadata_size; } - /*@brief create_xpand_select_handler- Creates handler*/ /************************************************************ * DESCRIPTION: @@ -138,14 +138,15 @@ create_xpand_select_handler(THD* thd, SELECT_LEX* select_lex) &null_bits, num_null_bytes, &field_metadata, (items_number * 2), NULL); if (!meta_memory) { - // The only way to say something here is to raise warning - // b/c we will fallback to other access methods: derived handler or rowstore. - goto err; + // The only way to say something here is to raise warning + // b/c we will fallback to other access methods: derived handler or rowstore. + goto err; } if((field_metadata_size = - get_field_types(thd, NULL, select_lex, fieldtype, field_metadata, null_bits, num_null_bytes, items_number)) < 0) { - goto err; + get_field_types(thd, NULL, select_lex, fieldtype, field_metadata, + null_bits, num_null_bytes, items_number)) < 0) { + goto err; } trx = get_trx(thd, &error_code); @@ -199,20 +200,20 @@ ha_xpand_select_handler::ha_xpand_select_handler( **********************************************************/ ha_xpand_select_handler::~ha_xpand_select_handler() { - int error_code; - xpand_connection *trx = get_trx(thd, &error_code); - if (!trx) { - // TBD Log this - } - if (trx && scan) - trx->scan_end(scan); + int error_code; + xpand_connection *trx = get_trx(thd, &error_code); + if (!trx) { + // TBD Log this + } + if (trx && scan) + trx->scan_end(scan); - // If the ::init_scan has been executed - if (table__) - my_bitmap_free(&scan_fields); + // If the ::init_scan has been executed + if (table__) + my_bitmap_free(&scan_fields); - if (rgi) - remove_current_table_from_rpl_table_list(rgi); + if (rgi) + remove_current_table_from_rpl_table_list(rgi); } /*@brief Initiate the query for select_handler */ @@ -342,23 +343,20 @@ ha_xpand_derived_handler::ha_xpand_derived_handler( **********************************************************/ ha_xpand_derived_handler::~ha_xpand_derived_handler() { - int error_code; - - - - xpand_connection *trx = get_trx(thd, &error_code); - if (!trx) { - // TBD Log this. - } - if (trx && scan) - trx->scan_end(scan); + int error_code; + xpand_connection *trx = get_trx(thd, &error_code); + if (!trx) { + // TBD Log this. + } + if (trx && scan) + trx->scan_end(scan); - // If the ::init_scan has been executed - if (table__) - my_bitmap_free(&scan_fields); + // If the ::init_scan has been executed + if (table__) + my_bitmap_free(&scan_fields); - if (rgi) - remove_current_table_from_rpl_table_list(rgi); + if (rgi) + remove_current_table_from_rpl_table_list(rgi); } /*@brief Initiate the query for derived_handler */ @@ -395,7 +393,8 @@ int ha_xpand_derived_handler::init_scan() } if((field_metadata_size= - get_field_types(thd__, table, select, fieldtype, field_metadata, null_bits, num_null_bytes, items_number)) < 0) { + get_field_types(thd__, table, select, fieldtype, field_metadata, + null_bits, num_null_bytes, items_number)) < 0) { goto err; } diff --git a/storage/xpand/ha_xpand_pushdown.h b/storage/xpand/ha_xpand_pushdown.h index 8eb1e0dd0d8..c39d15f0b41 100644 --- a/storage/xpand/ha_xpand_pushdown.h +++ b/storage/xpand/ha_xpand_pushdown.h @@ -16,20 +16,20 @@ Copyright (c) 2019, MariaDB Corporation. class ha_xpand_base_handler { // To simulate abstract class - protected: - ha_xpand_base_handler(): thd__(0),table__(0) {} - ~ha_xpand_base_handler() {} +protected: + ha_xpand_base_handler(): thd__(0),table__(0) {} + ~ha_xpand_base_handler() {} - // Copies of pushdown handlers attributes - // to use them in shared methods. - THD *thd__; - TABLE *table__; - // The bitmap used to sent - MY_BITMAP scan_fields; - // Structures to unpack RBR rows from XPD BE - rpl_group_info *rgi; - // XPD BE scan operation reference - xpand_connection_cursor *scan; + // Copies of pushdown handlers attributes + // to use them in shared methods. + THD *thd__; + TABLE *table__; + // The bitmap used to sent + MY_BITMAP scan_fields; + // Structures to unpack RBR rows from XPD BE + rpl_group_info *rgi; + // XPD BE scan operation reference + xpand_connection_cursor *scan; }; /*@brief select_handler class*/ @@ -44,15 +44,15 @@ class ha_xpand_select_handler: private ha_xpand_base_handler, public select_handler { - public: - ha_xpand_select_handler(THD* thd_arg, SELECT_LEX* sel, - xpand_connection_cursor *scan); - ~ha_xpand_select_handler(); +public: + ha_xpand_select_handler(THD* thd_arg, SELECT_LEX* sel, + xpand_connection_cursor *scan); + ~ha_xpand_select_handler(); - int init_scan(); - int next_row(); - int end_scan(); - void print_error(int, unsigned long) {} + int init_scan(); + int next_row(); + int end_scan(); + void print_error(int, unsigned long) {} }; /*@brief derived_handler class*/ @@ -67,18 +67,17 @@ class ha_xpand_derived_handler: private ha_xpand_base_handler, public derived_handler { - public: - ha_xpand_derived_handler(THD* thd_arg, SELECT_LEX* sel, - xpand_connection_cursor *scan); - ~ha_xpand_derived_handler(); +public: + ha_xpand_derived_handler(THD* thd_arg, SELECT_LEX* sel, + xpand_connection_cursor *scan); + ~ha_xpand_derived_handler(); - int init_scan(); - int next_row(); - int end_scan(); - void print_error(int, unsigned long) {} + int init_scan(); + int next_row(); + int end_scan(); + void print_error(int, unsigned long) {} }; - select_handler *create_xpand_select_handler(THD* thd, SELECT_LEX* select_lex); derived_handler *create_xpand_derived_handler(THD* thd, TABLE_LIST *derived); diff --git a/storage/xpand/xpand_connection.cc b/storage/xpand/xpand_connection.cc index 41e0abac815..48c43237199 100644 --- a/storage/xpand/xpand_connection.cc +++ b/storage/xpand/xpand_connection.cc @@ -240,8 +240,7 @@ int xpand_connection::send_command() if (com_error) { int error_code = mysql_errno(&xpand_net); - my_printf_error(error_code, - "Xpand error: %s", MYF(0), + my_printf_error(error_code, "Xpand error: %s", MYF(0), mysql_error(&xpand_net)); return error_code; } @@ -256,8 +255,7 @@ int xpand_connection::read_query_response() if (comerr) { error_code = mysql_errno(&xpand_net); - my_printf_error(error_code, - "Xpand error: %s", MYF(0), + my_printf_error(error_code, "Xpand error: %s", MYF(0), mysql_error(&xpand_net)); } @@ -375,9 +373,8 @@ int xpand_connection::run_query(String &stmt) return error_code; } -int xpand_connection::write_row(ulonglong xpand_table_oid, - uchar *packed_row, size_t packed_size, - ulonglong *last_insert_id) +int xpand_connection::write_row(ulonglong xpand_table_oid, uchar *packed_row, + size_t packed_size, ulonglong *last_insert_id) { int error_code; command_length = 0; @@ -405,11 +402,10 @@ int xpand_connection::write_row(ulonglong xpand_table_oid, return error_code; } -int xpand_connection::key_update(ulonglong xpand_table_oid, - uchar *packed_key, size_t packed_key_length, - MY_BITMAP *update_set, - uchar *packed_new_data, - size_t packed_new_length) +int xpand_connection::key_update(ulonglong xpand_table_oid, uchar *packed_key, + size_t packed_key_length, + MY_BITMAP *update_set, uchar *packed_new_data, + size_t packed_new_length) { int error_code; command_length = 0; @@ -444,7 +440,7 @@ int xpand_connection::key_update(ulonglong xpand_table_oid, } int xpand_connection::key_delete(ulonglong xpand_table_oid, - uchar *packed_key, size_t packed_key_length) + uchar *packed_key, size_t packed_key_length) { int error_code; command_length = 0; @@ -665,8 +661,8 @@ int xpand_connection::allocate_cursor(MYSQL *xpand_net, ulong buffer_size, bool stmt_completed = FALSE; int error_code = (*scan)->initialize(&stmt_completed); if (error_code) { - delete *scan; - *scan = NULL; + delete *scan; + *scan = NULL; } if (stmt_completed) @@ -746,7 +742,8 @@ int xpand_connection::scan_query(String &stmt, uchar *fieldtype, uint fields, if ((error_code = add_command_operand_str(fieldtype, fields))) return error_code; - if ((error_code = add_command_operand_str(field_metadata, field_metadata_size))) + if ((error_code = add_command_operand_str(field_metadata, + field_metadata_size))) return error_code; // This variable length string calls for an additional store w/o lcb lenth prefix. @@ -1129,7 +1126,7 @@ int xpand_connection::add_command_operand_str(const uchar *str, return error_code; if (!str_length) - return 0; + return 0; error_code = expand_command_buffer(str_length); if (error_code) |