Skip to content

Commit d8b45b0

Browse files
committed
Merge branch 'merge-xtradb-5.6' into 10.0
2 parents dfeff40 + 360a4a0 commit d8b45b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1204
-434
lines changed

storage/xtradb/btr/btr0sea.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ btr_search_sys_create(
199199
&btr_search_latch_arr[i], SYNC_SEARCH_SYS);
200200

201201
btr_search_sys->hash_tables[i]
202-
= ha_create(hash_size, 0, MEM_HEAP_FOR_BTR_SEARCH, 0);
202+
= ib_create(hash_size, 0, MEM_HEAP_FOR_BTR_SEARCH, 0);
203203

204204
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
205205
btr_search_sys->hash_tables[i]->adaptive = TRUE;

storage/xtradb/buf/buf0buf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ buf_pool_init_instance(
14551455
ut_a(srv_n_page_hash_locks != 0);
14561456
ut_a(srv_n_page_hash_locks <= MAX_PAGE_HASH_LOCKS);
14571457

1458-
buf_pool->page_hash = ha_create(2 * buf_pool->curr_size,
1458+
buf_pool->page_hash = ib_create(2 * buf_pool->curr_size,
14591459
srv_n_page_hash_locks,
14601460
MEM_HEAP_FOR_PAGE_HASH,
14611461
SYNC_BUF_PAGE_HASH);

storage/xtradb/buf/buf0dblwr.cc

Lines changed: 2 additions & 2 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, 2017, 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
@@ -355,7 +355,7 @@ recovery, this function loads the pages from double write buffer into memory. */
355355
void
356356
buf_dblwr_init_or_load_pages(
357357
/*=========================*/
358-
os_file_tfile,
358+
pfs_os_file_tfile,
359359
char* path,
360360
boolload_corrupt_pages)
361361
{

storage/xtradb/buf/buf0dump.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
55
66
This program is free software; you can redistribute it and/or modify it under
@@ -680,6 +680,7 @@ DECLARE_THREAD(buf_dump_thread)(
680680
void* arg MY_ATTRIBUTE((unused)))/*!< in: a dummy parameter
681681
required by os_thread_create */
682682
{
683+
my_thread_init();
683684
ut_ad(!srv_read_only_mode);
684685

685686
srv_buf_dump_thread_active = TRUE;
@@ -718,6 +719,7 @@ DECLARE_THREAD(buf_dump_thread)(
718719

719720
srv_buf_dump_thread_active = FALSE;
720721

722+
my_thread_end();
721723
/* We count the number of threads in os_thread_exit(). A created
722724
thread should always use that to exit and not use return() to exit. */
723725
os_thread_exit(NULL);

storage/xtradb/buf/buf0flu.cc

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
55
66
This program is free software; you can redistribute it and/or modify it under
@@ -357,6 +357,7 @@ buf_flush_insert_into_flush_list(
357357
buf_block_t* block,/*!< in/out: block which is modified */
358358
lsn_tlsn)/*!< in: oldest modification */
359359
{
360+
ut_ad(srv_shutdown_state != SRV_SHUTDOWN_FLUSH_PHASE);
360361
ut_ad(log_flush_order_mutex_own());
361362
ut_ad(mutex_own(&block->mutex));
362363

@@ -415,6 +416,7 @@ buf_flush_insert_sorted_into_flush_list(
415416
buf_page_t* prev_b;
416417
buf_page_t* b;
417418

419+
ut_ad(srv_shutdown_state != SRV_SHUTDOWN_FLUSH_PHASE);
418420
ut_ad(log_flush_order_mutex_own());
419421
ut_ad(mutex_own(&block->mutex));
420422
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
@@ -720,6 +722,7 @@ buf_flush_write_complete(
720722
buf_page_set_io_fix(bpage, BUF_IO_NONE);
721723

722724
buf_pool->n_flush[flush_type]--;
725+
ut_ad(buf_pool->n_flush[flush_type] != ULINT_MAX);
723726

724727
if (buf_pool->n_flush[flush_type] == 0
725728
&& buf_pool->init_flush[flush_type] == FALSE) {
@@ -1054,6 +1057,7 @@ buf_flush_page(
10541057
}
10551058

10561059
++buf_pool->n_flush[flush_type];
1060+
ut_ad(buf_pool->n_flush[flush_type] != 0);
10571061

10581062
mutex_exit(&buf_pool->flush_state_mutex);
10591063

@@ -2196,13 +2200,14 @@ Clears up tail of the LRU lists:
21962200
* Flush dirty pages at the tail of LRU to the disk
21972201
The depth to which we scan each buffer pool is controlled by dynamic
21982202
config parameter innodb_LRU_scan_depth.
2199-
@return number of pages flushed */
2203+
@return number of flushed and evicted pages */
22002204
UNIV_INTERN
22012205
ulint
22022206
buf_flush_LRU_tail(void)
22032207
/*====================*/
22042208
{
22052209
ulint total_flushed = 0;
2210+
ulint total_evicted = 0;
22062211
ulint start_time = ut_time_ms();
22072212
ulint scan_depth[MAX_BUFFER_POOLS];
22082213
ulint requested_pages[MAX_BUFFER_POOLS];
@@ -2268,6 +2273,7 @@ buf_flush_LRU_tail(void)
22682273
limited_scan[i]
22692274
= (previous_evicted[i] > n.evicted);
22702275
previous_evicted[i] = n.evicted;
2276+
total_evicted += n.evicted;
22712277

22722278
requested_pages[i] += lru_chunk_size;
22732279

@@ -2300,7 +2306,7 @@ buf_flush_LRU_tail(void)
23002306
MONITOR_LRU_BATCH_PAGES,
23012307
total_flushed);
23022308
}
2303-
return(total_flushed);
2309+
return(total_flushed + total_evicted);
23042310
}
23052311

23062312
/*********************************************************************//**
@@ -2601,6 +2607,23 @@ buf_get_total_free_list_length(void)
26012607
return result;
26022608
}
26032609

2610+
/** Returns the aggregate LRU list length over all buffer pool instances.
2611+
@return total LRU list length. */
2612+
MY_ATTRIBUTE((warn_unused_result))
2613+
static
2614+
ulint
2615+
buf_get_total_LRU_list_length(void)
2616+
{
2617+
ulint result = 0;
2618+
2619+
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
2620+
2621+
result += UT_LIST_GET_LEN(buf_pool_from_array(i)->LRU);
2622+
}
2623+
2624+
return result;
2625+
}
2626+
26042627
/*********************************************************************//**
26052628
Adjust the desired page cleaner thread sleep time for LRU flushes. */
26062629
MY_ATTRIBUTE((nonnull))
@@ -2613,8 +2636,9 @@ page_cleaner_adapt_lru_sleep_time(
26132636
ulint lru_n_flushed) /*!< in: number of flushed in previous batch */
26142637

26152638
{
2616-
ulint free_len = buf_get_total_free_list_length();
2617-
ulint max_free_len = srv_LRU_scan_depth * srv_buf_pool_instances;
2639+
ulint free_len = buf_get_total_free_list_length();
2640+
ulint max_free_len = ut_min(buf_get_total_LRU_list_length(),
2641+
srv_LRU_scan_depth * srv_buf_pool_instances);
26182642

26192643
if (free_len < max_free_len / 100 && lru_n_flushed) {
26202644

@@ -2626,7 +2650,7 @@ page_cleaner_adapt_lru_sleep_time(
26262650

26272651
/* Free lists filled more than 20%
26282652
or no pages flushed in previous batch, sleep a bit more */
2629-
*lru_sleep_time += 50;
2653+
*lru_sleep_time += 1;
26302654
if (*lru_sleep_time > srv_cleaner_max_lru_time)
26312655
*lru_sleep_time = srv_cleaner_max_lru_time;
26322656
} else if (free_len < max_free_len / 20 && *lru_sleep_time >= 50) {
@@ -2673,6 +2697,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
26732697
/*!< in: a dummy parameter required by
26742698
os_thread_create */
26752699
{
2700+
my_thread_init();
26762701
ulint next_loop_time = ut_time_ms() + 1000;
26772702
ulint n_flushed = 0;
26782703
ulint last_activity = srv_get_activity_count();
@@ -2806,6 +2831,7 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
28062831
thread_exit:
28072832
buf_page_cleaner_is_active = FALSE;
28082833

2834+
my_thread_end();
28092835
/* We count the number of threads in os_thread_exit(). A created
28102836
thread should always use that to exit and not use return() to exit. */
28112837
os_thread_exit(NULL);

storage/xtradb/dict/dict0boot.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2017, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
@@ -461,7 +461,10 @@ dict_boot(void)
461461

462462
dberr_terr = DB_SUCCESS;
463463

464-
if (srv_read_only_mode && !ibuf_is_empty()) {
464+
/** If innodb_force_recovery is set to 6 then allow
465+
the server to start even though ibuf is not empty. */
466+
if (srv_force_recovery != SRV_FORCE_NO_LOG_REDO
467+
&& srv_read_only_mode && !ibuf_is_empty()) {
465468

466469
ib_logf(IB_LOG_LEVEL_ERROR,
467470
"Change buffer must be empty when --innodb-read-only "

storage/xtradb/dict/dict0dict.cc

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -876,16 +876,24 @@ dict_index_get_nth_col_or_prefix_pos(
876876
/*=================================*/
877877
const dict_index_t* index,/*!< in: index */
878878
ulint n,/*!< in: column number */
879-
ibool inc_prefix)/*!< in: TRUE=consider
879+
ibool inc_prefix,/*!< in: TRUE=consider
880880
column prefixes too */
881+
ulint* prefix_col_pos)/*!< out: col num if prefix */
881882
{
882883
const dict_field_t* field;
883884
const dict_col_t* col;
884885
ulint pos;
885886
ulint n_fields;
887+
ulint prefixed_pos_dummy;
886888

887889
ut_ad(index);
888890
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
891+
ut_ad((inc_prefix && !prefix_col_pos) || (!inc_prefix));
892+
893+
if (!prefix_col_pos) {
894+
prefix_col_pos = &prefixed_pos_dummy;
895+
}
896+
*prefix_col_pos = ULINT_UNDEFINED;
889897

890898
col = dict_table_get_nth_col(index->table, n);
891899

@@ -899,10 +907,11 @@ dict_index_get_nth_col_or_prefix_pos(
899907
for (pos = 0; pos < n_fields; pos++) {
900908
field = dict_index_get_nth_field(index, pos);
901909

902-
if (col == field->col
903-
&& (inc_prefix || field->prefix_len == 0)) {
904-
905-
return(pos);
910+
if (col == field->col) {
911+
*prefix_col_pos = pos;
912+
if (inc_prefix || field->prefix_len == 0) {
913+
return(pos);
914+
}
906915
}
907916
}
908917

@@ -1046,7 +1055,7 @@ dict_table_get_nth_col_pos(
10461055
ulint n)/*!< in: column number */
10471056
{
10481057
return(dict_index_get_nth_col_pos(dict_table_get_first_index(table),
1049-
n));
1058+
n, NULL));
10501059
}
10511060

10521061
/********************************************************************//**

storage/xtradb/dict/dict0stats.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 2009, 2017, 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
@@ -1110,10 +1110,10 @@ dict_stats_analyze_index_level(
11101110
leaf-level delete marks because delete marks on
11111111
non-leaf level do not make sense. */
11121112

1113-
if (level == 0 && srv_stats_include_delete_marked? 0:
1113+
if (level == 0 && (srv_stats_include_delete_marked ? 0:
11141114
rec_get_deleted_flag(
11151115
rec,
1116-
page_is_comp(btr_pcur_get_page(&pcur)))) {
1116+
page_is_comp(btr_pcur_get_page(&pcur))))) {
11171117

11181118
if (rec_is_last_on_page
11191119
&& !prev_rec_is_copied

storage/xtradb/dict/dict0stats_bg.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
55
66
This program is free software; you can redistribute it and/or modify it under
@@ -336,6 +336,7 @@ DECLARE_THREAD(dict_stats_thread)(
336336
void* arg MY_ATTRIBUTE((unused)))/*!< in: a dummy parameter
337337
required by os_thread_create */
338338
{
339+
my_thread_init();
339340
ut_a(!srv_read_only_mode);
340341

341342
srv_dict_stats_thread_active = TRUE;
@@ -361,6 +362,7 @@ DECLARE_THREAD(dict_stats_thread)(
361362

362363
srv_dict_stats_thread_active = FALSE;
363364

365+
my_thread_end();
364366
/* We count the number of threads in os_thread_exit(). A created
365367
thread should always use that to exit instead of return(). */
366368
os_thread_exit(NULL);

0 commit comments

Comments
 (0)