Skip to content

Commit 643d365

Browse files
committed
Merge 11.4 into 11.8
2 parents ff33f49 + 4369a38 commit 643d365

Some content is hidden

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

80 files changed

+1117
-1231
lines changed

extra/mariabackup/xtrabackup.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,12 @@ void CorruptedPages::zero_out_free_pages()
664664
if (!space)
665665
die("Can't find space object for space name %s to check corrupted page",
666666
space_name.c_str());
667+
mtr_t mtr{nullptr};
667668
for (std::set<unsigned>::const_iterator page_it=
668669
space_it->second.pages.begin();
669670
page_it != space_it->second.pages.end(); ++page_it)
670671
{
671-
if (fseg_page_is_allocated(space, *page_it))
672+
if (fseg_page_is_allocated(&mtr, space, *page_it))
672673
{
673674
space_info_t &space_info = non_free_pages[space_id];
674675
space_info.pages.insert(*page_it);

mysql-test/main/rowid_filter_innodb,ahi.rdiff

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
"r_table_time_ms": "REPLACED",
1414
"r_other_time_ms": "REPLACED",
1515
"r_engine_stats": {
16-
- "pages_accessed": 84
17-
+ "pages_accessed": 6
16+
- "pages_accessed": 90
17+
+ "pages_accessed": 51
1818
},
1919
"filtered": "REPLACED",
2020
"r_total_filtered": 2.43902439,
2121
@@ -2227,7 +2227,7 @@
2222
"r_table_time_ms": "REPLACED",
2323
"r_other_time_ms": "REPLACED",
2424
"r_engine_stats": {
25-
- "pages_accessed": 84
26-
+ "pages_accessed": 2
25+
- "pages_accessed": 90
26+
+ "pages_accessed": 49
2727
},
2828
"filtered": "REPLACED",
2929
"r_total_filtered": 2.43902439,

mysql-test/main/rowid_filter_innodb.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ ANALYZE
20612061
"r_table_time_ms": "REPLACED",
20622062
"r_other_time_ms": "REPLACED",
20632063
"r_engine_stats": {
2064-
"pages_accessed": 84
2064+
"pages_accessed": 90
20652065
},
20662066
"filtered": "REPLACED",
20672067
"r_total_filtered": 2.43902439,
@@ -2093,7 +2093,7 @@ ANALYZE
20932093
"r_table_time_ms": "REPLACED",
20942094
"r_other_time_ms": "REPLACED",
20952095
"r_engine_stats": {
2096-
"pages_accessed": 2
2096+
"pages_accessed": 4
20972097
},
20982098
"filtered": "REPLACED",
20992099
"r_total_filtered": 66.66666667,
@@ -2229,7 +2229,7 @@ ANALYZE
22292229
"r_table_time_ms": "REPLACED",
22302230
"r_other_time_ms": "REPLACED",
22312231
"r_engine_stats": {
2232-
"pages_accessed": 84
2232+
"pages_accessed": 90
22332233
},
22342234
"filtered": "REPLACED",
22352235
"r_total_filtered": 2.43902439,
@@ -2261,7 +2261,7 @@ ANALYZE
22612261
"r_table_time_ms": "REPLACED",
22622262
"r_other_time_ms": "REPLACED",
22632263
"r_engine_stats": {
2264-
"pages_accessed": 2
2264+
"pages_accessed": 4
22652265
},
22662266
"filtered": "REPLACED",
22672267
"r_total_filtered": 66.66666667,

mysql-test/suite/innodb/r/innodb_force_recovery.result

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,26 @@ insert into t1 values(1, 2);
44
insert into t2 values(1, 2);
55
SET GLOBAL innodb_fast_shutdown = 0;
66
# restart: --innodb-force-recovery=4
7-
SELECT CAST(variable_value AS INTEGER) INTO @read1
8-
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
9-
WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
7+
select variable_name,variable_value from information_schema.global_status
8+
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests';
9+
variable_name variable_value
10+
INNODB_BUFFER_POOL_READ_REQUESTS 0
11+
INNODB_BUFFER_POOL_WRITE_REQUESTS 0
1012
select * from t1;
1113
f1 f2
1214
1 2
13-
SELECT CAST(variable_value AS INTEGER) INTO @read2
14-
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
15-
WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
16-
SELECT @read1>0, @read2>@read1;
17-
@read1>0 @read2>@read1
18-
1 1
15+
select variable_name from information_schema.global_status
16+
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0;
17+
variable_name
18+
INNODB_BUFFER_POOL_READ_REQUESTS
1919
begin;
2020
insert into t1 values(2, 3);
2121
rollback;
22+
select variable_name from information_schema.global_status
23+
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0;
24+
variable_name
25+
INNODB_BUFFER_POOL_READ_REQUESTS
26+
INNODB_BUFFER_POOL_WRITE_REQUESTS
2227
alter table t1 add f3 int not null, algorithm=copy;
2328
alter table t1 add f4 int not null, algorithm=inplace;
2429
drop index idx on t1;

mysql-test/suite/innodb/t/innodb_force_recovery.test

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,17 @@ SET GLOBAL innodb_fast_shutdown = 0;
2121
--source include/restart_mysqld.inc
2222
let $status=`SHOW ENGINE INNODB STATUS`;
2323

24-
--disable_cursor_protocol
25-
SELECT CAST(variable_value AS INTEGER) INTO @read1
26-
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
27-
WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
28-
--enable_cursor_protocol
29-
24+
select variable_name,variable_value from information_schema.global_status
25+
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests';
3026
select * from t1;
31-
32-
--disable_cursor_protocol
33-
SELECT CAST(variable_value AS INTEGER) INTO @read2
34-
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
35-
WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests';
36-
--enable_cursor_protocol
37-
38-
SELECT @read1>0, @read2>@read1;
27+
select variable_name from information_schema.global_status
28+
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0;
3929

4030
begin;
4131
insert into t1 values(2, 3);
4232
rollback;
33+
select variable_name from information_schema.global_status
34+
WHERE variable_name LIKE 'innodb_buffer_pool_%_requests' and variable_value>0;
4335

4436
alter table t1 add f3 int not null, algorithm=copy;
4537

storage/innobase/btr/btr0btr.cc

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Created 6/2/1994 Heikki Tuuri
3838
#include "lock0lock.h"
3939
#include "trx0trx.h"
4040
#include "srv0mon.h"
41+
#include "que0que.h"
4142
#include "gis0geo.h"
4243
#include "dict0boot.h"
4344
#include "row0sel.h" /* row_search_max_autoinc() */
@@ -371,14 +372,13 @@ btr_root_fseg_adjust_on_import(
371372

372373
/**************************************************************//**
373374
Checks and adjusts the root node of a tree during IMPORT TABLESPACE.
374-
@return error code, or DB_SUCCESS */
375-
dberr_t
376-
btr_root_adjust_on_import(
377-
/*======================*/
378-
const dict_index_t* index) /*!< in: index tree */
375+
@param trx transaction
376+
@param index index tree
377+
@return error code */
378+
dberr_t btr_root_adjust_on_import(trx_t *trx, const dict_index_t *index)
379379
{
380380
dberr_t err;
381-
mtr_t mtr;
381+
mtr_t mtr{trx};
382382
page_t* page;
383383
page_zip_des_t* page_zip;
384384
dict_table_t* table = index->table;
@@ -1006,25 +1006,25 @@ btr_create(
10061006
/** Free a B-tree except the root page. The root page MUST be freed after
10071007
this by calling btr_free_root.
10081008
@param[in,out] block root page
1009-
@param[in] log_mode mtr logging mode */
1009+
@param[in] outer_mtr surrounding mini-transaction */
10101010
static
10111011
void
10121012
btr_free_but_not_root(
10131013
buf_block_t* block,
1014-
mtr_log_t log_mode
1014+
const mtr_t& outer_mtr
10151015
#ifdef BTR_CUR_HASH_ADAPT
10161016
,bool ahi=false
10171017
#endif
10181018
)
10191019
{
1020-
mtr_t mtr;
1020+
mtr_t mtr{outer_mtr.trx};
10211021

10221022
ut_ad(fil_page_index_page_check(block->page.frame));
10231023
ut_ad(!page_has_siblings(block->page.frame));
10241024
leaf_loop:
10251025
mtr_start(&mtr);
10261026
ut_d(mtr.freeing_tree());
1027-
mtr_set_log_mode(&mtr, log_mode);
1027+
mtr_set_log_mode(&mtr, outer_mtr.get_log_mode());
10281028
fil_space_t *space = mtr.set_named_space_id(block->page.id().space());
10291029

10301030
if (!btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF,
@@ -1052,7 +1052,7 @@ btr_free_but_not_root(
10521052
}
10531053
top_loop:
10541054
mtr_start(&mtr);
1055-
mtr_set_log_mode(&mtr, log_mode);
1055+
mtr_set_log_mode(&mtr, outer_mtr.get_log_mode());
10561056
space = mtr.set_named_space_id(block->page.id().space());
10571057

10581058
finished = !btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP,
@@ -1071,16 +1071,13 @@ btr_free_but_not_root(
10711071
}
10721072
}
10731073

1074-
#ifdef BTR_CUR_HASH_ADAPT
1075-
TRANSACTIONAL_TARGET
1076-
#endif
10771074
/** Clear the index tree and reinitialize the root page, in the
10781075
rollback of TRX_UNDO_EMPTY. The BTR_SEG_LEAF is freed and reinitialized.
10791076
@param thr query thread
10801077
@return error code */
10811078
dberr_t dict_index_t::clear(que_thr_t *thr)
10821079
{
1083-
mtr_t mtr;
1080+
mtr_t mtr{thr_get_trx(thr)};
10841081
mtr.start();
10851082
if (table->is_temporary())
10861083
mtr.set_log_mode(MTR_LOG_NO_REDO);
@@ -1101,7 +1098,7 @@ dberr_t dict_index_t::clear(que_thr_t *thr)
11011098
RW_X_LATCH, guess, BUF_GET, &mtr, &err);
11021099
if (root_block)
11031100
{
1104-
btr_free_but_not_root(root_block, mtr.get_log_mode()
1101+
btr_free_but_not_root(root_block, mtr
11051102
#ifdef BTR_CUR_HASH_ADAPT
11061103
,any_ahi_pages()
11071104
#endif
@@ -1133,19 +1130,20 @@ void btr_free_if_exists(fil_space_t *space, uint32_t page,
11331130
space->zip_size(),
11341131
index_id, mtr))
11351132
{
1136-
btr_free_but_not_root(root, mtr->get_log_mode());
1133+
btr_free_but_not_root(root, *mtr);
11371134
mtr->set_named_space(space);
11381135
btr_free_root(root, *space, mtr);
11391136
}
11401137
}
11411138

11421139
/** Drop a temporary table
1140+
@param trx transaction
11431141
@param table temporary table */
1144-
void btr_drop_temporary_table(const dict_table_t &table)
1142+
void btr_drop_temporary_table(trx_t *trx, const dict_table_t &table)
11451143
{
11461144
ut_ad(table.is_temporary());
11471145
ut_ad(table.space == fil_system.temp_space);
1148-
mtr_t mtr;
1146+
mtr_t mtr{trx};
11491147
mtr.start();
11501148
for (const dict_index_t *index= table.indexes.start; index;
11511149
index= dict_table_get_next_index(index))
@@ -1159,8 +1157,8 @@ void btr_drop_temporary_table(const dict_table_t &table)
11591157
0, RW_X_LATCH, guess, BUF_GET,
11601158
&mtr, nullptr))
11611159
{
1162-
btr_free_but_not_root(block, MTR_LOG_NO_REDO);
11631160
mtr.set_log_mode(MTR_LOG_NO_REDO);
1161+
btr_free_but_not_root(block, mtr);
11641162
btr_free_root(block, *fil_system.temp_space, &mtr);
11651163
mtr.commit();
11661164
mtr.start();
@@ -1179,7 +1177,7 @@ btr_read_autoinc(dict_index_t* index)
11791177
ut_ad(index->is_primary());
11801178
ut_ad(index->table->persistent_autoinc);
11811179
ut_ad(!index->table->is_temporary());
1182-
mtr_t mtr;
1180+
mtr_t mtr{nullptr};
11831181
mtr.start();
11841182
dberr_t err;
11851183
uint64_t autoinc;
@@ -1217,7 +1215,7 @@ uint64_t btr_read_autoinc_with_fallback(const dict_table_t *table,
12171215
ut_ad(!table->is_temporary());
12181216

12191217
uint64_t autoinc= 0;
1220-
mtr_t mtr;
1218+
mtr_t mtr{nullptr};
12211219
mtr.start();
12221220
const dict_index_t *const first_index= dict_table_get_first_index(table);
12231221

@@ -1260,19 +1258,20 @@ uint64_t btr_read_autoinc_with_fallback(const dict_table_t *table,
12601258
}
12611259

12621260
/** Write the next available AUTO_INCREMENT value to PAGE_ROOT_AUTO_INC.
1261+
@param[in,out] trx transaction
12631262
@param[in,out] index clustered index
12641263
@param[in] autoinc the AUTO_INCREMENT value
12651264
@param[in] reset whether to reset the AUTO_INCREMENT
12661265
to a possibly smaller value than currently
12671266
exists in the page */
1268-
void
1269-
btr_write_autoinc(dict_index_t* index, ib_uint64_t autoinc, bool reset)
1267+
void btr_write_autoinc(trx_t *trx, dict_index_t *index, uint64_t autoinc,
1268+
bool reset)
12701269
{
12711270
ut_ad(index->is_primary());
12721271
ut_ad(index->table->persistent_autoinc);
12731272
ut_ad(!index->table->is_temporary());
12741273

1275-
mtr_t mtr;
1274+
mtr_t mtr{trx};
12761275
mtr.start();
12771276
fil_space_t *space= index->table->space;
12781277
if (buf_block_t *root= buf_page_get(page_id_t(space->id, index->page),
@@ -4360,8 +4359,6 @@ btr_print_index(
43604359
}
43614360

43624361
mtr_commit(&mtr);
4363-
4364-
ut_ad(btr_validate_index(index, 0));
43654362
}
43664363
#endif /* UNIV_BTR_PRINT */
43674364

@@ -4706,7 +4703,7 @@ dberr_t
47064703
btr_validate_level(
47074704
/*===============*/
47084705
dict_index_t* index, /*!< in: index tree */
4709-
const trx_t* trx, /*!< in: transaction or NULL */
4706+
trx_t* trx, /*!< in: transaction */
47104707
ulint level) /*!< in: level number */
47114708
{
47124709
buf_block_t* block;
@@ -4719,7 +4716,7 @@ btr_validate_level(
47194716
rec_t* rec;
47204717
page_cur_t cursor;
47214718
dtuple_t* node_ptr_tuple;
4722-
mtr_t mtr;
4719+
mtr_t mtr{trx};
47234720
mem_heap_t* heap = mem_heap_create(256);
47244721
rec_offs* offsets = NULL;
47254722
rec_offs* offsets2= NULL;
@@ -4744,7 +4741,7 @@ btr_validate_level(
47444741
while (level != btr_page_get_level(page)) {
47454742
const rec_t* node_ptr;
47464743
switch (dberr_t e =
4747-
fseg_page_is_allocated(space,
4744+
fseg_page_is_allocated(&mtr, space,
47484745
block->page.id().page_no())) {
47494746
case DB_SUCCESS_LOCKED_REC:
47504747
break;
@@ -4834,7 +4831,8 @@ btr_validate_level(
48344831
#endif /* UNIV_ZIP_DEBUG */
48354832

48364833
if (DB_SUCCESS_LOCKED_REC
4837-
!= fseg_page_is_allocated(space, block->page.id().page_no())) {
4834+
!= fseg_page_is_allocated(&mtr, space,
4835+
block->page.id().page_no())) {
48384836
btr_validate_report1(index, level, block);
48394837

48404838
ib::warn() << "Page is marked as free";
@@ -5137,9 +5135,9 @@ dberr_t
51375135
btr_validate_index(
51385136
/*===============*/
51395137
dict_index_t* index, /*!< in: index */
5140-
const trx_t* trx) /*!< in: transaction or NULL */
5138+
trx_t* trx) /*!< in: transaction */
51415139
{
5142-
mtr_t mtr;
5140+
mtr_t mtr{trx};
51435141
mtr.start();
51445142

51455143
mtr_x_lock_index(index, &mtr);

0 commit comments

Comments
 (0)