Skip to content

Commit 7e76a58

Browse files
committed
Merge 10.11 into 11.4
2 parents 257f4b3 + ef2f3d2 commit 7e76a58

File tree

10 files changed

+33
-244
lines changed

10 files changed

+33
-244
lines changed

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

Lines changed: 0 additions & 51 deletions
This file was deleted.

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ SYS_TABLES clustered index root page (8):
1212
N_RECS=8; LEVEL=0; INDEX_ID=0x0000000000000001
1313
header=0x01000003008d (NAME=0x696e66696d756d00)
1414
header=0x0000101500d5 (NAME='SYS_FOREIGN',
15-
DB_TRX_ID=0x000000000000,
16-
DB_ROLL_PTR=0x80000000000000,
15+
DB_TRX_ID=0xXXXXXXXXXXXX,
16+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
1717
ID=0x000000000000000b,
1818
N_COLS=0x00000004,
1919
TYPE=0x00000001,
@@ -22,8 +22,8 @@ header=0x0000101500d5 (NAME='SYS_FOREIGN',
2222
CLUSTER_NAME=NULL(0 bytes),
2323
SPACE=0x00000000)
2424
header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
25-
DB_TRX_ID=0x000000000000,
26-
DB_ROLL_PTR=0x80000000000000,
25+
DB_TRX_ID=0xXXXXXXXXXXXX,
26+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
2727
ID=0x000000000000000c,
2828
N_COLS=0x00000004,
2929
TYPE=0x00000001,
@@ -32,8 +32,8 @@ header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
3232
CLUSTER_NAME=NULL(0 bytes),
3333
SPACE=0x00000000)
3434
header=0x0000201501ae (NAME='SYS_VIRTUAL',
35-
DB_TRX_ID=0x000000000000,
36-
DB_ROLL_PTR=0x80000000000000,
35+
DB_TRX_ID=0xXXXXXXXXXXXX,
36+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
3737
ID=0x000000000000000d,
3838
N_COLS=0x00000003,
3939
TYPE=0x00000001,
@@ -42,8 +42,8 @@ header=0x0000201501ae (NAME='SYS_VIRTUAL',
4242
CLUSTER_NAME=NULL(0 bytes),
4343
SPACE=0x00000000)
4444
header=0x0400301501f2 (NAME='test/tc',
45-
DB_TRX_ID=0x000000000000,
46-
DB_ROLL_PTR=0x80000000000000,
45+
DB_TRX_ID=0xXXXXXXXXXXXX,
46+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
4747
ID=0x000000000000000f,
4848
N_COLS=0x80000001,
4949
TYPE=0x00000001,
@@ -52,8 +52,8 @@ header=0x0400301501f2 (NAME='test/tc',
5252
CLUSTER_NAME=NULL(0 bytes),
5353
SPACE=0x00000002)
5454
header=0x00003815027a (NAME='test/td',
55-
DB_TRX_ID=0x000000000000,
56-
DB_ROLL_PTR=0x80000000000000,
55+
DB_TRX_ID=0xXXXXXXXXXXXX,
56+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
5757
ID=0x0000000000000010,
5858
N_COLS=0x80000001,
5959
TYPE=0x00000021,
@@ -62,8 +62,8 @@ header=0x00003815027a (NAME='test/td',
6262
CLUSTER_NAME=NULL(0 bytes),
6363
SPACE=0x00000003)
6464
header=0x00004815016a (NAME='test/tp',
65-
DB_TRX_ID=0x000000000000,
66-
DB_ROLL_PTR=0x80000000000000,
65+
DB_TRX_ID=0xXXXXXXXXXXXX,
66+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
6767
ID=0x0000000000000012,
6868
N_COLS=0x80000001,
6969
TYPE=0x000009a1,
@@ -72,8 +72,8 @@ header=0x00004815016a (NAME='test/tp',
7272
CLUSTER_NAME=NULL(0 bytes),
7373
SPACE=0x00000005)
7474
header=0x000028150236 (NAME='test/tr',
75-
DB_TRX_ID=0x000000000000,
76-
DB_ROLL_PTR=0x80000000000000,
75+
DB_TRX_ID=0xXXXXXXXXXXXX,
76+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
7777
ID=0x000000000000000e,
7878
N_COLS=0x00000001,
7979
TYPE=0x00000001,
@@ -82,8 +82,8 @@ header=0x000028150236 (NAME='test/tr',
8282
CLUSTER_NAME=NULL(0 bytes),
8383
SPACE=0x00000001)
8484
header=0x000040150074 (NAME='test/tz',
85-
DB_TRX_ID=0x000000000000,
86-
DB_ROLL_PTR=0x80000000000000,
85+
DB_TRX_ID=0xXXXXXXXXXXXX,
86+
DB_ROLL_PTR=0xXXXXXXXXXXXXXX,
8787
ID=0x0000000000000011,
8888
N_COLS=0x80000001,
8989
TYPE=0x00000023,
@@ -155,6 +155,7 @@ BEGIN;
155155
INSERT INTO tr VALUES(1);
156156
INSERT INTO tc VALUES(1);
157157
INSERT INTO td VALUES(1);
158+
INSERT INTO tz VALUES(1);
158159
INSERT INTO tp VALUES(1);
159160
ROLLBACK;
160161
SELECT * FROM tr;

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

Lines changed: 0 additions & 83 deletions
This file was deleted.

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ for (my $offset= 0x65; $offset;
8989
my $end= unpack("C", substr($page, $offset-7-$i, 1));
9090
print ",\n " if $i;
9191
print "$fields[$i]=";
92-
if ($end & 0x80) {
92+
if ($i == 1 || $i == 2) {
93+
print "0x", "XX" x ($end-$start);
94+
} elsif ($end & 0x80) {
9395
print "NULL(", ($end & 0x7f) - $start, " bytes)"
9496
} elsif ($n_fields > 1 && $i == 0) {
9597
$name= substr($page,$offset+$start,$end-$start);
@@ -210,10 +212,7 @@ BEGIN;
210212
INSERT INTO tr VALUES(1);
211213
INSERT INTO tc VALUES(1);
212214
INSERT INTO td VALUES(1);
213-
# We cannot access tz, because due to our fiddling of the NO_ROLLBACK flag,
214-
# it now has a record with DB_TRX_ID=0, which is invalid for
215-
# transactional tables until MDEV-12288 is implemented.
216-
# INSERT INTO tz VALUES(1);
215+
INSERT INTO tz VALUES(1);
217216
INSERT INTO tp VALUES(1);
218217
ROLLBACK;
219218

storage/innobase/include/trx0trx.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ struct trx_t : ilist_node<>
638638
{
639639
/** The largest encountered transaction identifier for which no
640640
transaction was observed to be active. This is a cache to speed up
641-
trx_sys_t::find_same_or_older().
641+
trx_sys_t::find_same_or_older() as well as to elide some calls to
642+
trx_sys_t::find().
642643
643644
This will be zero-initialized in Pool::Pool() and not initialized
644645
when a transaction object in the pool is freed and reused. The

storage/innobase/lock/lock0lock.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5629,8 +5629,10 @@ lock_rec_queue_validate(
56295629
? lock_clust_rec_some_has_impl(rec, index, offsets)
56305630
: 0;
56315631

5632-
if (trx_t *impl_trx = impl_trx_id
5633-
? trx_sys.find(current_trx(), impl_trx_id, false)
5632+
trx_t *trx= current_trx();
5633+
5634+
if (trx_t *impl_trx = impl_trx_id > (trx ? trx->max_inactive_id : 0)
5635+
? trx_sys.find(trx, impl_trx_id, false)
56345636
: 0) {
56355637
/* impl_trx could have been committed before we
56365638
acquire its mutex, but not thereafter. */
@@ -6215,7 +6217,7 @@ lock_rec_convert_impl_to_expl(
62156217

62166218
trx_id = lock_clust_rec_some_has_impl(rec, index, offsets);
62176219

6218-
if (trx_id == 0) {
6220+
if (trx_id <= caller_trx->max_inactive_id) {
62196221
return nullptr;
62206222
}
62216223
if (UNIV_UNLIKELY(trx_id == caller_trx->id)) {

storage/innobase/row/row0merge.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,8 +2413,7 @@ row_merge_read_clustered_index(
24132413
} else if (rec_trx_id < trx->id) {
24142414
/* Reset the DB_TRX_ID,DB_ROLL_PTR of old rows
24152415
for which history is not going to be
2416-
available after the rebuild operation.
2417-
This essentially mimics row_purge_reset_trx_id(). */
2416+
available after the rebuild operation. */
24182417
row->fields[new_trx_id_col].data
24192418
= const_cast<byte*>(reset_trx_id);
24202419
row->fields[new_trx_id_col + 1].data

storage/innobase/row/row0purge.cc

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,78 +1032,6 @@ bool row_purge_del_mark(purge_node_t *node)
10321032
return result;
10331033
}
10341034

1035-
/** Reset DB_TRX_ID, DB_ROLL_PTR of a clustered index record
1036-
whose old history can no longer be observed.
1037-
@param[in,out] node purge node
1038-
@param[in,out] mtr mini-transaction (will be started and committed) */
1039-
static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr)
1040-
{
1041-
/* Reset DB_TRX_ID, DB_ROLL_PTR for old records. */
1042-
mtr->start();
1043-
1044-
if (row_purge_reposition_pcur(BTR_MODIFY_LEAF, node, mtr)) {
1045-
dict_index_t* index = dict_table_get_first_index(
1046-
node->table);
1047-
ulint trx_id_pos = index->n_uniq ? index->n_uniq : 1;
1048-
rec_t* rec = btr_pcur_get_rec(&node->pcur);
1049-
mem_heap_t* heap = NULL;
1050-
/* Reserve enough offsets for the PRIMARY KEY and 2 columns
1051-
so that we can access DB_TRX_ID, DB_ROLL_PTR. */
1052-
rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 3];
1053-
rec_offs_init(offsets_);
1054-
rec_offs* offsets = rec_get_offsets(
1055-
rec, index, offsets_, index->n_core_fields,
1056-
trx_id_pos + 2, &heap);
1057-
ut_ad(heap == NULL);
1058-
1059-
ut_ad(dict_index_get_nth_field(index, trx_id_pos)
1060-
->col->mtype == DATA_SYS);
1061-
ut_ad(dict_index_get_nth_field(index, trx_id_pos)
1062-
->col->prtype == (DATA_TRX_ID | DATA_NOT_NULL));
1063-
ut_ad(dict_index_get_nth_field(index, trx_id_pos + 1)
1064-
->col->mtype == DATA_SYS);
1065-
ut_ad(dict_index_get_nth_field(index, trx_id_pos + 1)
1066-
->col->prtype == (DATA_ROLL_PTR | DATA_NOT_NULL));
1067-
1068-
/* Only update the record if DB_ROLL_PTR matches (the
1069-
record has not been modified after this transaction
1070-
became purgeable) */
1071-
if (node->roll_ptr
1072-
== row_get_rec_roll_ptr(rec, index, offsets)) {
1073-
ut_ad(!rec_get_deleted_flag(
1074-
rec, rec_offs_comp(offsets))
1075-
|| rec_is_alter_metadata(rec, *index));
1076-
DBUG_LOG("purge", "reset DB_TRX_ID="
1077-
<< ib::hex(row_get_rec_trx_id(
1078-
rec, index, offsets)));
1079-
1080-
index->set_modified(*mtr);
1081-
buf_block_t* block = btr_pcur_get_block(&node->pcur);
1082-
if (UNIV_LIKELY_NULL(block->page.zip.data)) {
1083-
page_zip_write_trx_id_and_roll_ptr(
1084-
block, rec, offsets, trx_id_pos,
1085-
0, 1ULL << ROLL_PTR_INSERT_FLAG_POS,
1086-
mtr);
1087-
} else {
1088-
ulint len;
1089-
byte* ptr = rec_get_nth_field(
1090-
rec, offsets, trx_id_pos, &len);
1091-
ut_ad(len == DATA_TRX_ID_LEN);
1092-
size_t offs = ptr - block->page.frame;
1093-
mtr->memset(block, offs, DATA_TRX_ID_LEN, 0);
1094-
offs += DATA_TRX_ID_LEN;
1095-
mtr->write<1,mtr_t::MAYBE_NOP>(
1096-
*block, block->page.frame + offs,
1097-
0x80U);
1098-
mtr->memset(block, offs + 1,
1099-
DATA_ROLL_PTR_LEN - 1, 0);
1100-
}
1101-
}
1102-
}
1103-
1104-
mtr->commit();
1105-
}
1106-
11071035
/***********************************************************//**
11081036
Purges an update of an existing record. Also purges an update of a delete
11091037
marked record if that record contained an externally stored field. */
@@ -1233,8 +1161,6 @@ row_purge_upd_exist_or_extern_func(
12331161
mtr.commit();
12341162
}
12351163
}
1236-
1237-
row_purge_reset_trx_id(node, &mtr);
12381164
}
12391165

12401166
#ifdef UNIV_DEBUG
@@ -1530,8 +1456,6 @@ row_purge_record_func(
15301456
/* fall through */
15311457
default:
15321458
if (!updated_extern) {
1533-
mtr_t mtr;
1534-
row_purge_reset_trx_id(node, &mtr);
15351459
break;
15361460
}
15371461
/* fall through */

0 commit comments

Comments
 (0)