Skip to content

Commit

Permalink
Merge branch 'merge-xtradb-5.6' into 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Oct 9, 2015
2 parents 77c44a3 + 6a821d7 commit 01be663
Show file tree
Hide file tree
Showing 22 changed files with 418 additions and 299 deletions.
12 changes: 8 additions & 4 deletions storage/xtradb/api/api0api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ib_open_table_by_id(
dict_mutex_enter_for_mysql();
}

table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);
table = dict_table_open_on_id(table_id, TRUE, DICT_TABLE_OP_NORMAL);

if (table != NULL && table->ibd_file_missing) {
table = NULL;
Expand Down Expand Up @@ -2116,6 +2116,10 @@ ib_cursor_moveto(

n_fields = dict_index_get_n_ordering_defined_by_user(prebuilt->index);

if (n_fields > dtuple_get_n_fields(tuple->ptr)) {
n_fields = dtuple_get_n_fields(tuple->ptr);
}

dtuple_set_n_fields(search_tuple, n_fields);
dtuple_set_n_fields_cmp(search_tuple, n_fields);

Expand Down Expand Up @@ -3753,14 +3757,14 @@ ib_table_truncate(
if (trunc_err == DB_SUCCESS) {
ut_a(ib_trx_state(ib_trx) == static_cast<ib_trx_state_t>(
TRX_STATE_NOT_STARTED));

err = ib_trx_release(ib_trx);
ut_a(err == DB_SUCCESS);
} else {
err = ib_trx_rollback(ib_trx);
ut_a(err == DB_SUCCESS);
}

err = ib_trx_release(ib_trx);
ut_a(err == DB_SUCCESS);

/* Set the memcached_sync_count back. */
if (table != NULL && memcached_sync != 0) {
dict_mutex_enter_for_mysql();
Expand Down
8 changes: 8 additions & 0 deletions storage/xtradb/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4175,6 +4175,14 @@ btr_estimate_number_of_different_key_vals(
page = btr_cur_get_page(&cursor);

SRV_CORRUPT_TABLE_CHECK(page, goto exit_loop;);
DBUG_EXECUTE_IF("ib_corrupt_page_while_stats_calc",
page = NULL;);

SRV_CORRUPT_TABLE_CHECK(page,
{
mtr_commit(&mtr);
goto exit_loop;
});

rec = page_rec_get_next(page_get_infimum_rec(page));

Expand Down
19 changes: 4 additions & 15 deletions storage/xtradb/buf/buf0flu.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -931,12 +931,12 @@ buf_flush_write_block_low(
break;
case BUF_BLOCK_ZIP_DIRTY:
frame = bpage->zip.data;

mach_write_to_8(frame + FIL_PAGE_LSN,
bpage->newest_modification);
memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);

ut_a(page_zip_verify_checksum(frame, zip_size));

memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
break;
case BUF_BLOCK_FILE_PAGE:
frame = bpage->zip.data;
Expand Down Expand Up @@ -2847,8 +2847,6 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(
while (srv_shutdown_state == SRV_SHUTDOWN_NONE
|| srv_shutdown_state == SRV_SHUTDOWN_CLEANUP) {

ulint n_flushed_lru;

srv_current_thread_priority = srv_cleaner_thread_priority;

page_cleaner_sleep_if_needed(next_loop_time);
Expand All @@ -2857,16 +2855,7 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(

next_loop_time = ut_time_ms() + lru_sleep_time;

n_flushed_lru = buf_flush_LRU_tail();

if (n_flushed_lru) {

MONITOR_INC_VALUE_CUMULATIVE(
MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE,
MONITOR_FLUSH_BACKGROUND_COUNT,
MONITOR_FLUSH_BACKGROUND_PAGES,
n_flushed_lru);
}
buf_flush_LRU_tail();
}

buf_lru_manager_is_active = false;
Expand Down
65 changes: 0 additions & 65 deletions storage/xtradb/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3280,71 +3280,6 @@ dict_table_is_referenced_by_foreign_key(
return(!table->referenced_set.empty());
}

/*********************************************************************//**
Check if the index is referenced by a foreign key, if TRUE return foreign
else return NULL
@return pointer to foreign key struct if index is defined for foreign
key, otherwise NULL */
UNIV_INTERN
dict_foreign_t*
dict_table_get_referenced_constraint(
/*=================================*/
dict_table_t* table, /*!< in: InnoDB table */
dict_index_t* index) /*!< in: InnoDB index */
{
dict_foreign_t* foreign;

ut_ad(index != NULL);
ut_ad(table != NULL);

for (dict_foreign_set::iterator it = table->referenced_set.begin();
it != table->referenced_set.end();
++it) {

foreign = *it;

if (foreign->referenced_index == index) {

return(foreign);
}
}

return(NULL);
}

/*********************************************************************//**
Checks if a index is defined for a foreign key constraint. Index is a part
of a foreign key constraint if the index is referenced by foreign key
or index is a foreign key index.
@return pointer to foreign key struct if index is defined for foreign
key, otherwise NULL */
UNIV_INTERN
dict_foreign_t*
dict_table_get_foreign_constraint(
/*==============================*/
dict_table_t* table, /*!< in: InnoDB table */
dict_index_t* index) /*!< in: InnoDB index */
{
dict_foreign_t* foreign;

ut_ad(index != NULL);
ut_ad(table != NULL);

for (dict_foreign_set::iterator it = table->foreign_set.begin();
it != table->foreign_set.end();
++it) {

foreign = *it;

if (foreign->foreign_index == index) {

return(foreign);
}
}

return(NULL);
}

/**********************************************************************//**
Removes a foreign constraint struct from the dictionary cache. */
UNIV_INTERN
Expand Down
8 changes: 8 additions & 0 deletions storage/xtradb/dict/dict0stats_bg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ DECLARE_THREAD(dict_stats_thread)(
break;
}

#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
if (srv_ibuf_disable_background_merge) {
usleep(100000);
os_event_reset(dict_stats_event);
continue;
}
#endif

dict_stats_process_entry_from_recalc_pool();

os_event_reset(dict_stats_event);
Expand Down
9 changes: 5 additions & 4 deletions storage/xtradb/fil/fil0fil.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -5477,9 +5477,10 @@ _fil_io(

space = fil_space_get_by_id(space_id);

/* If we are deleting a tablespace we don't allow any read
operations on that. However, we do allow write operations. */
if (space == 0 || (type == OS_FILE_READ && space->stop_new_ops)) {
/* If we are deleting a tablespace we don't allow async read operations
on that. However, we do allow write and sync read operations */
if (space == 0
|| (type == OS_FILE_READ && !sync && space->stop_new_ops)) {
mutex_exit(&fil_system->mutex);

ib_logf(IB_LOG_LEVEL_ERROR,
Expand Down
69 changes: 66 additions & 3 deletions storage/xtradb/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,17 @@ innobase_end(
handlerton* hton, /* in: Innodb handlerton */
ha_panic_function type);

#if NOT_USED
/*****************************************************************//**
Stores the current binlog coordinates in the trx system header. */
static
int
innobase_store_binlog_info(
/*=======================*/
handlerton* hton, /*!< in: InnoDB handlerton */
THD* thd); /*!< in: MySQL thread handle */
#endif

/*****************************************************************//**
Creates an InnoDB transaction struct for the thd if it does not yet have one.
Starts a new InnoDB transaction if a transaction is not yet started. And
Expand Down Expand Up @@ -3268,6 +3279,9 @@ innobase_init(
innobase_hton->start_consistent_snapshot =
innobase_start_trx_and_assign_read_view;

/*innobase_hton->store_binlog_info =
innobase_store_binlog_info;*/

innobase_hton->flush_logs = innobase_flush_logs;
innobase_hton->show_status = innobase_show_status;
innobase_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS |
Expand Down Expand Up @@ -3978,6 +3992,38 @@ innobase_commit_low(
}
}

#if NOT_USED
/*****************************************************************//**
Stores the current binlog coordinates in the trx system header. */
static
int
innobase_store_binlog_info(
/*=======================*/
handlerton* hton, /*!< in: InnoDB handlerton */
THD* thd) /*!< in: MySQL thread handle */

{
const char* file_name;
unsigned long long pos;
mtr_t mtr;

DBUG_ENTER("innobase_store_binlog_info");

thd_binlog_pos(thd, &file_name, &pos);

mtr_start(&mtr);

trx_sys_update_mysql_binlog_offset(file_name, pos,
TRX_SYS_MYSQL_LOG_INFO, &mtr);

mtr_commit(&mtr);

innobase_flush_logs(hton);

DBUG_RETURN(0);
}
#endif

/*****************************************************************//**
Creates an InnoDB transaction struct for the thd if it does not yet have one.
Starts a new InnoDB transaction if a transaction is not yet started. And
Expand Down Expand Up @@ -9571,7 +9617,8 @@ create_table_def(

/* MySQL does the name length check. But we do additional check
on the name length here */
if (strlen(table_name) > MAX_FULL_NAME_LEN) {
const size_t table_name_len = strlen(table_name);
if (table_name_len > MAX_FULL_NAME_LEN) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
ER_TABLE_NAME,
Expand All @@ -9580,6 +9627,15 @@ create_table_def(
DBUG_RETURN(ER_TABLE_NAME);
}

if (table_name[table_name_len - 1] == '/') {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
ER_TABLE_NAME,
"InnoDB: Table name is empty");

DBUG_RETURN(ER_WRONG_TABLE_NAME);
}

n_cols = form->s->fields;
s_cols = form->s->stored_fields;

Expand Down Expand Up @@ -10894,6 +10950,10 @@ ha_innobase::discard_or_import_tablespace(
DBUG_RETURN(HA_ERR_TABLE_READONLY);
}

if (UNIV_UNLIKELY(prebuilt->trx->fake_changes)) {
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
}

dict_table = prebuilt->table;

if (dict_table->space == TRX_SYS_SPACE) {
Expand Down Expand Up @@ -12590,8 +12650,8 @@ ha_innobase::check(
my_error(ER_QUERY_INTERRUPTED, MYF(0));
}

if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
return(HA_ADMIN_CORRUPT);
if (UNIV_UNLIKELY(prebuilt->table && prebuilt->table->corrupted)) {
DBUG_RETURN(HA_ADMIN_CORRUPT);
}

DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
Expand Down Expand Up @@ -15083,6 +15143,9 @@ innodb_log_archive_update(
void* var_ptr,
const void* save)
{
if (srv_read_only_mode)
return;

my_bool in_val = *static_cast<const my_bool*>(save);

if (in_val) {
Expand Down
Loading

0 comments on commit 01be663

Please sign in to comment.