Skip to content

Commit b66976a

Browse files
committed
cleanup: InnoDB, various minor issues
* fix "unused pending_checkpoint_mutex_key" compiler warning * clarify/simplify get_field_offset() * typos, comments * unused (forgotten) declaration of create_options_are_invalid() * fix my_error(ER_WRONG_KEY_COLUMN) calls * crash in row_upd_sec_index_entry() * double if (ret != 0) * don't duplucate PSI_INSTRUMENT_ME lines * useless break; after return(); * remove unused xtradb-only "cursor_read_view" stuff * code formatting * simplify dropped column detection * redundant assignment
1 parent a6f05b9 commit b66976a

File tree

8 files changed

+45
-185
lines changed

8 files changed

+45
-185
lines changed

mysql-test/suite/sys_vars/r/sysvars_innodb.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
488488
DEFAULT_VALUE crc32
489489
VARIABLE_SCOPE GLOBAL
490490
VARIABLE_TYPE ENUM
491-
VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are CRC32 (hardware accelerated if the CPU supports it) write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by InnoDB versions older than 5.6.3
491+
VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are CRC32 (hardware accelerated if the CPU supports it) write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by MariaDB versions older than 10.0.4
492492
NUMERIC_MIN_VALUE NULL
493493
NUMERIC_MAX_VALUE NULL
494494
NUMERIC_BLOCK_SIZE NULL

storage/innobase/handler/ha_innodb.cc

Lines changed: 23 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ static mysql_pfs_key_t pending_checkpoint_mutex_key;
476476

477477
static PSI_mutex_info all_pthread_mutexes[] = {
478478
PSI_KEY(commit_cond_mutex),
479+
PSI_KEY(pending_checkpoint_mutex),
479480
PSI_KEY(innobase_share_mutex)
480481
};
481482

@@ -871,13 +872,17 @@ innobase_map_isolation_level(
871872

872873
/** Gets field offset for a field in a table.
873874
@param[in] table MySQL table object
874-
@param[in] field MySQL field object
875+
@param[in] field MySQL field object (from table->field array)
875876
@return offset */
876877
static inline
877878
uint
878879
get_field_offset(
879880
const TABLE* table,
880-
const Field* field);
881+
const Field* field)
882+
{
883+
return field->offset(table->record[0]);
884+
}
885+
881886

882887
/*************************************************************//**
883888
Check for a valid value of innobase_compression_algorithm.
@@ -3980,12 +3985,6 @@ innobase_init(
39803985
innobase_hton->commit_by_xid = innobase_commit_by_xid;
39813986
innobase_hton->rollback_by_xid = innobase_rollback_by_xid;
39823987
innobase_hton->commit_checkpoint_request=innobase_checkpoint_request;
3983-
3984-
#ifdef INNOBASE_CURSOR_VIEW
3985-
innobase_hton->create_cursor_read_view = innobase_create_cursor_view;
3986-
innobase_hton->set_cursor_read_view = innobase_set_cursor_view;
3987-
innobase_hton->close_cursor_read_view = innobase_close_cursor_view;
3988-
#endif
39893988
innobase_hton->create = innobase_create_handler;
39903989

39913990
#ifdef MYSQL_TABLESPACES
@@ -5686,7 +5685,7 @@ ha_innobase::table_flags() const
56865685
all InnoDB features such as GEOMETRY, FULLTEXT etc. */
56875686
/* JAN: TODO: MySQL 5.7
56885687
flags &= ~(HA_INNOPART_DISABLED_TABLE_FLAGS);
5689-
5688+
}
56905689
*/
56915690
}
56925691

@@ -6126,8 +6125,6 @@ innobase_match_index_columns(
61266125
if (innodb_idx_fld >= innodb_idx_fld_end) {
61276126
DBUG_RETURN(FALSE);
61286127
}
6129-
6130-
mtype = innodb_idx_fld->col->mtype;
61316128
}
61326129

61336130
/* MariaDB-5.5 compatibility */
@@ -7311,19 +7308,6 @@ ha_innobase::close()
73117308

73127309
/* The following accessor functions should really be inside MySQL code! */
73137310

