summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-01-03 11:46:31 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-01-03 11:56:24 +0200
commitd361401bc26f49480daec8b0307afff6edae2ecc (patch)
tree32fe757102f56b144401a4576956477370978bea
parent7a9fee9853c19c1d6d547cd17f87e9bd8f4ebbaa (diff)
parent016caa3d202ee1f020ff84613b345c8f3bacdce3 (diff)
downloadmariadb-git-d361401bc26f49480daec8b0307afff6edae2ecc.tar.gz
Merge 10.1 into 10.2, with some MDEV-14799 fixupsmariadb-10.2.12
trx_undo_page_report_modify(): For SPATIAL INDEX, keep logging updated off-page columns twice, so that the minimum bounding rectangle (MBR) will be logged. Avoiding the redundant logging would require larger changes to the undo log format. row_build_index_entry_low(): Handle SPATIAL_UNKNOWN more robustly, by refusing to purge the record from the spatial index. We can get this code when processing old undo log from 10.2.10 or 10.2.11 (the releases affected by MDEV-14799, which was a regression from MDEV-14051).
-rw-r--r--man/mysqladmin.1186
-rw-r--r--mysql-test/include/truncate_file.inc11
-rw-r--r--mysql-test/r/ps.result18
-rw-r--r--mysql-test/suite/innodb/r/purge_secondary.result148
-rw-r--r--mysql-test/suite/innodb/t/purge_secondary.opt1
-rw-r--r--mysql-test/suite/innodb/t/purge_secondary.test131
-rw-r--r--mysql-test/suite/rpl/t/rpl_manual_change_index_file.test2
-rw-r--r--mysql-test/t/ps.test15
-rw-r--r--mysql-test/unstable-tests1
-rw-r--r--sql/sql_class.cc9
-rw-r--r--sql/sql_derived.cc53
-rw-r--r--sql/table.cc3
-rw-r--r--sql/table.h6
-rw-r--r--storage/innobase/include/trx0rec.h3
-rw-r--r--storage/innobase/row/row0purge.cc4
-rw-r--r--storage/innobase/row/row0row.cc6
-rw-r--r--storage/innobase/trx/trx0rec.cc79
-rw-r--r--storage/xtradb/include/trx0rec.h3
-rw-r--r--storage/xtradb/row/row0purge.cc4
-rw-r--r--storage/xtradb/trx/trx0rec.cc14
20 files changed, 642 insertions, 55 deletions
diff --git a/man/mysqladmin.1 b/man/mysqladmin.1
index 85ab1e0e7dc..3c4f3b3ea1f 100644
--- a/man/mysqladmin.1
+++ b/man/mysqladmin.1
@@ -1,6 +1,6 @@
'\" t
.\"
-.TH "\FBMYSQLADMIN\FR" "1" "3 April 2017" "MariaDB 10\&.2" "MariaDB Database System"
+.TH "\FBMYSQLADMIN\FR" "1" "28 December 2017" "MariaDB 10\&.2" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -106,6 +106,97 @@ Display the server status variables and their values\&.
.sp -1
.IP \(bu 2.3
.\}
+flush\-all\-statistics
+.sp
+Flush all statistics tables\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-all\-status
+.sp
+Flush all status and statistics\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-binary\-log
+.sp
+Flush the binary log\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-client\-statistics
+.sp
+Flush client statistics\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-engine\-log
+.sp
+Flush engine log\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-error\-log
+.sp
+Flush error log\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-general\-log
+.sp
+Flush general query log\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
flush\-hosts
.sp
Flush all information in the host cache\&.
@@ -119,6 +210,19 @@ Flush all information in the host cache\&.
.sp -1
.IP \(bu 2.3
.\}
+flush\-index\-statistics
+.sp
+Flush index statistics\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
flush\-logs
.sp
Flush all logs\&.
@@ -146,6 +250,32 @@ reload)\&.
.sp -1
.IP \(bu 2.3
.\}
+flush\-relay\-log
+.sp
+Flush relay log\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+flush\-slow\-log
+.sp
+Flush slow query log\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
flush\-status
.sp
Clear status variables\&.
@@ -159,6 +289,19 @@ Clear status variables\&.
.sp -1
.IP \(bu 2.3
.\}
+flush\-table\-statistics
+.sp
+Flush table statistics\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
flush\-tables
.sp
Flush all tables\&.
@@ -185,6 +328,19 @@ Flush the thread cache\&.
.sp -1
.IP \(bu 2.3
.\}
+flush\-user\-resources
+.sp
+Flush user resources\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
kill \fIid\fR,\fIid\fR,\&.\&.\&.
.sp
Kill server threads\&. If multiple thread ID values are given, there must be no spaces in the list\&.
@@ -344,6 +500,19 @@ Stop the server\&.
.sp -1
.IP \(bu 2.3
.\}
+start\-all\-slaves
+.sp
+Start all slaves\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
start\-slave
.sp
Start replication on a slave server\&.
@@ -370,6 +539,19 @@ Display a short server status message\&.
.sp -1
.IP \(bu 2.3
.\}
+stop\-all\-slaves
+.sp
+Stop all slaves\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
stop\-slave
.sp
Stop replication on a slave server\&.
@@ -821,7 +1003,7 @@ Connect to the MariaDB server on the given host\&.
\fB\-\-local\fR,
\fB\-l\fR
.sp
-Suppress the SQL command(s) from being written to the binary log by enabling sql_log_bin=0 for the session\&.
+Suppress the SQL command(s) from being written to the binary log by using FLUSH LOCAL or enabling sql_log_bin=0 for the session\&.
.RE
.sp
.RS 4
diff --git a/mysql-test/include/truncate_file.inc b/mysql-test/include/truncate_file.inc
index 2326d6c0b94..fe88cb05bd9 100644
--- a/mysql-test/include/truncate_file.inc
+++ b/mysql-test/include/truncate_file.inc
@@ -1,16 +1,11 @@
# truncate a giving file, all contents of the file are be cleared
-if (!$file)
+if (!$TRUNCATE_FILE)
{
- --echo Please assign a file name to $file!!
- exit;
+ die TRUNCATE_FILE is not set;
}
-let TRUNCATE_FILE= $file;
-
perl;
-use Env;
-Env::import('TRUNCATE_FILE');
-open FILE, '>', $TRUNCATE_FILE || die "Can not open file $file";
+open FILE, '>', $ENV{TRUNCATE_FILE} or die "open(>$ENV{TRUNCATE_FILE}): $!";
close FILE;
EOF
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 5ddc52579bc..1958cafca1e 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -4345,6 +4345,24 @@ set join_cache_level=@join_cache_level_save;
deallocate prepare stmt;
drop view v1,v2,v3;
drop table t1,t2,t3;
+#
+# MDEV-10657: incorrect result returned with binary protocol
+# (prepared statements)
+#
+create table t1 (code varchar(10) primary key);
+INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3');
+SELECT X.*
+FROM
+(SELECT CODE, RN
+FROM
+(SELECT A.CODE, @cnt := @cnt + 1 AS RN
+FROM t1 A, (SELECT @cnt := 0) C) T
+) X;
+CODE RN
+LINE1 1
+LINE2 2
+LINE3 3
+drop table t1;
# End of 5.5 tests
#
# Start of 10.2 tests
diff --git a/mysql-test/suite/innodb/r/purge_secondary.result b/mysql-test/suite/innodb/r/purge_secondary.result
new file mode 100644
index 00000000000..2312434a2bd
--- /dev/null
+++ b/mysql-test/suite/innodb/r/purge_secondary.result
@@ -0,0 +1,148 @@
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+CREATE TABLE t1 (
+a SERIAL, b CHAR(255) NOT NULL DEFAULT '', c BOOLEAN DEFAULT false,
+l LINESTRING NOT NULL DEFAULT ST_linefromtext('linestring(448 -689,
+ 453 -684,451 -679,453 -677,458 -681,463 -681,468 -678,470 -676,470 -678,
+ 468 -675,472 -675,472 -675,474 -674,479 -676,477 -675,473 -676,475 1324,
+ 479 1319,484 1322,483 1323,486 1323,491 1328,492 1325,496 1325,498 1325,
+ 501 1330,498 1331,500 1331,504 1330,508 1329,512 1332,513 1337,518 1339,
+ 518 1339,513 1344,513 1344,512 1346,514 1351,515 1353,519 1358,518 1362,
+ 522 1365,525 1360,526 1362,527 1362,528 1367,525 1371,528 1366,532 1369,
+ 536 1374,539 1377,543 1379,539 1381,541 1382,543 1383,546 1388,549 1393,
+ 554 1393,554 1395,554 1392,550 1394,550 1392,546 1394,549 1397,550 1393,
+ 549 1394,554 1390,554 1391,549 1396,551 1396,547 1400,547 1402,551 1407,
+ 554 1412,554 1415,558 1418,463 -681,465 -677,465 -675,470 -670,470 -665,
+ 470 -660,470 -659,473 -656,476 -656,481 -655,482 -652,486 -654,486 -652,
+ 486 -648,491 -646,490 -651,494 -646,493 -644,493 -644,490 -644,491 2356,
+ 495 2359,495 2364,500 2359,503 5359,504 5364,509 5368,504 5367,499 5368,
+ 498 5371,498 5369,500 5370,504 5370,508 5370,511 5370,507 5374,508 5378,
+ 511 5382,507 5387,509 5389,512 5388,515 5393,520 5396,517 5397,517 5402,
+ 515 5404,520 5402,521 5405,525 5405,526 5408,530 7408,535 7413,533 7415,
+ 529 7412,532 7416,4532 7416,4534 7421,4533 7417,4536 7413,4536 7418,
+ 4540 3418,4545 3418,4549 3415,4551 3419,4554 3421,4559 3423,4559 3426,
+ 4557 3424,4561 3428,4558 3428,4563 3431,4565 3435,4569 3439,4569 3439,
+ 4569 3444,4567 3444,4572 3446,4577 3447,4581 3444,4581 3448,4584 3448,
+ 4579 3447,4580 3450,4583 3449,4583 3453,4587 3455,4588 3458,4593 3463,
+ 4598 3465,4601 3468,4598 3464,4598 3460,4593 5460,4595 5461,4600 5464,
+ 4600 5465,4601 5466,4606 5466,4608 5466,4605 5464,4608 5467,4607 5468,
+ 4609 5465,4614 5461,4618 5463,4621 5467,4623 5470,4622 5470,4622 5470,
+ 4625 6470,4627 6471,4627 6472,4627 6473,6627 6474,6625 6474,6628 6477,
+ 6633 6481,6633 6480,6637 6475,7637 6479,7638 6482,7643 6487,7644 6492,
+ 7647 6492,7648 6495,7646 6498,7650 6499,7646 6494,7644 6499,7644 6497,
+ 7644 6499,7647 6502,7649 6504,7650 6501,7647 6503,7649 6504,7650 6508,
+ 7651 6503,7652 6508,7655 6508,7650 6511,7655 6515,7658 6513,7663 6513,
+ 7665 6514,7669 6512,7667 6510,7664 6510,472 -675,477 -670,479 -666,
+ 482 -663,484 -668,484 -666,485 -664,481 -664,479 -659,482 -659,484 -658,
+ 483 -659,488 2341,493 2339,489 2338,491 2342,491 2346,494 2346,490 2348,
+ 493 2348,498 2349,498 2350,499 2349,502 2350,503 2348,506 2348,506 2348,
+ 507 2353,507 2355,504 2359,504 2364,504 2361,499 2365,502 2360,502 2358,
+ 503 2357,504 2353,504 2357,500 2356,497 2355,498 2355,500 2359,502 2361,
+ 505 2364,508 2364,506 2368,506 2370,504 2373,499 2373,496 2372,493 2377,
+ 497 2380,495 2383,496 7383,493 7386,497 7391,494 7387,495 7389,498 7392,
+ 498 7392,495 7395,493 7398,498 7401,498 7403,503 7400,498 8400,501 8401,
+ 503 8401,503 8401,501 10401,496 10396,491 10401,492 10399,493 10403,
+ 496 10403,491 10403,493 10407,489 10410,493 10407,489 10403,498 7403,
+ 497 7399,496 7403,500 7405,500 7407,503 7411,508 7415,511 7415,511 7420,
+ 515 7420,520 7423,523 7423,520 7427,523 7427,523 7427,522 7432,525 4432,
+ 527 4434,530 4437,534 4441,529 4446,529 4441,534 4436,537 4436,535 4437,
+ 532 4437,534 4432,535 4429,538 4430,542 4427,542 4431,538 4431,541 4431,
+ 541 4433,543 4433,545 4432,549 4428,552 4426,556 4427,557 4423,560 4427,
+ 561 4428,558 4430,559 4434,559 4432,561 4434,561 4437,563 4435,559 4430,
+ 561 4435,4561 4437,4566 4441,4568 4446,4568 4450,4569 4455,4565 4458,
+ 4561 4463,4561 9463,4564 9463,4565 9461,9565 9463,9560 9467,9560 9466,
+ 9555 9469,9555 9471,9559 9469,9557 9473,9553 9478,9555 9480,9557 9481,
+ 9557 9481,9557 9483,9562 9487,9558 9487,9558 9490,9561 9493,9562 9493,
+ 9557 9493,9560 9496,9555 9501,9553 9503,9553 9506,9557 9510,9558 9511,
+ 9561 9514,9563 9512,9568 9514,9567 9514,9567 13514,9570 13517,9566 13521,
+ 9571 13521,9571 13526,9573 13521,9571 13521,9576 10521,9580 10526,9582 10525,
+ 9584 10528,9584 10531,9584 10533,9589 10533,9588 10537,9588 10541,9589 10542,
+ 9593 10544,9595 10540,9597 10541,9600 10545,9601 15545,9603 15549,9605 15553,
+ 9601 15558,9601 15553,9605 15551,9605 15550,9605 15554,9607 15556,9605 15556,
+ 9604 15561,9607 15559,9603 15559,9603 15562,9604 15563,9608 15566,9612 15570,
+ 9617 15565,9622 15568,9627 15566,9628 15564,9629 15564,9633 15569,9636 15569,
+ 9634 15571,9634 15572,9636 15574,9634 15570,9629 15570,9631 15567,9629 15570,
+ 9626 15574,9626 15575,498 7401,502 7401,506 7397,506 7395,502 7398,497 7401,
+ 502 7402,505 7397,508 7400,504 7404,3504 7409,3505 7405,3508 7410,3511 7413,
+ 3511 7416,3511 7419,3511 7419,3513 7421,3517 7424,3519 7426,3520 11426,
+ 3523 11421,3527 11418,3530 11415,3530 11416,3533 11418,7533 11415,7531 11415,
+ 7531 11417,7536 11420,7541 11424,7543 11425,7543 11427,7543 11429,7540 11429,
+ 7542 11425,7541 11420,7542 11421,7542 11422,7540 11424,7540 11423,7543 11422,
+ 7546 11426,7550 11431,7553 11436,7555 16436,7553 16438,7558 16438,7559 16438,
+ 7560 16439,7565 16437,7560 16435,7563 16435,7566 16440,7566 16444,7564 16447,
+ 7559 16443,7561 16443,7566 16448,7570 16451,7574 16456,7578 16459,
+ 12578 16459,12578 20459,12577 20456,12581 20454,12585 20456,12585 20456,
+ 12585 20456,12583 20456,12579 20459,12580 20461,12580 20462,12580 20460,
+ 12585 20465,12586 20467,12590 20470,12590 20470,12589 20471,12584 20471,
+ 12589 20471,9589 20472,9594 20472,9595 20472,9596 20477,9598 20482,
+ 9603 20480,9608 20484,9613 20484,9610 20486,9608 20488,9608 20489,9610 20489,
+ 9614 20486,9619 20481,9620 20481,9618 21481,9621 21483,9626 21483,9628 21485,
+ 9623 21487,9622 21490,9626 21493,9621 21495,9626 21498,9622 21499,9624 21504,
+ 9625 21499,9629 21501,9633 21498,9637 21495,9639 21498,9644 21501,9557 9481,
+ 9560 9485,9561 9490,9563 9488,9560 9486,9558 9488,9561 9492,9563 9495,
+ 9567 9492,9567 9488,9564 9490,9559 9495,9559 9498,9557 9502,9562 9506,
+ 9564 9509,9569 9512,9569 9516,9569 9518,9569 9515,9571 9513,9571 9512,
+ 9573 9513,9578 9516,9581 9516,9585 11516,9585 11521,9590 10521,9586 10524,
+ 9589 10529,9589 10527,9589 10527,9594 10532,9594 10534,9598 10536,9598 10540,
+ 9600 10542,9604 10538,9607 10538,9609 10543,9613 10538,9613 10533,9613 10537,
+ 9610 10537,9614 10542,9609 10542,9610 10543,9610 10548,9611 10553,9616 7553,
+ 9620 7553,9621 7557,9618 7559,9618 7554,9622 7557,9622 7561,9622 7556,
+ 9622 7560,9619 7560,9620 7565,9622 7563,9627 7566,9630 7570,9630 7571,
+ 9632 7573,9637 7576,9639 7578,9640 7576,9640 7579,9640 7575,9642 7570,
+ 9646 7570,9651 7574,9653 7577,9652 7572,9653 7576,9653 7576,9651 7581,
+ 9656 7585,9660 7586,9659 7591,9657 7594,9661 7598,9664 7602,9668 12602,
+ 9673 12604,9676 12606,9679 12602,9682 12605,9677 12610,9674 12606,9674 12601,
+ 9674 12603,9672 9603,9668 9605,9671 9606,9668 9611,9668 9606,9671 9611,
+ 9675 9615,9677 9620,9678 9622,9679 9624,9684 9626,9685 9627,9685 9622,
+ 9685 9626,9689 9628,9694 9633,9699 9637,9699 9637,9704 9636,9708 9637,
+ 9709 9638,9707 9639,9705 9642,9707 9647,9710 9649,9711 9653,9716 9649,
+ 9716 9648,9720 9650,9721 9648,9723 9648,9726 4648,12726 4653,12731 4655,
+ 12734 4660,12730 4661,12733 4664,12733 4665,12735 4670,12737 4674,12741 4674,
+ 12738 4675,12740 4675,12737 4675,12742 4678,12743 4681,12746 4677)'),
+INDEX(b,c), SPATIAL INDEX(l)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 () VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
+SELECT LENGTH(l) FROM t1;
+LENGTH(l)
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+11197
+INSERT INTO t1 (a) SELECT NULL FROM t1;
+INSERT INTO t1 (a) SELECT NULL FROM t1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+UPDATE t1 SET c=true, l=ST_linefromtext('linestring(0 0,1 1,2 2)');
+DELETE FROM t1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+InnoDB 0 transactions not purged
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+SELECT OTHER_INDEX_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE NAME='test/t1';
+OTHER_INDEX_SIZE
+1
+# Note: The OTHER_INDEX_SIZE does not cover any SPATIAL INDEX.
+# To test that all indexes were emptied, replace DROP TABLE
+# with the following, and examine the root pages in t1.ibd:
+# FLUSH TABLES t1 FOR EXPORT;
+# UNLOCK TABLES;
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/innodb/t/purge_secondary.opt b/mysql-test/suite/innodb/t/purge_secondary.opt
new file mode 100644
index 00000000000..99bf0e5a28b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/purge_secondary.opt
@@ -0,0 +1 @@
+--innodb-sys-tablestats
diff --git a/mysql-test/suite/innodb/t/purge_secondary.test b/mysql-test/suite/innodb/t/purge_secondary.test
new file mode 100644
index 00000000000..47cfaec41ca
--- /dev/null
+++ b/mysql-test/suite/innodb/t/purge_secondary.test
@@ -0,0 +1,131 @@
+--source include/have_innodb.inc
+
+# Ensure that the history list length will actually be decremented by purge.
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+
+CREATE TABLE t1 (
+ a SERIAL, b CHAR(255) NOT NULL DEFAULT '', c BOOLEAN DEFAULT false,
+ l LINESTRING NOT NULL DEFAULT ST_linefromtext('linestring(448 -689,
+ 453 -684,451 -679,453 -677,458 -681,463 -681,468 -678,470 -676,470 -678,
+ 468 -675,472 -675,472 -675,474 -674,479 -676,477 -675,473 -676,475 1324,
+ 479 1319,484 1322,483 1323,486 1323,491 1328,492 1325,496 1325,498 1325,
+ 501 1330,498 1331,500 1331,504 1330,508 1329,512 1332,513 1337,518 1339,
+ 518 1339,513 1344,513 1344,512 1346,514 1351,515 1353,519 1358,518 1362,
+ 522 1365,525 1360,526 1362,527 1362,528 1367,525 1371,528 1366,532 1369,
+ 536 1374,539 1377,543 1379,539 1381,541 1382,543 1383,546 1388,549 1393,
+ 554 1393,554 1395,554 1392,550 1394,550 1392,546 1394,549 1397,550 1393,
+ 549 1394,554 1390,554 1391,549 1396,551 1396,547 1400,547 1402,551 1407,
+ 554 1412,554 1415,558 1418,463 -681,465 -677,465 -675,470 -670,470 -665,
+ 470 -660,470 -659,473 -656,476 -656,481 -655,482 -652,486 -654,486 -652,
+ 486 -648,491 -646,490 -651,494 -646,493 -644,493 -644,490 -644,491 2356,
+ 495 2359,495 2364,500 2359,503 5359,504 5364,509 5368,504 5367,499 5368,
+ 498 5371,498 5369,500 5370,504 5370,508 5370,511 5370,507 5374,508 5378,
+ 511 5382,507 5387,509 5389,512 5388,515 5393,520 5396,517 5397,517 5402,
+ 515 5404,520 5402,521 5405,525 5405,526 5408,530 7408,535 7413,533 7415,
+ 529 7412,532 7416,4532 7416,4534 7421,4533 7417,4536 7413,4536 7418,
+ 4540 3418,4545 3418,4549 3415,4551 3419,4554 3421,4559 3423,4559 3426,
+ 4557 3424,4561 3428,4558 3428,4563 3431,4565 3435,4569 3439,4569 3439,
+ 4569 3444,4567 3444,4572 3446,4577 3447,4581 3444,4581 3448,4584 3448,
+ 4579 3447,4580 3450,4583 3449,4583 3453,4587 3455,4588 3458,4593 3463,
+ 4598 3465,4601 3468,4598 3464,4598 3460,4593 5460,4595 5461,4600 5464,
+ 4600 5465,4601 5466,4606 5466,4608 5466,4605 5464,4608 5467,4607 5468,
+ 4609 5465,4614 5461,4618 5463,4621 5467,4623 5470,4622 5470,4622 5470,
+ 4625 6470,4627 6471,4627 6472,4627 6473,6627 6474,6625 6474,6628 6477,
+ 6633 6481,6633 6480,6637 6475,7637 6479,7638 6482,7643 6487,7644 6492,
+ 7647 6492,7648 6495,7646 6498,7650 6499,7646 6494,7644 6499,7644 6497,
+ 7644 6499,7647 6502,7649 6504,7650 6501,7647 6503,7649 6504,7650 6508,
+ 7651 6503,7652 6508,7655 6508,7650 6511,7655 6515,7658 6513,7663 6513,
+ 7665 6514,7669 6512,7667 6510,7664 6510,472 -675,477 -670,479 -666,
+ 482 -663,484 -668,484 -666,485 -664,481 -664,479 -659,482 -659,484 -658,
+ 483 -659,488 2341,493 2339,489 2338,491 2342,491 2346,494 2346,490 2348,
+ 493 2348,498 2349,498 2350,499 2349,502 2350,503 2348,506 2348,506 2348,
+ 507 2353,507 2355,504 2359,504 2364,504 2361,499 2365,502 2360,502 2358,
+ 503 2357,504 2353,504 2357,500 2356,497 2355,498 2355,500 2359,502 2361,
+ 505 2364,508 2364,506 2368,506 2370,504 2373,499 2373,496 2372,493 2377,
+ 497 2380,495 2383,496 7383,493 7386,497 7391,494 7387,495 7389,498 7392,
+ 498 7392,495 7395,493 7398,498 7401,498 7403,503 7400,498 8400,501 8401,
+ 503 8401,503 8401,501 10401,496 10396,491 10401,492 10399,493 10403,
+ 496 10403,491 10403,493 10407,489 10410,493 10407,489 10403,498 7403,
+ 497 7399,496 7403,500 7405,500 7407,503 7411,508 7415,511 7415,511 7420,
+ 515 7420,520 7423,523 7423,520 7427,523 7427,523 7427,522 7432,525 4432,
+ 527 4434,530 4437,534 4441,529 4446,529 4441,534 4436,537 4436,535 4437,
+ 532 4437,534 4432,535 4429,538 4430,542 4427,542 4431,538 4431,541 4431,
+ 541 4433,543 4433,545 4432,549 4428,552 4426,556 4427,557 4423,560 4427,
+ 561 4428,558 4430,559 4434,559 4432,561 4434,561 4437,563 4435,559 4430,
+ 561 4435,4561 4437,4566 4441,4568 4446,4568 4450,4569 4455,4565 4458,
+ 4561 4463,4561 9463,4564 9463,4565 9461,9565 9463,9560 9467,9560 9466,
+ 9555 9469,9555 9471,9559 9469,9557 9473,9553 9478,9555 9480,9557 9481,
+ 9557 9481,9557 9483,9562 9487,9558 9487,9558 9490,9561 9493,9562 9493,
+ 9557 9493,9560 9496,9555 9501,9553 9503,9553 9506,9557 9510,9558 9511,
+ 9561 9514,9563 9512,9568 9514,9567 9514,9567 13514,9570 13517,9566 13521,
+ 9571 13521,9571 13526,9573 13521,9571 13521,9576 10521,9580 10526,9582 10525,
+ 9584 10528,9584 10531,9584 10533,9589 10533,9588 10537,9588 10541,9589 10542,
+ 9593 10544,9595 10540,9597 10541,9600 10545,9601 15545,9603 15549,9605 15553,
+ 9601 15558,9601 15553,9605 15551,9605 15550,9605 15554,9607 15556,9605 15556,
+ 9604 15561,9607 15559,9603 15559,9603 15562,9604 15563,9608 15566,9612 15570,
+ 9617 15565,9622 15568,9627 15566,9628 15564,9629 15564,9633 15569,9636 15569,
+ 9634 15571,9634 15572,9636 15574,9634 15570,9629 15570,9631 15567,9629 15570,
+ 9626 15574,9626 15575,498 7401,502 7401,506 7397,506 7395,502 7398,497 7401,
+ 502 7402,505 7397,508 7400,504 7404,3504 7409,3505 7405,3508 7410,3511 7413,
+ 3511 7416,3511 7419,3511 7419,3513 7421,3517 7424,3519 7426,3520 11426,
+ 3523 11421,3527 11418,3530 11415,3530 11416,3533 11418,7533 11415,7531 11415,
+ 7531 11417,7536 11420,7541 11424,7543 11425,7543 11427,7543 11429,7540 11429,
+ 7542 11425,7541 11420,7542 11421,7542 11422,7540 11424,7540 11423,7543 11422,
+ 7546 11426,7550 11431,7553 11436,7555 16436,7553 16438,7558 16438,7559 16438,
+ 7560 16439,7565 16437,7560 16435,7563 16435,7566 16440,7566 16444,7564 16447,
+ 7559 16443,7561 16443,7566 16448,7570 16451,7574 16456,7578 16459,
+ 12578 16459,12578 20459,12577 20456,12581 20454,12585 20456,12585 20456,
+ 12585 20456,12583 20456,12579 20459,12580 20461,12580 20462,12580 20460,
+ 12585 20465,12586 20467,12590 20470,12590 20470,12589 20471,12584 20471,
+ 12589 20471,9589 20472,9594 20472,9595 20472,9596 20477,9598 20482,
+ 9603 20480,9608 20484,9613 20484,9610 20486,9608 20488,9608 20489,9610 20489,
+ 9614 20486,9619 20481,9620 20481,9618 21481,9621 21483,9626 21483,9628 21485,
+ 9623 21487,9622 21490,9626 21493,9621 21495,9626 21498,9622 21499,9624 21504,
+ 9625 21499,9629 21501,9633 21498,9637 21495,9639 21498,9644 21501,9557 9481,
+ 9560 9485,9561 9490,9563 9488,9560 9486,9558 9488,9561 9492,9563 9495,
+ 9567 9492,9567 9488,9564 9490,9559 9495,9559 9498,9557 9502,9562 9506,
+ 9564 9509,9569 9512,9569 9516,9569 9518,9569 9515,9571 9513,9571 9512,
+ 9573 9513,9578 9516,9581 9516,9585 11516,9585 11521,9590 10521,9586 10524,
+ 9589 10529,9589 10527,9589 10527,9594 10532,9594 10534,9598 10536,9598 10540,
+ 9600 10542,9604 10538,9607 10538,9609 10543,9613 10538,9613 10533,9613 10537,
+ 9610 10537,9614 10542,9609 10542,9610 10543,9610 10548,9611 10553,9616 7553,
+ 9620 7553,9621 7557,9618 7559,9618 7554,9622 7557,9622 7561,9622 7556,
+ 9622 7560,9619 7560,9620 7565,9622 7563,9627 7566,9630 7570,9630 7571,
+ 9632 7573,9637 7576,9639 7578,9640 7576,9640 7579,9640 7575,9642 7570,
+ 9646 7570,9651 7574,9653 7577,9652 7572,9653 7576,9653 7576,9651 7581,
+ 9656 7585,9660 7586,9659 7591,9657 7594,9661 7598,9664 7602,9668 12602,
+ 9673 12604,9676 12606,9679 12602,9682 12605,9677 12610,9674 12606,9674 12601,
+ 9674 12603,9672 9603,9668 9605,9671 9606,9668 9611,9668 9606,9671 9611,
+ 9675 9615,9677 9620,9678 9622,9679 9624,9684 9626,9685 9627,9685 9622,
+ 9685 9626,9689 9628,9694 9633,9699 9637,9699 9637,9704 9636,9708 9637,
+ 9709 9638,9707 9639,9705 9642,9707 9647,9710 9649,9711 9653,9716 9649,
+ 9716 9648,9720 9650,9721 9648,9723 9648,9726 4648,12726 4653,12731 4655,
+ 12734 4660,12730 4661,12733 4664,12733 4665,12735 4670,12737 4674,12741 4674,
+ 12738 4675,12740 4675,12737 4675,12742 4678,12743 4681,12746 4677)'),
+ INDEX(b,c), SPATIAL INDEX(l)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 () VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),();
+SELECT LENGTH(l) FROM t1;
+INSERT INTO t1 (a) SELECT NULL FROM t1;
+INSERT INTO t1 (a) SELECT NULL FROM t1;
+CHECK TABLE t1;
+UPDATE t1 SET c=true, l=ST_linefromtext('linestring(0 0,1 1,2 2)');
+DELETE FROM t1;
+CHECK TABLE t1;
+
+source include/wait_all_purged.inc;
+
+ANALYZE TABLE t1;
+SELECT OTHER_INDEX_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE NAME='test/t1';
+
+--echo # Note: The OTHER_INDEX_SIZE does not cover any SPATIAL INDEX.
+--echo # To test that all indexes were emptied, replace DROP TABLE
+--echo # with the following, and examine the root pages in t1.ibd:
+--echo # FLUSH TABLES t1 FOR EXPORT;
+--echo # UNLOCK TABLES;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
index 981cecb66ad..1c087c550d0 100644
--- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
+++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
@@ -25,7 +25,7 @@ sync_slave_with_master;
connection master;
# Delete './master-bin.000001' from index file.
let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
-let $file= $MYSQLD_DATADIR/master-bin.index;
+let TRUNCATE_FILE= $MYSQLD_DATADIR/master-bin.index;
source include/truncate_file.inc;
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index f147f4b7e1e..327a94cdace 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3857,6 +3857,21 @@ deallocate prepare stmt;
drop view v1,v2,v3;
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-10657: incorrect result returned with binary protocol
+--echo # (prepared statements)
+--echo #
+
+create table t1 (code varchar(10) primary key);
+INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3');
+SELECT X.*
+FROM
+ (SELECT CODE, RN
+ FROM
+ (SELECT A.CODE, @cnt := @cnt + 1 AS RN
+ FROM t1 A, (SELECT @cnt := 0) C) T
+ ) X;
+drop table t1;
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 4940faa944a..557da610aec 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -214,6 +214,7 @@ innodb.lock_deleted : Added in 10.2.12
innodb.log_corruption : MDEV-13251 - Wrong result
innodb.log_data_file_size : MDEV-14204 - Server failed to start
innodb.log_file_name : MDEV-14193 - Exception
+innodb.purge_secondary : Added in 10.2.12
innodb.purge_thread_shutdown : MDEV-13792 - Wrong result
innodb.read_only_recovery : MDEV-13886 - Server crash
innodb.recovery_shutdown : Added in 10.2.12
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a1727b5a2fa..c8eb8ed3128 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2609,6 +2609,8 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value,
MEM_ROOT *runtime_memroot)
{
Item_change_record *change;
+ DBUG_ENTER("THD::nocheck_register_item_tree_change");
+ DBUG_PRINT("enter", ("Register %p <- %p", old_value, (*place)));
/*
Now we use one node per change, which adds some memory overhead,
but still is rather fast as we use alloc_root for allocations.
@@ -2621,12 +2623,13 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value,
OOM, thd->fatal_error() is called by the error handler of the
memroot. Just return.
*/
- return;
+ DBUG_VOID_RETURN;
}
change= new (change_mem) Item_change_record;
change->place= place;
change->old_value= old_value;
change_list.append(change);
+ DBUG_VOID_RETURN;
}
/**
@@ -2667,7 +2670,11 @@ void THD::rollback_item_tree_changes()
DBUG_ENTER("rollback_item_tree_changes");
while ((change= it++))
+ {
+ DBUG_PRINT("info", ("revert %p -> %p",
+ change->old_value, (*change->place)));
*change->place= change->old_value;
+ }
/* We can forget about changes memory: it's allocated in runtime memroot */
change_list.empty();
DBUG_VOID_RETURN;
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 746913b0154..3e84536673a 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -364,6 +364,9 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX *parent_lex= derived->select_lex;
Query_arena *arena, backup;
DBUG_ENTER("mysql_derived_merge");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
if (derived->merged)
DBUG_RETURN(FALSE);
@@ -510,7 +513,9 @@ unconditional_materialization:
bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
{
DBUG_ENTER("mysql_derived_merge_for_insert");
- DBUG_PRINT("enter", ("derived: %p", derived));
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
DBUG_PRINT("info", ("merged_for_insert: %d is_materialized_derived: %d "
"is_multitable: %d single_table_updatable: %d "
"merge_underlying_list: %d",
@@ -566,7 +571,9 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived)
{
SELECT_LEX_UNIT *unit= derived->get_unit();
DBUG_ENTER("mysql_derived_init");
- DBUG_PRINT("enter", ("derived: %p", derived));
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
// Skip already prepared views/DT
if (!unit || unit->prepared)
@@ -642,8 +649,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX_UNIT *unit= derived->get_unit();
DBUG_ENTER("mysql_derived_prepare");
bool res= FALSE;
- DBUG_PRINT("enter", ("unit: %p table_list: %p Alias '%s'",
- unit, derived, derived->alias));
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ unit));
if (!unit)
DBUG_RETURN(FALSE);
@@ -875,6 +883,9 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived)
bool res= FALSE;
DBUG_ENTER("mysql_derived_optimize");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
if (unit->optimized)
DBUG_RETURN(FALSE);
@@ -940,6 +951,9 @@ err:
bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived)
{
DBUG_ENTER("mysql_derived_create");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
TABLE *table= derived->table;
SELECT_LEX_UNIT *unit= derived->get_unit();
@@ -1033,10 +1047,14 @@ bool TABLE_LIST::fill_recursive(THD *thd)
bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
{
- DBUG_ENTER("mysql_derived_fill");
+ Field_iterator_table field_iterator;
SELECT_LEX_UNIT *unit= derived->get_unit();
bool derived_is_recursive= derived->is_recursive_with_table();
bool res= FALSE;
+ DBUG_ENTER("mysql_derived_fill");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
if (unit->executed && !unit->uncacheable && !unit->describe &&
!derived_is_recursive)
@@ -1091,8 +1109,28 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
if (derived_result->flush())
res= TRUE;
unit->executed= TRUE;
+
+ if (derived->field_translation)
+ {
+ /* reset translation table to materialized table */
+ field_iterator.set_table(derived->table);
+ for (uint i= 0;
+ !field_iterator.end_of_fields();
+ field_iterator.next(), i= i + 1)
+ {
+ Item *item;
+
+ if (!(item= field_iterator.create_item(thd)))
+ {
+ res= TRUE;
+ break;
+ }
+ thd->change_item_tree(&derived->field_translation[i].item, item);
+ }
+ }
}
- if (res || (!lex->describe && !derived_is_recursive))
+
+ if (res || (!lex->describe && !derived_is_recursive))
unit->cleanup();
lex->current_select= save_current_select;
@@ -1120,6 +1158,9 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived)
{
DBUG_ENTER("mysql_derived_reinit");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (derived->alias ? derived->alias : "<NULL>"),
+ derived->get_unit()));
st_select_lex_unit *unit= derived->get_unit();
derived->merged_for_insert= FALSE;
diff --git a/sql/table.cc b/sql/table.cc
index 00debaec84e..ff8f590b1a6 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -4607,6 +4607,9 @@ bool TABLE_LIST::create_field_translation(THD *thd)
Query_arena *arena, backup;
bool res= FALSE;
DBUG_ENTER("TABLE_LIST::create_field_translation");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (alias ? alias : "<NULL>"),
+ get_unit()));
if (thd->stmt_arena->is_conventional() ||
thd->stmt_arena->is_stmt_prepare_or_first_sp_execute())
diff --git a/sql/table.h b/sql/table.h
index 7e3f94a60ff..f77f9fcf9ec 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2316,6 +2316,9 @@ struct TABLE_LIST
inline void set_merged_derived()
{
DBUG_ENTER("set_merged_derived");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (alias ? alias : "<NULL>"),
+ get_unit()));
derived_type= ((derived_type & DTYPE_MASK) |
DTYPE_TABLE | DTYPE_MERGE);
set_check_merged();
@@ -2328,6 +2331,9 @@ struct TABLE_LIST
void set_materialized_derived()
{
DBUG_ENTER("set_materialized_derived");
+ DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
+ (alias ? alias : "<NULL>"),
+ get_unit()));
derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
DTYPE_TABLE | DTYPE_MATERIALIZE);
set_check_materialized();
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index b57fdbe1e37..be859fa9450 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -171,6 +171,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t* index, /*!< in: clustered index */
+ const upd_t* update, /*!< in: updated columns */
dtuple_t** row, /*!< out, own: partial row */
ibool ignore_prefix, /*!< in: flag to indicate if we
expect blob prefixes in undo. Used
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 97fbce3b141..c14b455b73b 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -918,7 +918,7 @@ err_exit:
if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
ptr = trx_undo_rec_get_partial_row(
- ptr, clust_index, &node->row,
+ ptr, clust_index, node->update, &node->row,
type == TRX_UNDO_UPD_DEL_REC,
node->heap);
}
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index add12057910..f6fb96e1ce1 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -195,13 +195,13 @@ row_build_index_entry_low(
dfield2);
break;
+ case SPATIAL_UNKNOWN:
+ ut_ad(0);
+ /* fall through */
case SPATIAL_NONE:
/* Undo record is logged before
spatial index is created.*/
return(NULL);
-
- case SPATIAL_UNKNOWN:
- ut_ad(0);
}
memcpy(mbr, ptr, DATA_MBR_LEN);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 389d28a5fc8..de32da15de0 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -1199,14 +1199,43 @@ trx_undo_page_report_modify(
const dict_col_t* col
= dict_table_get_nth_col(table, col_no);
- const char* col_name = dict_table_get_col_name(table,
- col_no);
if (!col->ord_part) {
continue;
}
- if (update) {
+ const ulint pos = dict_index_get_nth_col_pos(
+ index, col_no, NULL);
+ /* All non-virtual columns must be present in
+ the clustered index. */
+ ut_ad(pos != ULINT_UNDEFINED);
+
+ const bool is_ext = rec_offs_nth_extern(offsets, pos);
+ const spatial_status_t spatial_status = is_ext
+ ? dict_col_get_spatial_status(col)
+ : SPATIAL_NONE;
+
+ switch (spatial_status) {
+ case SPATIAL_UNKNOWN:
+ ut_ad(0);
+ /* fall through */
+ case SPATIAL_MIXED:
+ case SPATIAL_ONLY:
+ /* Externally stored spatially indexed
+ columns will be (redundantly) logged
+ again, because we did not write the
+ MBR yet, that is, the previous call to
+ trx_undo_page_report_modify_ext()
+ was with SPATIAL_UNKNOWN. */
+ break;
+ case SPATIAL_NONE:
+ if (!update) {
+ /* This is a DELETE operation. */
+ break;
+ }
+ /* Avoid redundantly logging indexed
+ columns that were updated. */
+
for (i = 0; i < update->n_fields; i++) {
const ulint field_no
= upd_get_nth_field(update, i)
@@ -1221,37 +1250,19 @@ trx_undo_page_report_modify(
}
if (true) {
- ulint pos;
- spatial_status_t spatial_status;
-
- spatial_status = SPATIAL_NONE;
-
/* Write field number to undo log */
if (trx_undo_left(undo_page, ptr) < 5 + 15) {
return(0);
}
- pos = dict_index_get_nth_col_pos(index,
- col_no,
- NULL);
- if (pos == ULINT_UNDEFINED) {
- ib::error() << "Column " << col_no
- << " name " << col_name
- << " not found from index " << index->name
- << " table. " << table->name.m_name
- << " Table has " << dict_table_get_n_cols(table)
- << " and index has " << dict_index_get_n_fields(index)
- << " fields.";
- }
-
ptr += mach_write_compressed(ptr, pos);
/* Save the old value of field */
field = rec_get_nth_field(rec, offsets, pos,
&flen);
- if (rec_offs_nth_extern(offsets, pos)) {
+ if (is_ext) {
const dict_col_t* col =
dict_index_get_nth_col(
index, pos);
@@ -1261,10 +1272,6 @@ trx_undo_page_report_modify(
ut_a(prefix_len < sizeof ext_buf);
- spatial_status =
- dict_col_get_spatial_status(
- col);
-
/* If there is a spatial index on it,
log its MBR */
if (spatial_status != SPATIAL_NONE) {
@@ -1662,6 +1669,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t* index, /*!< in: clustered index */
+ const upd_t* update, /*!< in: updated columns */
dtuple_t** row, /*!< out, own: partial row */
ibool ignore_prefix, /*!< in: flag to indicate if we
expect blob prefixes in undo. Used
@@ -1692,6 +1700,16 @@ trx_undo_rec_get_partial_row(
dtuple_init_v_fld(*row);
+ for (const upd_field_t* uf = update->fields, * const ue
+ = update->fields + update->n_fields;
+ uf != ue; uf++) {
+ if (uf->old_v_val) {
+ continue;
+ }
+ ulint c = dict_index_get_nth_col(index, uf->field_no)->ind;
+ *dtuple_get_nth_field(*row, c) = uf->new_val;
+ }
+
end_ptr = ptr + mach_read_from_2(ptr);
ptr += 2;
@@ -1737,6 +1755,13 @@ trx_undo_rec_get_partial_row(
col = dict_index_get_nth_col(index, field_no);
col_no = dict_col_get_no(col);
dfield = dtuple_get_nth_field(*row, col_no);
+ ut_ad(dfield->type.mtype == DATA_MISSING
+ || dict_col_type_assert_equal(col,
+ &dfield->type));
+ ut_ad(dfield->type.mtype == DATA_MISSING
+ || dfield->len == len
+ || (len != UNIV_SQL_NULL
+ && len >= UNIV_EXTERN_STORAGE_FIELD));
dict_col_copy_type(
dict_table_get_nth_col(index->table, col_no),
dfield_get_type(dfield));
diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h
index 630818a8648..ec15250ec7b 100644
--- a/storage/xtradb/include/trx0rec.h
+++ b/storage/xtradb/include/trx0rec.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -196,6 +196,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t* index, /*!< in: clustered index */
+ const upd_t* update, /*!< in: updated columns */
dtuple_t** row, /*!< out, own: partial row */
ibool ignore_prefix, /*!< in: flag to indicate if we
expect blob prefixes in undo. Used
diff --git a/storage/xtradb/row/row0purge.cc b/storage/xtradb/row/row0purge.cc
index 333677edf21..0cd0941987d 100644
--- a/storage/xtradb/row/row0purge.cc
+++ b/storage/xtradb/row/row0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -823,7 +823,7 @@ err_exit:
if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
ptr = trx_undo_rec_get_partial_row(
- ptr, clust_index, &node->row,
+ ptr, clust_index, node->update, &node->row,
type == TRX_UNDO_UPD_DEL_REC,
node->heap);
}
diff --git a/storage/xtradb/trx/trx0rec.cc b/storage/xtradb/trx/trx0rec.cc
index 8cd51c8066b..e295e7e05ca 100644
--- a/storage/xtradb/trx/trx0rec.cc
+++ b/storage/xtradb/trx/trx0rec.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
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
@@ -1076,6 +1076,7 @@ trx_undo_rec_get_partial_row(
used, as we do NOT copy the data in the
record! */
dict_index_t* index, /*!< in: clustered index */
+ const upd_t* update, /*!< in: updated columns */
dtuple_t** row, /*!< out, own: partial row */
ibool ignore_prefix, /*!< in: flag to indicate if we
expect blob prefixes in undo. Used
@@ -1103,6 +1104,13 @@ trx_undo_rec_get_partial_row(
->mtype = DATA_MISSING;
}
+ for (const upd_field_t* uf = update->fields, * const ue
+ = update->fields + update->n_fields;
+ uf != ue; uf++) {
+ ulint c = dict_index_get_nth_col(index, uf->field_no)->ind;
+ *dtuple_get_nth_field(*row, c) = uf->new_val;
+ }
+
end_ptr = ptr + mach_read_from_2(ptr);
ptr += 2;
@@ -1123,6 +1131,10 @@ trx_undo_rec_get_partial_row(
ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len);
dfield = dtuple_get_nth_field(*row, col_no);
+ ut_ad(dfield->type.mtype == DATA_MISSING
+ || dict_col_type_assert_equal(col, &dfield->type));
+ ut_ad(dfield->type.mtype == DATA_MISSING
+ || dfield->len == len);
dict_col_copy_type(
dict_table_get_nth_col(index->table, col_no),
dfield_get_type(dfield));