summaryrefslogtreecommitdiff
path: root/storage/xtradb/handler/ha_innodb.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/handler/ha_innodb.cc')
-rw-r--r--storage/xtradb/handler/ha_innodb.cc100
1 files changed, 58 insertions, 42 deletions
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 42a49e355e6..ef6aae7889e 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
@@ -355,7 +355,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
{&buffer_block_mutex_key, "buffer_block_mutex", 0},
# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
- {&buf_pool_mutex_key, "buf_pool_mutex", 0},
{&buf_pool_zip_mutex_key, "buf_pool_zip_mutex", 0},
{&buf_pool_LRU_list_mutex_key, "buf_pool_LRU_list_mutex", 0},
{&buf_pool_free_list_mutex_key, "buf_pool_free_list_mutex", 0},
@@ -1890,6 +1889,15 @@ convert_error_code_to_mysql(
return(HA_ERR_TO_BIG_ROW);
}
+
+ case DB_TOO_BIG_FOR_REDO:
+ my_printf_error(ER_TOO_BIG_ROWSIZE, "%s" , MYF(0),
+ "The size of BLOB/TEXT data inserted"
+ " in one transaction is greater than"
+ " 10% of redo log size. Increase the"
+ " redo log size using innodb_log_file_size.");
+ return(HA_ERR_TO_BIG_ROW);
+
case DB_TOO_BIG_INDEX_COL:
my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0),
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags));
@@ -3203,19 +3211,6 @@ trx_is_strict(
return(trx && trx->mysql_thd && THDVAR(trx->mysql_thd, strict_mode));
}
-/**********************************************************************//**
-Determines if the current MySQL thread is running in strict mode.
-If thd==NULL, THDVAR returns the global value of innodb-strict-mode.
-@return TRUE if strict */
-UNIV_INLINE
-ibool
-thd_is_strict(
-/*==========*/
- THD* thd) /*!< in: MySQL thread descriptor */
-{
- return(THDVAR(thd, strict_mode));
-}
-
/**************************************************************//**
Resets some fields of a prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -4809,7 +4804,10 @@ innobase_release_savepoint(
DBUG_ASSERT(hton == innodb_hton_ptr);
trx = check_trx_exists(thd);
- trx_start_if_not_started(trx);
+
+ if (trx->state == TRX_STATE_NOT_STARTED) {
+ trx_start_if_not_started(trx);
+ }
/* TODO: use provided savepoint data area to store savepoint data */
@@ -5463,6 +5461,8 @@ innobase_match_index_columns(
if (innodb_idx_fld >= innodb_idx_fld_end) {
DBUG_RETURN(FALSE);
}
+
+ mtype = innodb_idx_fld->col->mtype;
}
if (col_type != mtype) {
@@ -7468,12 +7468,15 @@ ha_innobase::innobase_lock_autoinc(void)
break;
case AUTOINC_NEW_STYLE_LOCKING:
- /* For simple (single/multi) row INSERTs, we fallback to the
- old style only if another transaction has already acquired
- the AUTOINC lock on behalf of a LOAD FILE or INSERT ... SELECT
- etc. type of statement. */
+ /* For simple (single/multi) row INSERTs/REPLACEs and RBR
+ events, we fallback to the old style only if another
+ transaction has already acquired the AUTOINC lock on
+ behalf of a LOAD FILE or INSERT ... SELECT etc. type of
+ statement. */
if (thd_sql_command(user_thd) == SQLCOM_INSERT
- || thd_sql_command(user_thd) == SQLCOM_REPLACE) {
+ || thd_sql_command(user_thd) == SQLCOM_REPLACE
+ || thd_sql_command(user_thd) == SQLCOM_END // RBR event
+ ) {
dict_table_t* ib_table = prebuilt->table;
/* Acquire the AUTOINC mutex. */
@@ -7482,9 +7485,11 @@ ha_innobase::innobase_lock_autoinc(void)
/* We need to check that another transaction isn't
already holding the AUTOINC lock on the table. */
if (ib_table->n_waiting_or_granted_auto_inc_locks) {
- /* Release the mutex to avoid deadlocks. */
+ /* Release the mutex to avoid deadlocks and
+ fall back to old style locking. */
dict_table_autoinc_unlock(ib_table);
} else {
+ /* Do not fall back to old style locking. */
break;
}
}
@@ -8026,7 +8031,8 @@ calc_row_difference(
}
}
}
- innodb_idx++;
+ if (field->stored_in_db)
+ innodb_idx++;
}
/* If the update changes a column with an FTS index on it, we
@@ -8941,6 +8947,11 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
+ /* If transaction is not startted do not continue, instead return a error code. */
+ if(!(prebuilt->sql_stat_start || (prebuilt->trx && prebuilt->trx->state == 1))) {
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+
if (UNIV_UNLIKELY(srv_pass_corrupt_table <= 1 && share
&& share->ib_table && share->ib_table->is_corrupt)) {
DBUG_RETURN(HA_ERR_CRASHED);
@@ -9720,18 +9731,18 @@ create_table_def(
/* Adjust for the FTS hidden field */
if (!has_doc_id_col) {
table = dict_mem_table_create(table_name, 0, s_cols + 1,
- flags, flags2, false);
+ flags, flags2);
/* Set the hidden doc_id column. */
table->fts->doc_col = s_cols;
} else {
table = dict_mem_table_create(table_name, 0, s_cols,
- flags, flags2, false);
+ flags, flags2);
table->fts->doc_col = doc_id_col;
}
} else {
table = dict_mem_table_create(table_name, 0, s_cols,
- flags, flags2, false);
+ flags, flags2);
}
if (flags2 & DICT_TF2_TEMPORARY) {
@@ -10797,7 +10808,7 @@ ha_innobase::create(
DBUG_ASSERT(thd != NULL);
DBUG_ASSERT(create_info != NULL);
- if (form->s->fields > REC_MAX_N_USER_FIELDS) {
+ if (form->s->stored_fields > REC_MAX_N_USER_FIELDS) {
DBUG_RETURN(HA_ERR_TOO_MANY_FIELDS);
} else if (srv_read_only_mode) {
DBUG_RETURN(HA_ERR_TABLE_READONLY);
@@ -12184,18 +12195,6 @@ ha_innobase::info_low(
prebuilt->trx->op_info =
"returning various info to MySQL";
}
-
- my_snprintf(path, sizeof(path), "%s/%s%s",
- mysql_data_home, ib_table->name, reg_ext);
-
- unpack_filename(path,path);
-
- /* Note that we do not know the access time of the table,
- nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
-
- if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
- stats.create_time = (ulong) stat_info.ctime;
- }
}
if (flag & HA_STATUS_VARIABLE) {
@@ -12481,6 +12480,20 @@ ha_innobase::info_low(
if (!(flag & HA_STATUS_NO_LOCK)) {
dict_table_stats_unlock(ib_table, RW_S_LATCH);
}
+
+ my_snprintf(path, sizeof(path), "%s/%s%s",
+ mysql_data_home,
+ table->s->normalized_path.str,
+ reg_ext);
+
+ unpack_filename(path,path);
+
+ /* Note that we do not know the access time of the table,
+ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
+
+ if (os_file_get_status(path, &stat_info, false) == DB_SUCCESS) {
+ stats.create_time = (ulong) stat_info.ctime;
+ }
}
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
@@ -14819,10 +14832,8 @@ ha_innobase::cmp_ref(
len1 = innobase_read_from_2_little_endian(ref1);
len2 = innobase_read_from_2_little_endian(ref2);
- ref1 += 2;
- ref2 += 2;
result = ((Field_blob*) field)->cmp(
- ref1, len1, ref2, len2);
+ ref1 + 2, len1, ref2 + 2, len2);
} else {
result = field->key_cmp(ref1, ref2);
}
@@ -19341,6 +19352,7 @@ innodb_compression_algorithm_validate(
/**********************************************************************
Issue a warning that the row is too big. */
+UNIV_INTERN
void
ib_warn_row_too_big(const dict_table_t* table)
{
@@ -19354,6 +19366,10 @@ ib_warn_row_too_big(const dict_table_t* table)
THD* thd = current_thd;
+ if (thd == NULL) {
+ return;
+ }
+
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW,
"Row size too large (> %lu). Changing some columns to TEXT"