7314-
/** Gets field offset for a field in a table.
7315-
@param[in] table MySQL table object
7316-
@param[in] field MySQL field object
7317-
@return offset */
7318-
static inline
7319-
uint
7320-
get_field_offset(
7321-
const TABLE* table,
7322-
const Field* field)
7323-
{
7324-
return(static_cast<uint>((field->ptr - table->record[0])));
7325-
}
7326-
73277311
#ifdef WITH_WSREP
73287312
UNIV_INTERN
73297313
int
@@ -9649,7 +9633,7 @@ wsrep_calc_row_hash(
96499633
}
96509634
#endif /* WITH_WSREP */
96519635

9652-
/*
9636+
/**
96539637
Updates a row given as a parameter to a new value. Note that we are given
96549638
whole rows, not just the fields which are updated: this incurs some
96559639
overhead for CPU when we check which fields are actually updated.
@@ -9694,10 +9678,9 @@ ha_innobase::update_row(
96949678
+ MAX_REF_PARTS * 3;
96959679

96969680
m_upd_buf = reinterpret_cast<uchar*>(
9697-
my_malloc(
9698-
m_upd_buf_size,
9681+
my_malloc(//PSI_INSTRUMENT_ME,
9682+
m_upd_buf_size,
96999683
MYF(MY_WME)));
9700-
/* JAN: TODO: MySQL 5.7: PSI_INSTRUMENT_ME,...*/
97019684

