Skip to content

Commit 01be663

Browse files
committed
Merge branch 'merge-xtradb-5.6' into 10.0
2 parents 77c44a3 + 6a821d7 commit 01be663

File tree

22 files changed

+418
-299
lines changed

22 files changed

+418
-299
lines changed

storage/xtradb/api/api0api.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ ib_open_table_by_id(
245245
dict_mutex_enter_for_mysql();
246246
}
247247

248-
table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);
248+
table = dict_table_open_on_id(table_id, TRUE, DICT_TABLE_OP_NORMAL);
249249

250250
if (table != NULL && table->ibd_file_missing) {
251251
table = NULL;
@@ -2116,6 +2116,10 @@ ib_cursor_moveto(
21162116

21172117
n_fields = dict_index_get_n_ordering_defined_by_user(prebuilt->index);
21182118

2119+
if (n_fields > dtuple_get_n_fields(tuple->ptr)) {
2120+
n_fields = dtuple_get_n_fields(tuple->ptr);
2121+
}
2122+
21192123
dtuple_set_n_fields(search_tuple, n_fields);
21202124
dtuple_set_n_fields_cmp(search_tuple, n_fields);
21212125

@@ -3753,14 +3757,14 @@ ib_table_truncate(
37533757
if (trunc_err == DB_SUCCESS) {
37543758
ut_a(ib_trx_state(ib_trx) == static_cast<ib_trx_state_t>(
37553759
TRX_STATE_NOT_STARTED));
3756-
3757-
err = ib_trx_release(ib_trx);
3758-
ut_a(err == DB_SUCCESS);
37593760
} else {
37603761
err = ib_trx_rollback(ib_trx);
37613762
ut_a(err == DB_SUCCESS);
37623763
}
37633764

3765+
err = ib_trx_release(ib_trx);
3766+
ut_a(err == DB_SUCCESS);
3767+
37643768
/* Set the memcached_sync_count back. */
37653769
if (table != NULL && memcached_sync != 0) {
37663770
dict_mutex_enter_for_mysql();

storage/xtradb/btr/btr0cur.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4175,6 +4175,14 @@ btr_estimate_number_of_different_key_vals(
41754175
page = btr_cur_get_page(&cursor);
41764176

41774177
SRV_CORRUPT_TABLE_CHECK(page, goto exit_loop;);
4178+
DBUG_EXECUTE_IF("ib_corrupt_page_while_stats_calc",
4179+
page = NULL;);
4180+
4181+
SRV_CORRUPT_TABLE_CHECK(page,
4182+
{
4183+
mtr_commit(&mtr);
4184+
goto exit_loop;
4185+
});
41784186

41794187
rec = page_rec_get_next(page_get_infimum_rec(page));
41804188

storage/xtradb/buf/buf0flu.cc

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -931,12 +931,12 @@ buf_flush_write_block_low(
931931
break;
932932
case BUF_BLOCK_ZIP_DIRTY:
933933
frame = bpage->zip.data;
934-
935934
mach_write_to_8(frame + FIL_PAGE_LSN,
936935
bpage->newest_modification);
937-
memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
938936

939937
ut_a(page_zip_verify_checksum(frame, zip_size));
938+
939+
memset(frame + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
940940
break;
941941
case BUF_BLOCK_FILE_PAGE:
942942
frame = bpage->zip.data;
@@ -2847,8 +2847,6 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(
28472847
while (srv_shutdown_state == SRV_SHUTDOWN_NONE
28482848
|| srv_shutdown_state == SRV_SHUTDOWN_CLEANUP) {
28492849

2850-
ulint n_flushed_lru;
2851-
28522850
srv_current_thread_priority = srv_cleaner_thread_priority;
28532851

28542852
page_cleaner_sleep_if_needed(next_loop_time);
@@ -2857,16 +2855,7 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(
28572855

28582856
next_loop_time = ut_time_ms() + lru_sleep_time;
28592857

2860-
n_flushed_lru = buf_flush_LRU_tail();
2861-
2862-
if (n_flushed_lru) {
2863-
2864-
MONITOR_INC_VALUE_CUMULATIVE(
2865-
MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE,
2866-
MONITOR_FLUSH_BACKGROUND_COUNT,
2867-
MONITOR_FLUSH_BACKGROUND_PAGES,
2868-
n_flushed_lru);
2869-
}
2858+
buf_flush_LRU_tail();
28702859
}
28712860

28722861
buf_lru_manager_is_active = false;

storage/xtradb/dict/dict0dict.cc

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3280,71 +3280,6 @@ dict_table_is_referenced_by_foreign_key(
32803280
return(!table->referenced_set.empty());
32813281
}
32823282

3283-
/*********************************************************************//**
3284-
Check if the index is referenced by a foreign key, if TRUE return foreign
3285-
else return NULL
3286-
@return pointer to foreign key struct if index is defined for foreign
3287-
key, otherwise NULL */
3288-
UNIV_INTERN
3289-
dict_foreign_t*
3290-
dict_table_get_referenced_constraint(
3291-
/*=================================*/
3292-
dict_table_t* table,/*!< in: InnoDB table */
3293-
dict_index_t* index)/*!< in: InnoDB index */
3294-
{
3295-
dict_foreign_t* foreign;
3296-
3297-
ut_ad(index != NULL);
3298-
ut_ad(table != NULL);
3299-
3300-
for (dict_foreign_set::iterator it = table->referenced_set.begin();
3301-
it != table->referenced_set.end();
3302-
++it) {
3303-
3304-
foreign = *it;
3305-
3306-
if (foreign->referenced_index == index) {
3307-
3308-
return(foreign);
3309-
}
3310-
}
3311-
3312-
return(NULL);
3313-
}
3314-
3315-
/*********************************************************************//**
3316-
Checks if a index is defined for a foreign key constraint. Index is a part
3317-
of a foreign key constraint if the index is referenced by foreign key
3318-
or index is a foreign key index.
3319-
@return pointer to foreign key struct if index is defined for foreign
3320-
key, otherwise NULL */
3321-
UNIV_INTERN
3322-
dict_foreign_t*
3323-
dict_table_get_foreign_constraint(
3324-
/*==============================*/
3325-
dict_table_t* table,/*!< in: InnoDB table */
3326-
dict_index_t* index)/*!< in: InnoDB index */
3327-
{
3328-
dict_foreign_t* foreign;
3329-
3330-
ut_ad(index != NULL);
3331-
ut_ad(table != NULL);
3332-
3333-
for (dict_foreign_set::iterator it = table->foreign_set.begin();
3334-
it != table->foreign_set.end();
3335-
++it) {
3336-
3337-
foreign = *it;
3338-
3339-
if (foreign->foreign_index == index) {
3340-
3341-
return(foreign);
3342-
}
3343-
}
3344-
3345-
return(NULL);
3346-
}
3347-
33483283
/**********************************************************************//**
33493284
Removes a foreign constraint struct from the dictionary cache. */
33503285
UNIV_INTERN

storage/xtradb/dict/dict0stats_bg.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ DECLARE_THREAD(dict_stats_thread)(
352352
break;
353353
}
354354

355+
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
356+
if (srv_ibuf_disable_background_merge) {
357+
usleep(100000);
358+
os_event_reset(dict_stats_event);
359+
continue;
360+
}
361+
#endif
362+
355363
dict_stats_process_entry_from_recalc_pool();
356364

357365
os_event_reset(dict_stats_event);

storage/xtradb/fil/fil0fil.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -5477,9 +5477,10 @@ _fil_io(
54775477

54785478
space = fil_space_get_by_id(space_id);
54795479

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

54855486
ib_logf(IB_LOG_LEVEL_ERROR,

storage/xtradb/handler/ha_innodb.cc

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,17 @@ innobase_end(
11731173
handlerton* hton, /* in: Innodb handlerton */
11741174
ha_panic_function type);
11751175

1176+
#if NOT_USED
1177+
/*****************************************************************//**
1178+
Stores the current binlog coordinates in the trx system header. */
1179+
static
1180+
int
1181+
innobase_store_binlog_info(
1182+
/*=======================*/
1183+
handlerton* hton, /*!< in: InnoDB handlerton */
1184+
THD* thd); /*!< in: MySQL thread handle */
1185+
#endif
1186+
11761187
/*****************************************************************//**
11771188
Creates an InnoDB transaction struct for the thd if it does not yet have one.
11781189
Starts a new InnoDB transaction if a transaction is not yet started. And
@@ -3268,6 +3279,9 @@ innobase_init(
32683279
innobase_hton->start_consistent_snapshot =
32693280
innobase_start_trx_and_assign_read_view;
32703281

3282+
/*innobase_hton->store_binlog_info =
3283+
innobase_store_binlog_info;*/
3284+
32713285
innobase_hton->flush_logs = innobase_flush_logs;
32723286
innobase_hton->show_status = innobase_show_status;
32733287
innobase_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS |
@@ -3978,6 +3992,38 @@ innobase_commit_low(
39783992
}
39793993
}
39803994

3995+
#if NOT_USED
3996+
/*****************************************************************//**
3997+
Stores the current binlog coordinates in the trx system header. */
3998+
static
3999+
int
4000+
innobase_store_binlog_info(
4001+
/*=======================*/
4002+
handlerton* hton, /*!< in: InnoDB handlerton */
4003+
THD* thd) /*!< in: MySQL thread handle */
4004+
4005+
{
4006+
const char* file_name;
4007+
unsigned long long pos;
4008+
mtr_t mtr;
4009+
4010+
DBUG_ENTER("innobase_store_binlog_info");
4011+
4012+
thd_binlog_pos(thd, &file_name, &pos);
4013+
4014+
mtr_start(&mtr);
4015+
4016+
trx_sys_update_mysql_binlog_offset(file_name, pos,
4017+
TRX_SYS_MYSQL_LOG_INFO, &mtr);
4018+
4019+
mtr_commit(&mtr);
4020+
4021+
innobase_flush_logs(hton);
4022+
4023+
DBUG_RETURN(0);
4024+
}
4025+
#endif
4026+
39814027
/*****************************************************************//**
39824028
Creates an InnoDB transaction struct for the thd if it does not yet have one.
39834029
Starts a new InnoDB transaction if a transaction is not yet started. And
@@ -9571,7 +9617,8 @@ create_table_def(
95719617

95729618
/* MySQL does the name length check. But we do additional check
95739619
on the name length here */
9574-
if (strlen(table_name) > MAX_FULL_NAME_LEN) {
9620+
const size_t table_name_len = strlen(table_name);
9621+
if (table_name_len > MAX_FULL_NAME_LEN) {
95759622
push_warning_printf(
95769623
thd, Sql_condition::WARN_LEVEL_WARN,
95779624
ER_TABLE_NAME,
@@ -9580,6 +9627,15 @@ create_table_def(
95809627
DBUG_RETURN(ER_TABLE_NAME);
95819628
}
95829629

9630+
if (table_name[table_name_len - 1] == '/') {
9631+
push_warning_printf(
9632+
thd, Sql_condition::WARN_LEVEL_WARN,
9633+
ER_TABLE_NAME,
9634+
"InnoDB: Table name is empty");
9635+
9636+
DBUG_RETURN(ER_WRONG_TABLE_NAME);
9637+
}
9638+
95839639
n_cols = form->s->fields;
95849640
s_cols = form->s->stored_fields;
95859641

@@ -10894,6 +10950,10 @@ ha_innobase::discard_or_import_tablespace(
1089410950
DBUG_RETURN(HA_ERR_TABLE_READONLY);
1089510951
}
1089610952

10953+
if (UNIV_UNLIKELY(prebuilt->trx->fake_changes)) {
10954+
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
10955+
}
10956+
1089710957
dict_table = prebuilt->table;
1089810958

1089910959
if (dict_table->space == TRX_SYS_SPACE) {
@@ -12590,8 +12650,8 @@ ha_innobase::check(
1259012650
my_error(ER_QUERY_INTERRUPTED, MYF(0));
1259112651
}
1259212652

12593-
if (UNIV_UNLIKELY(share->ib_table->is_corrupt)) {
12594-
return(HA_ADMIN_CORRUPT);
12653+
if (UNIV_UNLIKELY(prebuilt->table && prebuilt->table->corrupted)) {
12654+
DBUG_RETURN(HA_ADMIN_CORRUPT);
1259512655
}
1259612656

1259712657
DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
@@ -15083,6 +15143,9 @@ innodb_log_archive_update(
1508315143
void* var_ptr,
1508415144
const void* save)
1508515145
{
15146+
if (srv_read_only_mode)
15147+
return;
15148+
1508615149
my_bool in_val = *static_cast<const my_bool*>(save);
1508715150

1508815151
if (in_val) {

0 commit comments

Comments
 (0)