97029685
if (m_upd_buf == NULL) {
97039686
m_upd_buf_size = 0;
@@ -10942,10 +10925,7 @@ ha_innobase::ft_init_ext(
1094210925

1094310926
/* Allocate FTS handler, and instantiate it before return */
1094410927
fts_hdl = reinterpret_cast<NEW_FT_INFO*>(
10945-
my_malloc(sizeof(NEW_FT_INFO), MYF(0)));
10946-
/* JAN: TODO: MySQL 5.7 PSI
10947-
my_malloc(PSI_INSTRUMENT_ME, sizeof(NEW_FT_INFO), MYF(0)));
10948-
*/
10928+
my_malloc(/*PSI_INSTRUMENT_ME,*/ sizeof(NEW_FT_INFO), MYF(0)));
1094910929

1095010930
fts_hdl->please = const_cast<_ft_vft*>(&ft_vft_result);
1095110931
fts_hdl->could_you = const_cast<_ft_vft_ext*>(&ft_vft_ext_result);
@@ -12356,13 +12336,7 @@ create_index(
1235612336
ind_type |= DICT_UNIQUE;
1235712337
}
1235812338

12359-
/* JAN: TODO: MySQL 5.7 PSI
12360-
field_lengths = (ulint*) my_malloc(PSI_INSTRUMENT_ME,
12361-
key->user_defined_key_parts * sizeof *
12362-
field_lengths, MYF(MY_FAE));
12363-
*/
12364-
12365-
field_lengths = (ulint*) my_malloc(
12339+
field_lengths = (ulint*) my_malloc(//PSI_INSTRUMENT_ME,
1236612340
key->user_defined_key_parts * sizeof *
1236712341
field_lengths, MYF(MY_FAE));
1236812342

@@ -12589,8 +12563,7 @@ validate_tablespace_name(
1258912563
err = HA_WRONG_CREATE_OPTION;
1259012564
}
1259112565
} else {
12592-
my_printf_error(
12593-
ER_WRONG_TABLESPACE_NAME,
12566+
my_printf_error(ER_WRONG_TABLESPACE_NAME,
1259412567
"InnoDB: A general tablespace"
1259512568
" name cannot start with `%s`.",
1259612569
MYF(0), reserved_space_name_prefix);
@@ -13434,8 +13407,6 @@ create_table_info_t::innobase_table_flags()
1343413407
}
1343513408
}
1343613409

13437-
//rec_format_t row_format = m_form->s->row_type;
13438-
1343913410
if (m_create_info->key_block_size > 0) {
1344013411
/* The requested compressed page size (key_block_size)
1344113412
is given in kilobytes. If it is a valid number, store
@@ -15114,9 +15085,7 @@ innobase_drop_database(
1511415085
}
1511515086

1511615087
ptr++;
15117-
namebuf = (char*) my_malloc((uint) len + 2, MYF(0));
15118-
// JAN: TODO: MySQL 5.7
15119-
//namebuf = (char*) my_malloc(PSI_INSTRUMENT_ME, (uint) len + 2, MYF(0));
15088+
namebuf = (char*) my_malloc(/*PSI_INSTRUMENT_ME,*/ (uint) len + 2, MYF(0));
1512015089

1512115090
memcpy(namebuf, ptr, len);
1512215091
namebuf[len] = '/';
@@ -15366,8 +15335,9 @@ For other error codes, the server will fall back to counting records. */
1536615335

1536715336
#ifdef MYSQL_57_SELECT_COUNT_OPTIMIZATION
1536815337
int
15369-
ha_innobase::records(ha_rows* num_rows)
15370-
/*===================================*/
15338+
ha_innobase::records(
15339+
/*==================*/
15340+
ha_rows* num_rows) /*!< out: number of rows */
1537115341
{
1537215342
DBUG_ENTER("ha_innobase::records()");
1537315343

@@ -15439,16 +15409,15 @@ ha_innobase::records(ha_rows* num_rows)
1543915409
case DB_LOCK_WAIT_TIMEOUT:
1544015410
*num_rows = HA_POS_ERROR;
1544115411
DBUG_RETURN(convert_error_code_to_mysql(ret, 0, m_user_thd));
15442-
break;
1544315412
case DB_INTERRUPTED:
1544415413
*num_rows = HA_POS_ERROR;
1544515414
DBUG_RETURN(HA_ERR_QUERY_INTERRUPTED);
15446-
break;
1544715415
default:
1544815416
/* No other error besides the three below is returned from
1544915417
row_scan_index_for_mysql(). Make a debug catch. */
1545015418
*num_rows = HA_POS_ERROR;
1545115419
ut_ad(0);
15420+
DBUG_RETURN(-1);
1545215421
}
1545315422

1545415423
m_prebuilt->trx->op_info = "";
@@ -17894,12 +17863,8 @@ innodb_show_status(
1789417863
/* allocate buffer for the string, and
1789517864
read the contents of the temporary file */
1789617865

17897-
/* JAN: TODO: MySQL 5.7 PSI */
17898-
if (!(str = (char*) my_malloc(
17899-
usable_len + 1, MYF(0)))) {
17900-
/* if (!(str = (char*) my_malloc(PSI_INSTRUMENT_ME,
17866+
if (!(str = (char*) my_malloc(//PSI_INSTRUMENT_ME,
1790117867
usable_len + 1, MYF(0)))) {
17902-
*/
1790317868
mutex_exit(&srv_monitor_file_mutex);
1790417869
DBUG_RETURN(1);
1790517870
}
@@ -18334,15 +18299,9 @@ get_share(
1833418299
grows too big */
1833518300

1833618301
share = reinterpret_cast<INNOBASE_SHARE*>(
18337-
my_malloc(
18302+
my_malloc(//PSI_INSTRUMENT_ME,
1833818303
sizeof(*share) + length + 1,
1833918304
MYF(MY_FAE | MY_ZEROFILL)));
18340-
/* JAN: TODO: MySQL 5.7 PSI
18341-
share = reinterpret_cast<INNOBASE_SHARE*>(
18342-
my_malloc(PSI_INSTRUMENT_ME,
18343-
sizeof(*share) + length + 1,
18344-
MYF(MY_FAE | MY_ZEROFILL)));
18345-
*/
1834618305

1834718306
share->table_name = reinterpret_cast<char*>(
1834818307
memcpy(share + 1, table_name, length + 1));
@@ -19320,64 +19279,6 @@ innobase_rollback_by_xid(
1932019279
}
1932119280
}
1932219281

19323-
#ifdef INNOBASE_CURSOR_VIEW
19324-
19325-
/*******************************************************************//**
19326-
Create a consistent view for a cursor based on current transaction
19327-
which is created if the corresponding MySQL thread still lacks one.
19328-
This consistent view is then used inside of MySQL when accessing records
19329-
using a cursor.
19330-
@return pointer to cursor view or NULL */
19331-
static
19332-
void*
19333-
innobase_create_cursor_view(
19334-
/*========================*/
19335-
handlerton* hton, /*!< in: innobase hton */
19336-
THD* thd) /*!< in: user thread handle */
19337-
{
19338-
DBUG_ASSERT(hton == innodb_hton_ptr);
19339-
19340-
return(read_cursor_view_create_for_mysql(check_trx_exists(thd)));
19341-
}
19342-
19343-
/*******************************************************************//**
19344-
Close the given consistent cursor view of a transaction and restore
19345-
global read view to a transaction read view. Transaction is created if the
19346-
corresponding MySQL thread still lacks one. */
19347-
static
19348-
void
19349-
innobase_close_cursor_view(
19350-
/*=======================*/
19351-
handlerton* hton, /*!< in: innobase hton */
19352-
THD* thd, /*!< in: user thread handle */
19353-
void* curview)/*!< in: Consistent read view to be closed */
19354-
{
19355-
DBUG_ASSERT(hton == innodb_hton_ptr);
19356-
19357-
read_cursor_view_close_for_mysql(check_trx_exists(thd),
19358-
(cursor_view_t*) curview);
19359-
}
19360-
19361-
/*******************************************************************//**
19362-
Set the given consistent cursor view to a transaction which is created
19363-
if the corresponding MySQL thread still lacks one. If the given
19364-
consistent cursor view is NULL global read view of a transaction is
19365-
restored to a transaction read view. */
19366-
static
19367-
void
19368-
innobase_set_cursor_view(
19369-
/*=====================*/
19370-
handlerton* hton, /*!< in: innobase hton */
19371-
THD* thd, /*!< in: user thread handle */
19372-
void* curview)/*!< in: Consistent cursor view to be set */
19373-
{
19374-
DBUG_ASSERT(hton == innodb_hton_ptr);
19375-
19376-
read_cursor_set_for_mysql(check_trx_exists(thd),
19377-
(cursor_view_t*) curview);
19378-
}
19379-
#endif /* INNOBASE_CURSOR_VIEW */
19380-
1938119282
bool
1938219283
ha_innobase::check_if_incompatible_data(
1938319284
/*====================================*/
@@ -20531,12 +20432,8 @@ innodb_monitor_validate(
2053120432
by InnoDB, so we can access it in another callback
2053220433
function innodb_monitor_update() and free it appropriately */
2053320434
if (name) {
20534-
/* JAN: TODO: MySQL 5.7 PSI
20535-
monitor_name = my_strdup(PSI_INSTRUMENT_ME,
20435+
monitor_name = my_strdup(//PSI_INSTRUMENT_ME,
2053620436
name, MYF(0));
20537-
*/
20538-
monitor_name = my_strdup(
20539-
name, MYF(0));
2054020437
} else {
2054120438
return(1);
2054220439
}
@@ -21860,7 +21757,7 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
2186021757
" write a constant magic number, do not allow values other than that"
2186121758
" magic number when reading;"
2186221759
" Files updated when this option is set to crc32 or strict_crc32 will"
21863-
" not be readable by InnoDB versions older than 5.6.3",
21760+
" not be readable by MariaDB versions older than 10.0.4",
2186421761
NULL, NULL, SRV_CHECKSUM_ALGORITHM_CRC32,
2186521762
&innodb_checksum_algorithm_typelib);
2186621763

@@ -23789,11 +23686,6 @@ innobase_get_computed_value(
2378923686
return(NULL);
2379023687
}
2379123688

23792-
/* we just want to store the data in passed in MySQL record */
23793-
if (ret != 0) {
23794-
return(NULL);
23795-
}
23796-
2379723689
if (vctempl->mysql_null_bit_mask
2379823690
&& (mysql_rec[vctempl->mysql_null_byte_offset]
2379923691
& vctempl->mysql_null_bit_mask)) {

storage/innobase/handler/ha_innodb.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,19 +1157,3 @@ ib_push_frm_error(
11571157
ulint n_keys, /*!< in: InnoDB #keys */
11581158
bool push_warning); /*!< in: print warning ? */
11591159

1160-
/*****************************************************************//**
1161-
Validates the create options. We may build on this function
1162-
in future. For now, it checks two specifiers:
1163-
KEY_BLOCK_SIZE and ROW_FORMAT
1164-
If innodb_strict_mode is not set then this function is a no-op
1165-
@return NULL if valid, string if not. */
1166-
UNIV_INTERN
1167-
const char*
1168-
create_options_are_invalid(
1169-
/*=======================*/
1170-
THD* thd, /*!< in: connection thread. */
1171-
TABLE* form, /*!< in: information on table
1172-
columns and indexes */
1173-
HA_CREATE_INFO* create_info, /*!< in: create info. */
1174-
bool use_tablespace) /*!< in: srv_file_per_table */
1175-
MY_ATTRIBUTE((nonnull, warn_unused_result));

0 commit comments

Comments
 (0)