Merge lp:~stewart/percona-server/5.1.67 into lp:percona-server/5.1

Proposed by Stewart Smith
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 542
Proposed branch: lp:~stewart/percona-server/5.1.67
Merge into: lp:percona-server/5.1
Prerequisite: lp:~percona-core/percona-server/release-5.1.66-14.2
Diff against target: 3724 lines (+1320/-575)
69 files modified
Percona-Server/client/mysql.cc (+89/-2)
Percona-Server/configure.in (+1/-1)
Percona-Server/libmysql/libmysql.c (+1/-1)
Percona-Server/mysql-test/r/ctype_ucs.result (+26/-0)
Percona-Server/mysql-test/r/loaddata.result (+0/-29)
Percona-Server/mysql-test/r/sp_notembedded.result (+1/-1)
Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test (+1/-1)
Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test (+1/-1)
Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result (+53/-0)
Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test (+95/-0)
Percona-Server/mysql-test/t/ctype_ucs.test (+32/-0)
Percona-Server/mysql-test/t/loaddata.test (+34/-30)
Percona-Server/mysql-test/t/sp_notembedded.test (+10/-10)
Percona-Server/scripts/mysql_install_db.pl.in (+18/-3)
Percona-Server/scripts/mysqld_multi.sh (+22/-0)
Percona-Server/scripts/mysqld_safe.sh (+34/-1)
Percona-Server/sql/hostname.cc (+9/-0)
Percona-Server/sql/item_cmpfunc.cc (+20/-1)
Percona-Server/sql/item_func.cc (+2/-1)
Percona-Server/sql/item_func.h (+1/-0)
Percona-Server/sql/log.cc (+6/-0)
Percona-Server/sql/log_event.cc (+55/-4)
Percona-Server/sql/log_event.h (+3/-3)
Percona-Server/sql/mysql_priv.h (+35/-0)
Percona-Server/sql/mysqld.cc (+1/-1)
Percona-Server/sql/sp_head.cc (+27/-21)
Percona-Server/sql/sql_acl.cc (+169/-93)
Percona-Server/sql/sql_connect.cc (+60/-8)
Percona-Server/sql/sql_lex.cc (+1/-0)
Percona-Server/sql/sql_list.h (+9/-2)
Percona-Server/sql/sql_profile.cc (+19/-10)
Percona-Server/sql/sql_profile.h (+4/-2)
Percona-Server/sql/sql_select.cc (+13/-13)
Percona-Server/storage/innobase/btr/btr0cur.c (+6/-5)
Percona-Server/storage/innobase/dict/dict0dict.c (+15/-3)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+2/-2)
Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c (+25/-3)
Percona-Server/storage/innobase/include/btr0cur.h (+5/-4)
Percona-Server/storage/innobase/include/dict0mem.h (+6/-1)
Percona-Server/storage/innobase/include/row0undo.h (+2/-7)
Percona-Server/storage/innobase/os/os0file.c (+15/-0)
Percona-Server/storage/innobase/row/row0sel.c (+17/-8)
Percona-Server/storage/innobase/row/row0umod.c (+0/-54)
Percona-Server/storage/innobase/row/row0undo.c (+0/-19)
Percona-Server/storage/innodb_plugin/ChangeLog (+37/-0)
Percona-Server/storage/innodb_plugin/btr/btr0btr.c (+17/-15)
Percona-Server/storage/innodb_plugin/btr/btr0cur.c (+22/-18)
Percona-Server/storage/innodb_plugin/buf/buf0buf.c (+4/-3)
Percona-Server/storage/innodb_plugin/buf/buf0lru.c (+3/-1)
Percona-Server/storage/innodb_plugin/dict/dict0dict.c (+60/-31)
Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc (+2/-2)
Percona-Server/storage/innodb_plugin/handler/handler0alter.cc (+6/-2)
Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c (+26/-3)
Percona-Server/storage/innodb_plugin/include/btr0cur.h (+6/-5)
Percona-Server/storage/innodb_plugin/include/dict0dict.h (+12/-0)
Percona-Server/storage/innodb_plugin/include/dict0mem.h (+6/-1)
Percona-Server/storage/innodb_plugin/include/page0zip.h (+5/-3)
Percona-Server/storage/innodb_plugin/include/row0undo.h (+0/-7)
Percona-Server/storage/innodb_plugin/log/log0recv.c (+2/-3)
Percona-Server/storage/innodb_plugin/os/os0file.c (+15/-0)
Percona-Server/storage/innodb_plugin/page/page0cur.c (+3/-3)
Percona-Server/storage/innodb_plugin/page/page0page.c (+8/-6)
Percona-Server/storage/innodb_plugin/page/page0zip.c (+111/-46)
Percona-Server/storage/innodb_plugin/row/row0mysql.c (+4/-1)
Percona-Server/storage/innodb_plugin/row/row0sel.c (+17/-7)
Percona-Server/storage/innodb_plugin/row/row0umod.c (+0/-53)
Percona-Server/storage/innodb_plugin/row/row0undo.c (+0/-19)
Percona-Server/storage/myisam/myisamchk.c (+8/-1)
Percona-Server/tests/mysql_client_test.c (+1/-0)
To merge this branch: bzr merge lp:~stewart/percona-server/5.1.67
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+142635@code.launchpad.net

Description of the change

Merge MySQL 5.1.67.

This will seemingly have to wait for MySQL 5.5.30 to be properly merged in as there are (again) changesets in 5.1 that aren't in 5.5.

This was mostly auto merge, apart from binlog quoting (which I reverted in the MySQL branch before merging) and minor bit in sql/log_event.cc

http://jenkins.percona.com/view/PS%205.1/job/percona-server-5.1-param/489/

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/client/mysql.cc'
--- Percona-Server/client/mysql.cc 2013-01-10 04:35:31 +0000
+++ Percona-Server/client/mysql.cc 2013-01-10 04:35:33 +0000
@@ -250,6 +250,8 @@
250static char *get_arg(char *line, my_bool get_next_arg);250static char *get_arg(char *line, my_bool get_next_arg);
251static void init_username();251static void init_username();
252static void add_int_to_prompt(int toadd);252static void add_int_to_prompt(int toadd);
253static int normalize_dbname(const char *line, char *buff, uint buff_size);
254static int get_quote_count(const char *line);
253255
254/* A structure which contains information on the commands this program256/* A structure which contains information on the commands this program
255 can understand. */257 can understand. */
@@ -4172,8 +4174,23 @@
4172 int select_db;4174 int select_db;
41734175
4174 bzero(buff, sizeof(buff));4176 bzero(buff, sizeof(buff));
4175 strmake(buff, line, sizeof(buff) - 1);4177
4176 tmp= get_arg(buff, 0);4178 /*
4179 In case number of quotes exceed 2, we try to get
4180 the normalized db name.
4181 */
4182 if (get_quote_count(line) > 2)
4183 {
4184 if (normalize_dbname(line, buff, sizeof(buff)))
4185 return put_error(&mysql);
4186 tmp= buff;
4187 }
4188 else
4189 {
4190 strmake(buff, line, sizeof(buff) - 1);
4191 tmp= get_arg(buff, 0);
4192 }
4193
4177 if (!tmp || !*tmp)4194 if (!tmp || !*tmp)
4178 {4195 {
4179 put_info("USE must be followed by a database name", INFO_ERROR);4196 put_info("USE must be followed by a database name", INFO_ERROR);
@@ -4239,6 +4256,62 @@
4239 return 0;4256 return 0;
4240}4257}
42414258
4259/**
4260 Normalize database name.
4261
4262 @param line [IN] The command.
4263 @param buff [OUT] Normalized db name.
4264 @param buff_size [IN] Buffer size.
4265
4266 @return Operation status
4267 @retval 0 Success
4268 @retval 1 Failure
4269
4270 @note Sometimes server normilizes the database names
4271 & APIs like mysql_select_db() expect normalized
4272 database names. Since it is difficult to perform
4273 the name conversion/normalization on the client
4274 side, this function tries to get the normalized
4275 dbname (indirectly) from the server.
4276*/
4277
4278static int
4279normalize_dbname(const char *line, char *buff, uint buff_size)
4280{
4281 MYSQL_RES *res= NULL;
4282
4283 /* Send the "USE db" commmand to the server. */
4284 if (mysql_query(&mysql, line))
4285 return 1;
4286
4287 /*
4288 Now, get the normalized database name and store it
4289 into the buff.
4290 */
4291 if (!mysql_query(&mysql, "SELECT DATABASE()") &&
4292 (res= mysql_use_result(&mysql)))
4293 {
4294 MYSQL_ROW row= mysql_fetch_row(res);
4295 if (row && row[0])
4296 {
4297 size_t len= strlen(row[0]);
4298 /* Make sure there is enough room to store the dbname. */
4299 if ((len > buff_size) || ! memcpy(buff, row[0], len))
4300 {
4301 mysql_free_result(res);
4302 return 1;
4303 }
4304 }
4305 mysql_free_result(res);
4306 }
4307
4308 /* Restore the original database. */
4309 if (current_db && mysql_select_db(&mysql, current_db))
4310 return 1;
4311
4312 return 0;
4313}
4314
4242static int4315static int
4243com_warnings(String *buffer __attribute__((unused)),4316com_warnings(String *buffer __attribute__((unused)),
4244 char *line __attribute__((unused)))4317 char *line __attribute__((unused)))
@@ -4318,6 +4391,20 @@
4318 return valid_arg ? start : NullS;4391 return valid_arg ? start : NullS;
4319}4392}
43204393
4394/*
4395 Number of quotes present in the command's argument.
4396*/
4397static int
4398get_quote_count(const char *line)
4399{
4400 int quote_count;
4401 const char *ptr= line;
4402
4403 for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`"))
4404 quote_count ++;
4405
4406 return quote_count;
4407}
43214408
4322static int4409static int
4323sql_real_connect(char *host,char *database,char *user,char *password,4410sql_real_connect(char *host,char *database,char *user,char *password,
43244411
=== modified file 'Percona-Server/configure.in'
--- Percona-Server/configure.in 2013-01-10 04:35:31 +0000
+++ Percona-Server/configure.in 2013-01-10 04:35:33 +0000
@@ -12,7 +12,7 @@
12dnl When changing the major version number please also check the switch12dnl When changing the major version number please also check the switch
13dnl statement in mysqlbinlog::check_master_version(). You may also need13dnl statement in mysqlbinlog::check_master_version(). You may also need
14dnl to update version.c in ndb.14dnl to update version.c in ndb.
15AC_INIT([MySQL Server], [5.1.66], [], [mysql])15AC_INIT([MySQL Server], [5.1.67], [], [mysql])
1616
17AC_CONFIG_SRCDIR([sql/mysqld.cc])17AC_CONFIG_SRCDIR([sql/mysqld.cc])
18AC_CANONICAL_SYSTEM18AC_CANONICAL_SYSTEM
1919
=== modified file 'Percona-Server/libmysql/libmysql.c'
--- Percona-Server/libmysql/libmysql.c 2012-08-20 00:29:22 +0000
+++ Percona-Server/libmysql/libmysql.c 2013-01-10 04:35:33 +0000
@@ -4653,7 +4653,7 @@
4653 if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE)4653 if ((int) stmt->state < (int) MYSQL_STMT_FETCH_DONE)
4654 {4654 {
4655 set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL);4655 set_stmt_error(stmt, CR_NO_DATA, unknown_sqlstate, NULL);
4656 return 1;4656 DBUG_RETURN(1);
4657 }4657 }
4658 if (column >= stmt->field_count)4658 if (column >= stmt->field_count)
4659 {4659 {
46604660
=== renamed file 'Percona-Server/mysql-test/include/mysqlbinlog_row_engine.inc' => 'Percona-Server/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc'
=== modified file 'Percona-Server/mysql-test/r/ctype_ucs.result'
--- Percona-Server/mysql-test/r/ctype_ucs.result 2011-03-03 15:39:26 +0000
+++ Percona-Server/mysql-test/r/ctype_ucs.result 2013-01-10 04:35:33 +0000
@@ -191,6 +191,32 @@
191 `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''191 `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
192) ENGINE=MyISAM DEFAULT CHARSET=latin1192) ENGINE=MyISAM DEFAULT CHARSET=latin1
193DROP TABLE t1;193DROP TABLE t1;
194#
195# Bug #51876 : crash/memory underrun when loading data with ucs2
196# and reverse() function
197#
198# Problem # 1 (original report): wrong parsing of ucs2 data
199SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
200CREATE TABLE t1(a INT);
201LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
202(@b) SET a=REVERSE(@b);
203# should return 2 zeroes (as the value is truncated)
204SELECT * FROM t1;
205a
2060
2071
208DROP TABLE t1;
209# Problem # 2 : if you write and read ucs2 data to a file they're lost
210SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
211CREATE TABLE t1(a INT);
212LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
213(@b) SET a=REVERSE(@b);
214# should return 0 and 1 (10 reversed)
215SELECT * FROM t1;
216a
2170
2181
219DROP TABLE t1;
194create table t2(f1 Char(30));220create table t2(f1 Char(30));
195insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");221insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
196select lpad(f1, 12, "-o-/") from t2;222select lpad(f1, 12, "-o-/") from t2;
197223
=== modified file 'Percona-Server/mysql-test/r/loaddata.result'
--- Percona-Server/mysql-test/r/loaddata.result 2011-05-10 13:57:40 +0000
+++ Percona-Server/mysql-test/r/loaddata.result 2013-01-10 04:35:33 +0000
@@ -504,35 +504,6 @@
504LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;504LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
505DROP TABLE t1;505DROP TABLE t1;
506#506#
507# Bug #51876 : crash/memory underrun when loading data with ucs2
508# and reverse() function
509#
510# Problem # 1 (original report): wrong parsing of ucs2 data
511SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
512CREATE TABLE t1(a INT);
513LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
514(@b) SET a=REVERSE(@b);
515Warnings:
516Warning 1366 Incorrect integer value: '00' for column 'a' at row 1
517Warning 1366 Incorrect integer value: '10' for column 'a' at row 2
518# should return 2 zeroes (as the value is truncated)
519SELECT * FROM t1;
520a
5210
5220
523DROP TABLE t1;
524# Problem # 2 : if you write and read ucs2 data to a file they're lost
525SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
526CREATE TABLE t1(a INT);
527LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
528(@b) SET a=REVERSE(@b);
529# should return 0 and 1 (10 reversed)
530SELECT * FROM t1;
531a
5320
5331
534DROP TABLE t1;
535#
536# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U507# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
537#508#
538CREATE TABLE t1(f1 INT);509CREATE TABLE t1(f1 INT);
539510
=== modified file 'Percona-Server/mysql-test/r/sp_notembedded.result'
--- Percona-Server/mysql-test/r/sp_notembedded.result 2012-03-28 06:35:31 +0000
+++ Percona-Server/mysql-test/r/sp_notembedded.result 2013-01-10 04:35:33 +0000
@@ -248,7 +248,6 @@
248DROP PROCEDURE p1;248DROP PROCEDURE p1;
249DELETE FROM mysql.user WHERE User='mysqltest_1';249DELETE FROM mysql.user WHERE User='mysqltest_1';
250FLUSH PRIVILEGES;250FLUSH PRIVILEGES;
251set @@global.concurrent_insert= @old_concurrent_insert;
252#251#
253# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.252# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
254#253#
@@ -302,3 +301,4 @@
302# ------------------------------------------------------------------301# ------------------------------------------------------------------
303# -- End of 5.1 tests302# -- End of 5.1 tests
304# ------------------------------------------------------------------303# ------------------------------------------------------------------
304set @@global.concurrent_insert= @old_concurrent_insert;
305305
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog-cp932.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result'
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog2.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result'
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_base64.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result'
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result'
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_innodb.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result'
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_myisam.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result'
=== renamed file 'Percona-Server/mysql-test/r/mysqlbinlog_row_trans.result' => 'Percona-Server/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result'
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog-cp932-master.opt' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt'
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog-cp932.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test'
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog2.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test'
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_base64.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test'
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test'
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_innodb.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test'
--- Percona-Server/mysql-test/t/mysqlbinlog_row_innodb.test 2008-08-20 14:06:31 +0000
+++ Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test 2013-01-10 04:35:33 +0000
@@ -20,5 +20,5 @@
20--source include/have_binlog_format_row.inc20--source include/have_binlog_format_row.inc
21--source include/have_ucs2.inc 21--source include/have_ucs2.inc
2222
23--source include/mysqlbinlog_row_engine.inc23--source extra/binlog_tests/mysqlbinlog_row_engine.inc
2424
2525
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_myisam.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test'
--- Percona-Server/mysql-test/t/mysqlbinlog_row_myisam.test 2008-08-20 14:06:31 +0000
+++ Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test 2013-01-10 04:35:33 +0000
@@ -20,4 +20,4 @@
20--source include/have_binlog_format_row.inc20--source include/have_binlog_format_row.inc
21--source include/have_ucs2.inc 21--source include/have_ucs2.inc
2222
23--source include/mysqlbinlog_row_engine.inc23--source extra/binlog_tests/mysqlbinlog_row_engine.inc
2424
=== renamed file 'Percona-Server/mysql-test/t/mysqlbinlog_row_trans.test' => 'Percona-Server/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test'
=== added file 'Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result'
--- Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/innodb_bug14704286.result 2013-01-10 04:35:33 +0000
@@ -0,0 +1,53 @@
1use test;
2drop table if exists t1;
3create table t1 (id int primary key, value int, value2 int,
4value3 int, index(value,value2)) engine=innodb;
5insert into t1 values
6(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
7(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
8(20,20,20,20);
9use test;
10start transaction with consistent snapshot;
11use test;
12CREATE PROCEDURE update_t1()
13BEGIN
14DECLARE i INT DEFAULT 1;
15while (i <= 5000) DO
16update test.t1 set value2=value2+1, value3=value3+1 where id=12;
17SET i = i + 1;
18END WHILE;
19END|
20set autocommit=0;
21CALL update_t1();
22select * from t1;
23id value value2 value3
2410 10 10 10
2511 11 11 11
2612 12 5012 5012
2713 13 13 13
2814 14 14 14
2915 15 15 15
3016 16 16 16
3117 17 17 17
3218 18 18 18
3319 19 19 19
3420 20 20 20
35set autocommit=1;
36select * from t1;
37id value value2 value3
3810 10 10 10
3911 11 11 11
4012 12 5012 5012
4113 13 13 13
4214 14 14 14
4315 15 15 15
4416 16 16 16
4517 17 17 17
4618 18 18 18
4719 19 19 19
4820 20 20 20
49select * from t1 force index(value) where value=12;
50kill query @id;
51ERROR 70100: Query execution was interrupted
52drop procedure if exists update_t1;
53drop table if exists t1;
054
=== added file 'Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test'
--- Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/innodb_bug14704286.test 2013-01-10 04:35:33 +0000
@@ -0,0 +1,95 @@
1--source include/have_innodb.inc
2
3#
4# create test-bed to run test
5#
6use test;
7--disable_warnings
8drop table if exists t1;
9--enable_warnings
10create table t1 (id int primary key, value int, value2 int,
11value3 int, index(value,value2)) engine=innodb;
12
13insert into t1 values
14(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
15(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
16(20,20,20,20);
17let $ID= `SELECT @id := CONNECTION_ID()`;
18
19#
20# we need multiple connections as we need to keep one connection
21# active with trx requesting consistent read.
22#
23connect (conn1, localhost, root,,);
24connect (conn2, localhost, root,,);
25connect (conn3, localhost, root,,);
26
27#
28# start trx with consistent read
29#
30connection conn1;
31use test;
32
33start transaction with consistent snapshot;
34
35#
36# update table such that secondary index is updated.
37#
38connection conn2;
39use test;
40delimiter |;
41CREATE PROCEDURE update_t1()
42BEGIN
43 DECLARE i INT DEFAULT 1;
44 while (i <= 5000) DO
45 update test.t1 set value2=value2+1, value3=value3+1 where id=12;
46 SET i = i + 1;
47 END WHILE;
48END|
49
50delimiter ;|
51set autocommit=0;
52CALL update_t1();
53select * from t1;
54set autocommit=1;
55select * from t1;
56
57#
58# Now try to fire select query from connection-1 enforcing
59# use of secondary index.
60#
61connection conn1;
62let $ID= `SELECT @id := CONNECTION_ID()`;
63#--error ER_QUERY_INTERRUPTED
64--send
65select * from t1 force index(value) where value=12;
66
67#
68# select is going to take good time so let's kill query.
69#
70connection conn3;
71let $wait_condition=
72 select * from information_schema.processlist where state = 'Sending data' and
73 info = 'select * from t1 force index(value) where value=12';
74--source include/wait_condition.inc
75let $ignore= `SELECT @id := $ID`;
76kill query @id;
77
78#
79# reap the value of connection-1
80#
81connection conn1;
82--error ER_QUERY_INTERRUPTED
83reap;
84
85#
86# clean test-bed.
87#
88connection default;
89disconnect conn1;
90disconnect conn2;
91disconnect conn3;
92drop procedure if exists update_t1;
93drop table if exists t1;
94
95
096
=== modified file 'Percona-Server/mysql-test/t/ctype_ucs.test'
--- Percona-Server/mysql-test/t/ctype_ucs.test 2011-03-03 15:39:26 +0000
+++ Percona-Server/mysql-test/t/ctype_ucs.test 2013-01-10 04:35:33 +0000
@@ -68,6 +68,38 @@
68SHOW CREATE TABLE t1;68SHOW CREATE TABLE t1;
69DROP TABLE t1;69DROP TABLE t1;
7070
71--echo #
72--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
73--echo # and reverse() function
74--echo #
75
76--echo # Problem # 1 (original report): wrong parsing of ucs2 data
77SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
78CREATE TABLE t1(a INT);
79LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
80(@b) SET a=REVERSE(@b);
81--echo # should return 2 zeroes (as the value is truncated)
82SELECT * FROM t1;
83
84DROP TABLE t1;
85let $MYSQLD_DATADIR= `select @@datadir`;
86remove_file $MYSQLD_DATADIR/test/tmpp.txt;
87
88
89--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
90SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
91CREATE TABLE t1(a INT);
92LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
93(@b) SET a=REVERSE(@b);
94--echo # should return 0 and 1 (10 reversed)
95SELECT * FROM t1;
96
97DROP TABLE t1;
98let $MYSQLD_DATADIR= `select @@datadir`;
99remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
100
101
102
71#103#
72# BUG3946104# BUG3946
73#105#
74106
=== modified file 'Percona-Server/mysql-test/t/loaddata.test'
--- Percona-Server/mysql-test/t/loaddata.test 2011-11-24 02:00:56 +0000
+++ Percona-Server/mysql-test/t/loaddata.test 2013-01-10 04:35:33 +0000
@@ -580,36 +580,40 @@
580connection default;580connection default;
581disconnect con1;581disconnect con1;
582582
583583#############################################################################
584--echo #584# The below protion is moved to ctype_ucs.test #
585--echo # Bug #51876 : crash/memory underrun when loading data with ucs2 585#############################################################################
586--echo # and reverse() function586#--echo #
587--echo #587#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
588588#--echo # and reverse() function
589--echo # Problem # 1 (original report): wrong parsing of ucs2 data589#--echo #
590SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';590
591CREATE TABLE t1(a INT);591#--echo # Problem # 1 (original report): wrong parsing of ucs2 data
592LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2592#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
593(@b) SET a=REVERSE(@b);593#CREATE TABLE t1(a INT);
594--echo # should return 2 zeroes (as the value is truncated)594#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
595SELECT * FROM t1;595#(@b) SET a=REVERSE(@b);
596596#--echo # should return 2 zeroes (as the value is truncated)
597DROP TABLE t1;597#SELECT * FROM t1;
598let $MYSQLD_DATADIR= `select @@datadir`;598
599remove_file $MYSQLD_DATADIR/test/tmpp.txt;599#DROP TABLE t1;
600600#let $MYSQLD_DATADIR= `select @@datadir`;
601601#remove_file $MYSQLD_DATADIR/test/tmpp.txt;
602--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost602
603SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;603
604CREATE TABLE t1(a INT);604#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
605LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2605#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
606(@b) SET a=REVERSE(@b);606#CREATE TABLE t1(a INT);
607--echo # should return 0 and 1 (10 reversed)607#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
608SELECT * FROM t1;608#(@b) SET a=REVERSE(@b);
609609#--echo # should return 0 and 1 (10 reversed)
610DROP TABLE t1;610#SELECT * FROM t1;
611let $MYSQLD_DATADIR= `select @@datadir`;611
612remove_file $MYSQLD_DATADIR/test/tmpp2.txt;612#DROP TABLE t1;
613#let $MYSQLD_DATADIR= `select @@datadir`;
614#remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
615######################################################################################
616
613617
614--echo #618--echo #
615--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U619--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
616620
=== modified file 'Percona-Server/mysql-test/t/sp_notembedded.test'
--- Percona-Server/mysql-test/t/sp_notembedded.test 2012-03-28 06:35:31 +0000
+++ Percona-Server/mysql-test/t/sp_notembedded.test 2013-01-10 04:35:33 +0000
@@ -371,16 +371,6 @@
371FLUSH PRIVILEGES;371FLUSH PRIVILEGES;
372372
373373
374#
375# Restore global concurrent_insert value. Keep in the end of the test file.
376#
377
378set @@global.concurrent_insert= @old_concurrent_insert;
379
380# Wait till all disconnects are completed
381--source include/wait_until_count_sessions.inc
382
383
384--echo #374--echo #
385--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.375--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
386--echo #376--echo #
@@ -476,3 +466,13 @@
476--echo # ------------------------------------------------------------------466--echo # ------------------------------------------------------------------
477--echo # -- End of 5.1 tests467--echo # -- End of 5.1 tests
478--echo # ------------------------------------------------------------------468--echo # ------------------------------------------------------------------
469
470
471#
472# Restore global concurrent_insert value. Keep in the end of the test file.
473#
474
475set @@global.concurrent_insert= @old_concurrent_insert;
476
477# Wait till all disconnects are completed
478--source include/wait_until_count_sessions.inc
479479
=== modified file 'Percona-Server/scripts/mysql_install_db.pl.in'
--- Percona-Server/scripts/mysql_install_db.pl.in 2012-02-15 16:21:38 +0000
+++ Percona-Server/scripts/mysql_install_db.pl.in 2013-01-10 04:35:33 +0000
@@ -423,10 +423,11 @@
423 "--bootstrap",423 "--bootstrap",
424 "--basedir=$opt->{basedir}",424 "--basedir=$opt->{basedir}",
425 "--datadir=$opt->{ldata}",425 "--datadir=$opt->{ldata}",
426 "--skip-innodb",426 "--log-warnings=0",
427 "--skip-bdb",427 "--loose-skip-innodb",
428 "--skip-ndbcluster",428 "--loose-skip-ndbcluster",
429 "--max_allowed_packet=8M",429 "--max_allowed_packet=8M",
430 "--default-storage-engine=MyISAM",
430 "--net_buffer_length=16K",431 "--net_buffer_length=16K",
431 @args,432 @args,
432 );433 );
@@ -439,6 +440,8 @@
439440
440open(SQL, $create_system_tables)441open(SQL, $create_system_tables)
441 or error($opt,"can't open $create_system_tables for reading: $!");442 or error($opt,"can't open $create_system_tables for reading: $!");
443open(SQL2, $fill_system_tables)
444 or error($opt,"can't open $fill_system_tables for reading: $!");
442# FIXME > /dev/null ?445# FIXME > /dev/null ?
443if ( open(PIPE, "| $mysqld_install_cmd_line") )446if ( open(PIPE, "| $mysqld_install_cmd_line") )
444{447{
@@ -452,8 +455,20 @@
452455
453 print PIPE $_;456 print PIPE $_;
454 }457 }
458 while ( <SQL2> )
459 {
460 # TODO: make it similar to the above condition when we're sure
461 # @@hostname returns a fqdn
462 # When doing a "cross bootstrap" install, no reference to the current
463 # host should be added to the system tables. So we filter out any
464 # lines which contain the current host name.
465 next if /\@current_hostname/;
466
467 print PIPE $_;
468 }
455 close PIPE;469 close PIPE;
456 close SQL;470 close SQL;
471 close SQL2;
457472
458 report_verbose($opt,"OK");473 report_verbose($opt,"OK");
459474
460475
=== modified file 'Percona-Server/scripts/mysqld_multi.sh'
--- Percona-Server/scripts/mysqld_multi.sh 2011-06-30 15:37:13 +0000
+++ Percona-Server/scripts/mysqld_multi.sh 2013-01-10 04:35:33 +0000
@@ -47,6 +47,28 @@
47$my_progname = $0;47$my_progname = $0;
48$my_progname =~ s/.*[\/]//;48$my_progname =~ s/.*[\/]//;
4949
50
51if (defined($ENV{UMASK})) {
52 my $UMASK = $ENV{UMASK};
53 my $m;
54 my $fmode = "0640";
55
56 if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) {
57 printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n");
58 printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); }
59 else {
60 $fmode= substr $UMASK, 2, 2;
61 $fmode= "06${fmode}"; }
62
63 if($fmode != $UMASK) {
64 printf("UMASK corrected from $UMASK to $fmode ...\n"); }
65
66 $fmode= oct($fmode);
67
68 umask($fmode);
69}
70
71
50main();72main();
5173
52####74####
5375
=== modified file 'Percona-Server/scripts/mysqld_safe.sh'
--- Percona-Server/scripts/mysqld_safe.sh 2010-04-09 11:47:18 +0000
+++ Percona-Server/scripts/mysqld_safe.sh 2013-01-10 04:35:33 +0000
@@ -27,7 +27,28 @@
2727
28trap '' 1 2 3 15 # we shouldn't let anyone kill us28trap '' 1 2 3 15 # we shouldn't let anyone kill us
2929
30umask 00730# MySQL-specific environment variable. First off, it's not really a umask,
31# it's the desired mode. Second, it follows umask(2), not umask(3) in that
32# octal needs to be explicit. Our shell might be a proper sh without printf,
33# multiple-base arithmetic, and binary arithmetic, so this will get ugly.
34# We reject decimal values to keep things at least half-sane.
35umask 007 # fallback
36UMASK="${UMASK-0640}"
37fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'`
38octalp=`echo "$fmode"|cut -c1`
39fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'`
40if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ]
41then
42 fmode=0640
43 echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2
44 echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2
45fi
46fmode=`echo "$fmode"|cut -c3-4`
47fmode="6$fmode"
48if [ "x$UMASK" != "x0$fmode" ]
49then
50 echo "UMASK corrected from $UMASK to 0$fmode ..."
51fi
3152
32defaults=53defaults=
33case "$1" in54case "$1" in
@@ -371,6 +392,12 @@
371 # Log to err_log file392 # Log to err_log file
372 log_notice "Logging to '$err_log'."393 log_notice "Logging to '$err_log'."
373 logging=file394 logging=file
395
396 if [ ! -e "$err_log" ]; then # if error log already exists,
397 touch "$err_log" # we just append. otherwise,
398 chmod "$fmode" "$err_log" # fix the permissions here!
399 fi
400
374else401else
375 if [ -n "$syslog_tag" ]402 if [ -n "$syslog_tag" ]
376 then403 then
@@ -572,6 +599,12 @@
572599
573 eval_log_error "$cmd"600 eval_log_error "$cmd"
574601
602 if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then
603 touch "$err_log" # hypothetical: log was renamed but not
604 chown $user "$err_log" # flushed yet. we'd recreate it with
605 chmod "$fmode" "$err_log" # wrong owner next time we log, so set
606 fi # it up correctly while we can!
607
575 if test ! -f "$pid_file" # This is removed if normal shutdown608 if test ! -f "$pid_file" # This is removed if normal shutdown
576 then609 then
577 break610 break
578611
=== modified file 'Percona-Server/sql/hostname.cc'
--- Percona-Server/sql/hostname.cc 2012-06-19 07:26:40 +0000
+++ Percona-Server/sql/hostname.cc 2013-01-10 04:35:33 +0000
@@ -214,6 +214,15 @@
214 }214 }
215 my_gethostbyname_r_free();215 my_gethostbyname_r_free();
216#else216#else
217
218 DBUG_EXECUTE_IF("addr_fake_ipv4",
219 {
220 const char* fake_host= "santa.claus.ipv4.example.com";
221 name=my_strdup(fake_host, MYF(0));
222 add_hostname(in,name);
223 DBUG_RETURN(name);
224 };);
225
217 VOID(pthread_mutex_lock(&LOCK_hostname));226 VOID(pthread_mutex_lock(&LOCK_hostname));
218 if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))227 if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
219 {228 {
220229
=== modified file 'Percona-Server/sql/item_cmpfunc.cc'
--- Percona-Server/sql/item_cmpfunc.cc 2011-07-03 15:47:37 +0000
+++ Percona-Server/sql/item_cmpfunc.cc 2013-01-10 04:35:33 +0000
@@ -1,4 +1,4 @@
1/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.1/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
22
3 This program is free software; you can redistribute it and/or modify3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by4 it under the terms of the GNU General Public License as published by
@@ -3045,6 +3045,15 @@
3045 return;3045 return;
3046 }3046 }
3047 }3047 }
3048 /*
3049 Set cmp_context of all WHEN arguments. This prevents
3050 Item_field::equal_fields_propagator() from transforming a
3051 zerofill argument into a string constant. Such a change would
3052 require rebuilding cmp_items.
3053 */
3054 for (i= 0; i < ncases; i+= 2)
3055 args[i]->cmp_context= item_cmp_type(left_result_type,
3056 args[i]->result_type());
3048 }3057 }
30493058
3050 if (else_expr_num == -1 || args[else_expr_num]->maybe_null)3059 if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
@@ -4032,6 +4041,16 @@
4032 }4041 }
4033 }4042 }
4034 }4043 }
4044 /*
4045 Set cmp_context of all arguments. This prevents
4046 Item_field::equal_fields_propagator() from transforming a zerofill integer
4047 argument into a string constant. Such a change would require rebuilding
4048 cmp_itmes.
4049 */
4050 for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
4051 {
4052 arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
4053 }
4035 max_length= 1;4054 max_length= 1;
4036}4055}
40374056
40384057
=== modified file 'Percona-Server/sql/item_func.cc'
--- Percona-Server/sql/item_func.cc 2012-10-05 07:20:04 +0000
+++ Percona-Server/sql/item_func.cc 2013-01-10 04:35:33 +0000
@@ -3596,7 +3596,8 @@
3596 thd->first_successful_insert_id_in_prev_stmt= value;3596 thd->first_successful_insert_id_in_prev_stmt= value;
3597 return value;3597 return value;
3598 }3598 }
3599 return thd->read_first_successful_insert_id_in_prev_stmt();3599 return
3600 static_cast<longlong>(thd->read_first_successful_insert_id_in_prev_stmt());
3600}3601}
36013602
36023603
36033604
=== modified file 'Percona-Server/sql/item_func.h'
--- Percona-Server/sql/item_func.h 2012-10-05 07:20:04 +0000
+++ Percona-Server/sql/item_func.h 2013-01-10 04:35:33 +0000
@@ -1043,6 +1043,7 @@
1043 const char *func_name() const { return "last_insert_id"; }1043 const char *func_name() const { return "last_insert_id"; }
1044 void fix_length_and_dec()1044 void fix_length_and_dec()
1045 {1045 {
1046 unsigned_flag= TRUE;
1046 if (arg_count)1047 if (arg_count)
1047 max_length= args[0]->max_length;1048 max_length= args[0]->max_length;
1048 }1049 }
10491050
=== modified file 'Percona-Server/sql/log.cc'
--- Percona-Server/sql/log.cc 2013-01-03 00:03:10 +0000
+++ Percona-Server/sql/log.cc 2013-01-10 04:35:33 +0000
@@ -4448,10 +4448,16 @@
4448 /*4448 /*
4449 Write pending event to log file or transaction cache4449 Write pending event to log file or transaction cache
4450 */4450 */
4451 DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
4452 {DBUG_SET("+d,simulate_file_write_error");});
4451 if (pending->write(file))4453 if (pending->write(file))
4452 {4454 {
4453 pthread_mutex_unlock(&LOCK_log);4455 pthread_mutex_unlock(&LOCK_log);
4454 set_write_error(thd);4456 set_write_error(thd);
4457 delete pending;
4458 trx_data->set_pending(NULL);
4459 DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
4460 {DBUG_SET("-d,simulate_file_write_error");});
4455 DBUG_RETURN(1);4461 DBUG_RETURN(1);
4456 }4462 }
44574463
44584464
=== modified file 'Percona-Server/sql/log_event.cc'
--- Percona-Server/sql/log_event.cc 2012-12-30 12:35:56 +0000
+++ Percona-Server/sql/log_event.cc 2013-01-10 04:35:33 +0000
@@ -54,6 +54,22 @@
54*/54*/
55#define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1)55#define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1)
5656
57/*
58 Explicit instantiation to unsigned int of template available_buffer
59 function.
60*/
61template unsigned int available_buffer<unsigned int>(const char*,
62 const char*,
63 unsigned int);
64
65/*
66 Explicit instantiation to unsigned int of template valid_buffer_range
67 function.
68*/
69template bool valid_buffer_range<unsigned int>(unsigned int,
70 const char*,
71 const char*,
72 unsigned int);
5773
58#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)74#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
59static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd);75static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd);
@@ -1286,7 +1302,7 @@
1286 ev = new Rand_log_event(buf, description_event);1302 ev = new Rand_log_event(buf, description_event);
1287 break;1303 break;
1288 case USER_VAR_EVENT:1304 case USER_VAR_EVENT:
1289 ev = new User_var_log_event(buf, description_event);1305 ev = new User_var_log_event(buf, event_len, description_event);
1290 break;1306 break;
1291 case FORMAT_DESCRIPTION_EVENT:1307 case FORMAT_DESCRIPTION_EVENT:
1292 ev = new Format_description_log_event(buf, event_len, description_event);1308 ev = new Format_description_log_event(buf, event_len, description_event);
@@ -5755,18 +5771,34 @@
57555771
57565772
5757User_var_log_event::5773User_var_log_event::
5758User_var_log_event(const char* buf,5774User_var_log_event(const char* buf, uint event_len,
5759 const Format_description_log_event* description_event)5775 const Format_description_log_event* description_event)
5760 :Log_event(buf, description_event)5776 :Log_event(buf, description_event)
5761#ifndef MYSQL_CLIENT5777#ifndef MYSQL_CLIENT
5762 , deferred(false)5778 , deferred(false)
5763#endif5779#endif
5764{5780{
5781 bool error= false;
5782 const char* buf_start= buf;
5765 /* The Post-Header is empty. The Variable Data part begins immediately. */5783 /* The Post-Header is empty. The Variable Data part begins immediately. */
5766 buf+= description_event->common_header_len +5784 buf+= description_event->common_header_len +
5767 description_event->post_header_len[USER_VAR_EVENT-1];5785 description_event->post_header_len[USER_VAR_EVENT-1];
5768 name_len= uint4korr(buf);5786 name_len= uint4korr(buf);
5769 name= (char *) buf + UV_NAME_LEN_SIZE;5787 name= (char *) buf + UV_NAME_LEN_SIZE;
5788
5789 /*
5790 We don't know yet is_null value, so we must assume that name_len
5791 may have the bigger value possible, is_null= True and there is no
5792 payload for val.
5793 */
5794 if (0 == name_len ||
5795 !valid_buffer_range<uint>(name_len, buf_start, name,
5796 event_len - UV_VAL_IS_NULL))
5797 {
5798 error= true;
5799 goto err;
5800 }
5801
5770 buf+= UV_NAME_LEN_SIZE + name_len;5802 buf+= UV_NAME_LEN_SIZE + name_len;
5771 is_null= (bool) *buf;5803 is_null= (bool) *buf;
5772 if (is_null)5804 if (is_null)
@@ -5778,13 +5810,31 @@
5778 }5810 }
5779 else5811 else
5780 {5812 {
5813 if (!valid_buffer_range<uint>(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE
5814 + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE,
5815 buf_start, buf, event_len))
5816 {
5817 error= true;
5818 goto err;
5819 }
5820
5781 type= (Item_result) buf[UV_VAL_IS_NULL];5821 type= (Item_result) buf[UV_VAL_IS_NULL];
5782 charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE);5822 charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE);
5783 val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + 5823 val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
5784 UV_CHARSET_NUMBER_SIZE);5824 UV_CHARSET_NUMBER_SIZE);
5785 val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +5825 val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
5786 UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE);5826 UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE);
5827
5828 if (!valid_buffer_range<uint>(val_len, buf_start, val, event_len))
5829 {
5830 error= true;
5831 goto err;
5832 }
5787 }5833 }
5834
5835err:
5836 if (error)
5837 name= 0;
5788}5838}
57895839
57905840
@@ -5931,8 +5981,9 @@
5931 char *hex_str;5981 char *hex_str;
5932 CHARSET_INFO *cs;5982 CHARSET_INFO *cs;
59335983
5934 if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte5984 hex_str= (char *)my_malloc(2*val_len+1+2,MYF(MY_WME)); // 2 hex digits / byte
5935 break; // no error, as we are 'void'5985 if (!hex_str)
5986 return;
5936 str_to_hex(hex_str, val, val_len);5987 str_to_hex(hex_str, val, val_len);
5937 /*5988 /*
5938 For proper behaviour when mysqlbinlog|mysql, we need to explicitely5989 For proper behaviour when mysqlbinlog|mysql, we need to explicitely
59395990
=== modified file 'Percona-Server/sql/log_event.h'
--- Percona-Server/sql/log_event.h 2013-01-10 04:35:31 +0000
+++ Percona-Server/sql/log_event.h 2013-01-10 04:35:33 +0000
@@ -2517,7 +2517,7 @@
2517 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);2517 void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2518#endif2518#endif
25192519
2520 User_var_log_event(const char* buf,2520 User_var_log_event(const char* buf, uint event_len,
2521 const Format_description_log_event *description_event);2521 const Format_description_log_event *description_event);
2522 ~User_var_log_event() {}2522 ~User_var_log_event() {}
2523 Log_event_type get_type_code() { return USER_VAR_EVENT;}2523 Log_event_type get_type_code() { return USER_VAR_EVENT;}
@@ -2529,9 +2529,9 @@
2529 and which case the applier adjusts execution path.2529 and which case the applier adjusts execution path.
2530 */2530 */
2531 bool is_deferred() { return deferred; }2531 bool is_deferred() { return deferred; }
2532 void set_deferred() { deferred= val; }2532 void set_deferred() { deferred= true; }
2533#endif2533#endif
2534 bool is_valid() const { return 1; }2534 bool is_valid() const { return name != 0; }
25352535
2536private:2536private:
2537#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)2537#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
25382538
=== modified file 'Percona-Server/sql/mysql_priv.h'
--- Percona-Server/sql/mysql_priv.h 2012-10-05 07:20:04 +0000
+++ Percona-Server/sql/mysql_priv.h 2013-01-10 04:35:33 +0000
@@ -505,6 +505,41 @@
505*/505*/
506#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)506#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)
507507
508/*
509 Check how many bytes are available on buffer.
510
511 @param buf_start Pointer to buffer start.
512 @param buf_current Pointer to the current position on buffer.
513 @param buf_len Buffer length.
514
515 @return Number of bytes available on event buffer.
516*/
517template <class T> T available_buffer(const char* buf_start,
518 const char* buf_current,
519 T buf_len)
520{
521 return buf_len - (buf_current - buf_start);
522}
523
524/*
525 Check if jump value is within buffer limits.
526
527 @param jump Number of positions we want to advance.
528 @param buf_start Pointer to buffer start
529 @param buf_current Pointer to the current position on buffer.
530 @param buf_len Buffer length.
531
532 @return True If jump value is within buffer limits.
533 False Otherwise.
534*/
535template <class T> bool valid_buffer_range(T jump,
536 const char* buf_start,
537 const char* buf_current,
538 T buf_len)
539{
540 return (jump <= available_buffer(buf_start, buf_current, buf_len));
541}
542
508/* The rest of the file is included in the server only */543/* The rest of the file is included in the server only */
509#ifndef MYSQL_CLIENT544#ifndef MYSQL_CLIENT
510545
511546
=== modified file 'Percona-Server/sql/mysqld.cc'
--- Percona-Server/sql/mysqld.cc 2013-01-10 04:35:31 +0000
+++ Percona-Server/sql/mysqld.cc 2013-01-10 04:35:33 +0000
@@ -4981,7 +4981,7 @@
4981 if (cached_thread_count > wake_thread)4981 if (cached_thread_count > wake_thread)
4982 {4982 {
4983 /* Get thread from cache */4983 /* Get thread from cache */
4984 thread_cache.append(thd);4984 thread_cache.push_back(thd);
4985 wake_thread++;4985 wake_thread++;
4986 pthread_cond_signal(&COND_thread_cache);4986 pthread_cond_signal(&COND_thread_cache);
4987 }4987 }
49884988
=== modified file 'Percona-Server/sql/sp_head.cc'
--- Percona-Server/sql/sp_head.cc 2012-10-15 15:08:07 +0000
+++ Percona-Server/sql/sp_head.cc 2013-01-10 04:35:33 +0000
@@ -3860,8 +3860,6 @@
3860 Multi-set key:3860 Multi-set key:
3861 db_name\0table_name\0alias\0 - for normal tables3861 db_name\0table_name\0alias\0 - for normal tables
3862 db_name\0table_name\0 - for temporary tables3862 db_name\0table_name\0 - for temporary tables
3863 Note that in both cases we don't take last '\0' into account when
3864 we count length of key.
3865 */3863 */
3866 LEX_STRING qname;3864 LEX_STRING qname;
3867 uint db_length, table_name_length;3865 uint db_length, table_name_length;
@@ -3918,19 +3916,26 @@
3918 for (; table ; table= table->next_global)3916 for (; table ; table= table->next_global)
3919 if (!table->derived && !table->schema_table)3917 if (!table->derived && !table->schema_table)
3920 {3918 {
3921 char tname[(NAME_LEN + 1) * 3]; // db\0table\0alias\03919 /*
3922 uint tlen, alen;3920 Structure of key for the multi-set is "db\0table\0alias\0".
3921 Since "alias" part can have arbitrary length we use String
3922 object to construct the key. By default String will use
3923 buffer allocated on stack with NAME_LEN bytes reserved for
3924 alias, since in most cases it is going to be smaller than
3925 NAME_LEN bytes.
3926 */
3927 char tname_buff[(NAME_LEN + 1) * 3];
3928 String tname(tname_buff, sizeof(tname_buff), &my_charset_bin);
3929 uint temp_table_key_length;
39233930
3924 tlen= table->db_length;3931 tname.length(0);
3925 memcpy(tname, table->db, tlen);3932 tname.append(table->db, table->db_length);
3926 tname[tlen++]= '\0';3933 tname.append('\0');
3927 memcpy(tname+tlen, table->table_name, table->table_name_length);3934 tname.append(table->table_name, table->table_name_length);
3928 tlen+= table->table_name_length;3935 tname.append('\0');
3929 tname[tlen++]= '\0';3936 temp_table_key_length= tname.length();
3930 alen= strlen(table->alias);3937 tname.append(table->alias);
3931 memcpy(tname+tlen, table->alias, alen);3938 tname.append('\0');
3932 tlen+= alen;
3933 tname[tlen]= '\0';
39343939
3935 /*3940 /*
3936 Upgrade the lock type because this table list will be used3941 Upgrade the lock type because this table list will be used
@@ -3945,9 +3950,10 @@
3945 (and therefore should not be prelocked). Otherwise we will erroneously3950 (and therefore should not be prelocked). Otherwise we will erroneously
3946 treat table with same name but with different alias as non-temporary.3951 treat table with same name but with different alias as non-temporary.
3947 */3952 */
3948 if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) ||3953 if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(),
3949 ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname,3954 tname.length())) ||
3950 tlen - alen - 1)) &&3955 ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname.ptr(),
3956 temp_table_key_length)) &&
3951 tab->temp))3957 tab->temp))
3952 {3958 {
3953 if (tab->lock_type < table->lock_type)3959 if (tab->lock_type < table->lock_type)
@@ -3966,11 +3972,11 @@
3966 lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)3972 lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
3967 {3973 {
3968 tab->temp= TRUE;3974 tab->temp= TRUE;
3969 tab->qname.length= tlen - alen - 1;3975 tab->qname.length= temp_table_key_length;
3970 }3976 }
3971 else3977 else
3972 tab->qname.length= tlen;3978 tab->qname.length= tname.length();
3973 tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1);3979 tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length);
3974 if (!tab->qname.str)3980 if (!tab->qname.str)
3975 return FALSE;3981 return FALSE;
3976 tab->table_name_length= table->table_name_length;3982 tab->table_name_length= table->table_name_length;
@@ -4039,7 +4045,7 @@
4039 if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *4045 if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *
4040 stab->lock_count)) ||4046 stab->lock_count)) ||
4041 !(key_buff= (char*)thd->memdup(stab->qname.str,4047 !(key_buff= (char*)thd->memdup(stab->qname.str,
4042 stab->qname.length + 1)))4048 stab->qname.length)))
4043 DBUG_RETURN(FALSE);4049 DBUG_RETURN(FALSE);
40444050
4045 for (uint j= 0; j < stab->lock_count; j++)4051 for (uint j= 0; j < stab->lock_count; j++)
40464052
=== modified file 'Percona-Server/sql/sql_acl.cc'
--- Percona-Server/sql/sql_acl.cc 2012-11-28 22:39:45 +0000
+++ Percona-Server/sql/sql_acl.cc 2013-01-10 04:35:33 +0000
@@ -195,7 +195,17 @@
195static my_bool acl_load(THD *thd, TABLE_LIST *tables);195static my_bool acl_load(THD *thd, TABLE_LIST *tables);
196static my_bool grant_load(THD *thd, TABLE_LIST *tables);196static my_bool grant_load(THD *thd, TABLE_LIST *tables);
197static inline void get_grantor(THD *thd, char* grantor);197static inline void get_grantor(THD *thd, char* grantor);
198198/*
199 Enumeration of various ACL's and Hashes used in handle_grant_struct()
200*/
201enum enum_acl_lists
202{
203 USER_ACL= 0,
204 DB_ACL,
205 COLUMN_PRIVILEGES_HASH,
206 PROC_PRIVILEGES_HASH,
207 FUNC_PRIVILEGES_HASH
208};
199/*209/*
200 Convert scrambled password to binary form, according to scramble type, 210 Convert scrambled password to binary form, according to scramble type,
201 Binary form is stored in user.salt.211 Binary form is stored in user.salt.
@@ -1346,10 +1356,19 @@
1346{1356{
1347 ulong host_access= ~(ulong)0, db_access= 0;1357 ulong host_access= ~(ulong)0, db_access= 0;
1348 uint i;1358 uint i;
1349 size_t key_length;1359 size_t key_length, copy_length;
1350 char key[ACL_KEY_LENGTH],*tmp_db,*end;1360 char key[ACL_KEY_LENGTH],*tmp_db,*end;
1351 acl_entry *entry;1361 acl_entry *entry;
1352 DBUG_ENTER("acl_get");1362 DBUG_ENTER("acl_get");
1363
1364 copy_length= (size_t) (strlen(ip ? ip : "") +
1365 strlen(user ? user : "") +
1366 strlen(db ? db : ""));
1367 /*
1368 Make sure that strmov() operations do not result in buffer overflow.
1369 */
1370 if (copy_length >= ACL_KEY_LENGTH)
1371 DBUG_RETURN(0);
13531372
1354 tmp_db= strmov(strmov(key, ip ? ip : "") + 1, user) + 1;1373 tmp_db= strmov(strmov(key, ip ? ip : "") + 1, user) + 1;
1355 end= strnmov(tmp_db, db, key + sizeof(key) - tmp_db);1374 end= strnmov(tmp_db, db, key + sizeof(key) - tmp_db);
@@ -4336,6 +4355,16 @@
4336 char helping [NAME_LEN+USERNAME_LENGTH+2], *end;4355 char helping [NAME_LEN+USERNAME_LENGTH+2], *end;
4337 uint len;4356 uint len;
4338 bool error= TRUE;4357 bool error= TRUE;
4358 size_t copy_length;
4359
4360 copy_length= (size_t) (strlen(sctx->priv_user ? sctx->priv_user : "") +
4361 strlen(db ? db : ""));
4362
4363 /*
4364 Make sure that strmov() operations do not result in buffer overflow.
4365 */
4366 if (copy_length >= (NAME_LEN+USERNAME_LENGTH+2))
4367 return 1;
43394368
4340 end= strmov(helping, sctx->priv_user) + 1;4369 end= strmov(helping, sctx->priv_user) + 1;
4341 end= strnmov(end, db, helping + sizeof(helping) - end);4370 end= strnmov(end, db, helping + sizeof(helping) - end);
@@ -5402,19 +5431,19 @@
5402 Delete from grant structure if drop is true.5431 Delete from grant structure if drop is true.
5403 Update in grant structure if drop is false and user_to is not NULL.5432 Update in grant structure if drop is false and user_to is not NULL.
5404 Search in grant structure if drop is false and user_to is NULL.5433 Search in grant structure if drop is false and user_to is NULL.
5405 Structures are numbered as follows:5434 Structures are enumerated as follows:
5406 0 acl_users5435 0 ACL_USER
5407 1 acl_dbs5436 1 ACL_DB
5408 2 column_priv_hash5437 2 COLUMN_PRIVILEGES_HASH
5409 3 proc_priv_hash5438 3 PROC_PRIVILEGES_HASH
5410 4 func_priv_hash5439 4 FUNC_PRIVILEGES_HASH
54115440
5412 @retval > 0 At least one element matched.5441 @retval > 0 At least one element matched.
5413 @retval 0 OK, but no element matched.5442 @retval 0 OK, but no element matched.
5414 @retval -1 Wrong arguments to function.5443 @retval -1 Wrong arguments to function or Out of Memory
5415*/5444*/
54165445
5417static int handle_grant_struct(uint struct_no, bool drop,5446static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
5418 LEX_USER *user_from, LEX_USER *user_to)5447 LEX_USER *user_from, LEX_USER *user_to)
5419{5448{
5420 int result= 0;5449 int result= 0;
@@ -5425,6 +5454,11 @@
5425 ACL_USER *acl_user= NULL;5454 ACL_USER *acl_user= NULL;
5426 ACL_DB *acl_db= NULL;5455 ACL_DB *acl_db= NULL;
5427 GRANT_NAME *grant_name= NULL;5456 GRANT_NAME *grant_name= NULL;
5457 /*
5458 Dynamic array acl_grant_name used to store pointers to all
5459 GRANT_NAME objects
5460 */
5461 Dynamic_array<GRANT_NAME *> acl_grant_name;
5428 HASH *grant_name_hash= NULL;5462 HASH *grant_name_hash= NULL;
5429 DBUG_ENTER("handle_grant_struct");5463 DBUG_ENTER("handle_grant_struct");
5430 DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'",5464 DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'",
@@ -5437,21 +5471,21 @@
54375471
5438 /* Get the number of elements in the in-memory structure. */5472 /* Get the number of elements in the in-memory structure. */
5439 switch (struct_no) {5473 switch (struct_no) {
5440 case 0:5474 case USER_ACL:
5441 elements= acl_users.elements;5475 elements= acl_users.elements;
5442 break;5476 break;
5443 case 1:5477 case DB_ACL:
5444 elements= acl_dbs.elements;5478 elements= acl_dbs.elements;
5445 break;5479 break;
5446 case 2:5480 case COLUMN_PRIVILEGES_HASH:
5447 elements= column_priv_hash.records;5481 elements= column_priv_hash.records;
5448 grant_name_hash= &column_priv_hash;5482 grant_name_hash= &column_priv_hash;
5449 break;5483 break;
5450 case 3:5484 case PROC_PRIVILEGES_HASH:
5451 elements= proc_priv_hash.records;5485 elements= proc_priv_hash.records;
5452 grant_name_hash= &proc_priv_hash;5486 grant_name_hash= &proc_priv_hash;
5453 break;5487 break;
5454 case 4:5488 case FUNC_PRIVILEGES_HASH:
5455 elements= func_priv_hash.records;5489 elements= func_priv_hash.records;
5456 grant_name_hash= &func_priv_hash;5490 grant_name_hash= &func_priv_hash;
5457 break;5491 break;
@@ -5470,21 +5504,21 @@
5470 Get a pointer to the element.5504 Get a pointer to the element.
5471 */5505 */
5472 switch (struct_no) {5506 switch (struct_no) {
5473 case 0:5507 case USER_ACL:
5474 acl_user= dynamic_element(&acl_users, idx, ACL_USER*);5508 acl_user= dynamic_element(&acl_users, idx, ACL_USER*);
5475 user= acl_user->user;5509 user= acl_user->user;
5476 host= acl_user->host.hostname;5510 host= acl_user->host.hostname;
5477 break;5511 break;
54785512
5479 case 1:5513 case DB_ACL:
5480 acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);5514 acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
5481 user= acl_db->user;5515 user= acl_db->user;
5482 host= acl_db->host.hostname;5516 host= acl_db->host.hostname;
5483 break;5517 break;
54845518
5485 case 2:5519 case COLUMN_PRIVILEGES_HASH:
5486 case 3:5520 case PROC_PRIVILEGES_HASH:
5487 case 4:5521 case FUNC_PRIVILEGES_HASH:
5488 grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx);5522 grant_name= (GRANT_NAME*) hash_element(grant_name_hash, idx);
5489 user= grant_name->user;5523 user= grant_name->user;
5490 host= grant_name->host.hostname;5524 host= grant_name->host.hostname;
@@ -5510,86 +5544,60 @@
5510 if ( drop )5544 if ( drop )
5511 {5545 {
5512 switch ( struct_no ) {5546 switch ( struct_no ) {
5513 case 0:5547 case USER_ACL:
5514 delete_dynamic_element(&acl_users, idx);5548 delete_dynamic_element(&acl_users, idx);
5515 break;5549 elements--;
55165550 /*
5517 case 1:
5518 delete_dynamic_element(&acl_dbs, idx);
5519 break;
5520
5521 case 2:
5522 case 3:
5523 case 4:
5524 hash_delete(grant_name_hash, (uchar*) grant_name);
5525 break;
5526 }
5527 elements--;
5528 /*
5529 - If we are iterating through an array then we just have moved all5551 - If we are iterating through an array then we just have moved all
5530 elements after the current element one position closer to its head.5552 elements after the current element one position closer to its head.
5531 This means that we have to take another look at the element at5553 This means that we have to take another look at the element at
5532 current position as it is a new element from the array's tail.5554 current position as it is a new element from the array's tail.
5533 - If we are iterating through a hash the current element was replaced5555 - This is valid for USER_ACL, DB_ACL.
5534 with one of elements from the tail. So we also have to take a look5556 */
5535 at the new element in current position.5557 idx--;
5536 Note that in our HASH implementation hash_delete() won't move any5558 break;
5537 elements with position after current one to position before the5559
5538 current (i.e. from the tail to the head), so it is safe to continue5560 case DB_ACL:
5539 iteration without re-starting.5561 delete_dynamic_element(&acl_dbs, idx);
5540 */5562 elements--;
5541 idx--;5563 idx--;
5564 break;
5565
5566 case COLUMN_PRIVILEGES_HASH:
5567 case PROC_PRIVILEGES_HASH:
5568 case FUNC_PRIVILEGES_HASH:
5569 /*
5570 Deleting while traversing a hash table is not valid procedure and
5571 hence we save pointers to GRANT_NAME objects for later processing.
5572 */
5573 if (acl_grant_name.append(grant_name))
5574 DBUG_RETURN(-1);
5575 break;
5576 }
5542 }5577 }
5543 else if ( user_to )5578 else if ( user_to )
5544 {5579 {
5545 switch ( struct_no ) {5580 switch ( struct_no ) {
5546 case 0:5581 case USER_ACL:
5547 acl_user->user= strdup_root(&mem, user_to->user.str);5582 acl_user->user= strdup_root(&mem, user_to->user.str);
5548 acl_user->host.hostname= strdup_root(&mem, user_to->host.str);5583 acl_user->host.hostname= strdup_root(&mem, user_to->host.str);
5549 break;5584 break;
55505585
5551 case 1:5586 case DB_ACL:
5552 acl_db->user= strdup_root(&mem, user_to->user.str);5587 acl_db->user= strdup_root(&mem, user_to->user.str);
5553 acl_db->host.hostname= strdup_root(&mem, user_to->host.str);5588 acl_db->host.hostname= strdup_root(&mem, user_to->host.str);
5554 break;5589 break;
55555590
5556 case 2:5591 case COLUMN_PRIVILEGES_HASH:
5557 case 3:5592 case PROC_PRIVILEGES_HASH:
5558 case 4:5593 case FUNC_PRIVILEGES_HASH:
5559 {5594 /*
5560 /*5595 Updating while traversing a hash table is not valid procedure and
5561 Save old hash key and its length to be able properly update5596 hence we save pointers to GRANT_NAME objects for later processing.
5562 element position in hash.5597 */
5563 */5598 if (acl_grant_name.append(grant_name))
5564 char *old_key= grant_name->hash_key;5599 DBUG_RETURN(-1);
5565 size_t old_key_length= grant_name->key_length;5600 break;
5566
5567 /*
5568 Update the grant structure with the new user name and host name.
5569 */
5570 grant_name->set_user_details(user_to->host.str, grant_name->db,
5571 user_to->user.str, grant_name->tname,
5572 TRUE);
5573
5574 /*
5575 Since username is part of the hash key, when the user name
5576 is renamed, the hash key is changed. Update the hash to
5577 ensure that the position matches the new hash key value
5578 */
5579 hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key,
5580 old_key_length);
5581 /*
5582 hash_update() operation could have moved element from the tail
5583 of the hash to the current position. So we need to take a look
5584 at the element in current position once again.
5585 Thanks to the fact that hash_update() for our HASH implementation
5586 won't move any elements from the tail of the hash to the positions
5587 before the current one (a.k.a. head) it is safe to continue
5588 iteration without restarting.
5589 */
5590 idx--;
5591 break;
5592 }
5593 }5601 }
5594 }5602 }
5595 else5603 else
@@ -5598,6 +5606,48 @@
5598 break;5606 break;
5599 }5607 }
5600 }5608 }
5609
5610 if (drop || user_to)
5611 {
5612 /*
5613 Traversing the elements stored in acl_grant_name dynamic array
5614 to either delete or update them.
5615 */
5616 for (int i= 0; i < acl_grant_name.elements(); ++i)
5617 {
5618 grant_name= acl_grant_name.at(i);
5619
5620 if (drop)
5621 {
5622 my_hash_delete(grant_name_hash, (uchar *) grant_name);
5623 }
5624 else
5625 {
5626 /*
5627 Save old hash key and its length to be able properly update
5628 element position in hash.
5629 */
5630 char *old_key= grant_name->hash_key;
5631 size_t old_key_length= grant_name->key_length;
5632
5633 /*
5634 Update the grant structure with the new user name and host name.
5635 */
5636 grant_name->set_user_details(user_to->host.str, grant_name->db,
5637 user_to->user.str, grant_name->tname,
5638 TRUE);
5639
5640 /*
5641 Since username is part of the hash key, when the user name
5642 is renamed, the hash key is changed. Update the hash to
5643 ensure that the position matches the new hash key value
5644 */
5645 my_hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key,
5646 old_key_length);
5647 }
5648 }
5649 }
5650
5601#ifdef EXTRA_DEBUG5651#ifdef EXTRA_DEBUG
5602 DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result));5652 DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result));
5603#endif5653#endif
@@ -5635,6 +5685,7 @@
5635{5685{
5636 int result= 0;5686 int result= 0;
5637 int found;5687 int found;
5688 int ret;
5638 DBUG_ENTER("handle_grant_data");5689 DBUG_ENTER("handle_grant_data");
56395690
5640 /* Handle user table. */5691 /* Handle user table. */
@@ -5646,14 +5697,19 @@
5646 else5697 else
5647 {5698 {
5648 /* Handle user array. */5699 /* Handle user array. */
5649 if ((handle_grant_struct(0, drop, user_from, user_to) && ! result) ||5700 if (((ret= handle_grant_struct(USER_ACL, drop, user_from, user_to) > 0) &&
5650 found)5701 ! result) || found)
5651 {5702 {
5652 result= 1; /* At least one record/element found. */5703 result= 1; /* At least one record/element found. */
5653 /* If search is requested, we do not need to search further. */5704 /* If search is requested, we do not need to search further. */
5654 if (! drop && ! user_to)5705 if (! drop && ! user_to)
5655 goto end;5706 goto end;
5656 }5707 }
5708 else if (ret < 0)
5709 {
5710 result= -1;
5711 goto end;
5712 }
5657 }5713 }
56585714
5659 /* Handle db table. */5715 /* Handle db table. */
@@ -5665,14 +5721,19 @@
5665 else5721 else
5666 {5722 {
5667 /* Handle db array. */5723 /* Handle db array. */
5668 if (((handle_grant_struct(1, drop, user_from, user_to) && ! result) ||5724 if ((((ret= handle_grant_struct(DB_ACL, drop, user_from, user_to) > 0) &&
5669 found) && ! result)5725 ! result) || found) && ! result)
5670 {5726 {
5671 result= 1; /* At least one record/element found. */5727 result= 1; /* At least one record/element found. */
5672 /* If search is requested, we do not need to search further. */5728 /* If search is requested, we do not need to search further. */
5673 if (! drop && ! user_to)5729 if (! drop && ! user_to)
5674 goto end;5730 goto end;
5675 }5731 }
5732 else if (ret < 0)
5733 {
5734 result= -1;
5735 goto end;
5736 }
5676 }5737 }
56775738
5678 /* Handle stored routines table. */5739 /* Handle stored routines table. */
@@ -5684,23 +5745,35 @@
5684 else5745 else
5685 {5746 {
5686 /* Handle procs array. */5747 /* Handle procs array. */
5687 if (((handle_grant_struct(3, drop, user_from, user_to) && ! result) ||5748 if ((((ret= handle_grant_struct(PROC_PRIVILEGES_HASH, drop, user_from,
5688 found) && ! result)5749 user_to) > 0) && ! result) || found) &&
5750 ! result)
5689 {5751 {
5690 result= 1; /* At least one record/element found. */5752 result= 1; /* At least one record/element found. */
5691 /* If search is requested, we do not need to search further. */5753 /* If search is requested, we do not need to search further. */
5692 if (! drop && ! user_to)5754 if (! drop && ! user_to)
5693 goto end;5755 goto end;
5694 }5756 }
5757 else if (ret < 0)
5758 {
5759 result= -1;
5760 goto end;
5761 }
5695 /* Handle funcs array. */5762 /* Handle funcs array. */
5696 if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) ||5763 if ((((ret= handle_grant_struct(FUNC_PRIVILEGES_HASH, drop, user_from,
5697 found) && ! result)5764 user_to) > 0) && ! result) || found) &&
5765 ! result)
5698 {5766 {
5699 result= 1; /* At least one record/element found. */5767 result= 1; /* At least one record/element found. */
5700 /* If search is requested, we do not need to search further. */5768 /* If search is requested, we do not need to search further. */
5701 if (! drop && ! user_to)5769 if (! drop && ! user_to)
5702 goto end;5770 goto end;
5703 }5771 }
5772 else if (ret < 0)
5773 {
5774 result= -1;
5775 goto end;
5776 }
5704 }5777 }
57055778
5706 /* Handle tables table. */5779 /* Handle tables table. */
@@ -5728,9 +5801,12 @@
5728 else5801 else
5729 {5802 {
5730 /* Handle columns hash. */5803 /* Handle columns hash. */
5731 if (((handle_grant_struct(2, drop, user_from, user_to) && ! result) ||5804 if ((((ret= handle_grant_struct(COLUMN_PRIVILEGES_HASH, drop, user_from,
5732 found) && ! result)5805 user_to) > 0) && ! result) || found) &&
5806 ! result)
5733 result= 1; /* At least one record/element found. */5807 result= 1; /* At least one record/element found. */
5808 else if (ret < 0)
5809 result= -1;
5734 }5810 }
5735 }5811 }
5736 end:5812 end:
57375813
=== modified file 'Percona-Server/sql/sql_connect.cc'
--- Percona-Server/sql/sql_connect.cc 2012-08-20 03:14:02 +0000
+++ Percona-Server/sql/sql_connect.cc 2013-01-10 04:35:33 +0000
@@ -914,6 +914,7 @@
914914
915 USER_RESOURCES ur;915 USER_RESOURCES ur;
916 int res= acl_getroot(thd, &ur, passwd, passwd_len);916 int res= acl_getroot(thd, &ur, passwd, passwd_len);
917 DBUG_EXECUTE_IF("password_format_mismatch",{res= -1;};);
917#ifndef EMBEDDED_LIBRARY918#ifndef EMBEDDED_LIBRARY
918 if (res == -1)919 if (res == -1)
919 {920 {
@@ -924,6 +925,12 @@
924 in old format.925 in old format.
925 */926 */
926 NET *net= &thd->net;927 NET *net= &thd->net;
928 DBUG_EXECUTE_IF("password_format_mismatch",
929 {
930 inc_host_errors(&thd->remote.sin_addr);
931 my_error(ER_HANDSHAKE_ERROR, MYF(0));
932 DBUG_RETURN(1);
933 };);
927 if (opt_secure_auth_local)934 if (opt_secure_auth_local)
928 {935 {
929 my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0),936 my_error(ER_SERVER_IS_IN_SECURE_AUTH_MODE, MYF(0),
@@ -1395,6 +1402,8 @@
1395 size_t passwd_len;1402 size_t passwd_len;
1396 char *user;1403 char *user;
1397 size_t user_len;1404 size_t user_len;
1405 uint charset_code= 0;
1406 size_t bytes_remaining_in_packet= 0;
13981407
1399 DBUG_PRINT("info",1408 DBUG_PRINT("info",
1400 ("New connection received on %s", vio_description(net->vio)));1409 ("New connection received on %s", vio_description(net->vio)));
@@ -1411,6 +1420,19 @@
1411 my_error(ER_BAD_HOST_ERROR, MYF(0));1420 my_error(ER_BAD_HOST_ERROR, MYF(0));
1412 return 1;1421 return 1;
1413 }1422 }
1423 /* BEGIN : DEBUG */
1424 DBUG_EXECUTE_IF("addr_fake_ipv4",
1425 {
1426 struct sockaddr *sa= (sockaddr *) &net->vio->remote;
1427 sa->sa_family= AF_INET;
1428 struct in_addr *ip4= &((struct sockaddr_in *)sa)->sin_addr;
1429 /* See RFC 5737, 192.0.2.0/23 is reserved */
1430 const char* fake= "192.0.2.4";
1431 ip4->s_addr= inet_addr(fake);
1432 strcpy(ip, fake);
1433 };);
1434 /* END : DEBUG */
1435
1414 if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))1436 if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))
1415 return 1; /* The error is set by my_strdup(). */1437 return 1; /* The error is set by my_strdup(). */
1416 thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip;1438 thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip;
@@ -1506,32 +1528,31 @@
1506 (uchar*) buff, (size_t) (end-buff)) ||1528 (uchar*) buff, (size_t) (end-buff)) ||
1507 (pkt_len= my_net_read(net)) == packet_error)1529 (pkt_len= my_net_read(net)) == packet_error)
1508 {1530 {
1509 inc_host_errors(&thd->remote.sin_addr);1531 goto error;
1510 my_error(ER_HANDSHAKE_ERROR, MYF(0));
1511 return 1;
1512 }1532 }
1513 }1533 }
1514#ifdef _CUSTOMCONFIG_1534#ifdef _CUSTOMCONFIG_
1515#include "_cust_sql_parse.h"1535#include "_cust_sql_parse.h"
1516#endif1536#endif
1517 if (connect_errors)
1518 reset_host_errors(&thd->remote.sin_addr);
1519 if (thd->packet.alloc(thd->variables.net_buffer_length))1537 if (thd->packet.alloc(thd->variables.net_buffer_length))
1520 return 1; /* The error is set by alloc(). */1538 return 1; /* The error is set by alloc(). */
15211539
1522 uint charset_code= 0;
1523 end= (char *)net->read_pos;1540 end= (char *)net->read_pos;
1524 /*1541 /*
1525 In order to safely scan a head for '\0' string terminators1542 In order to safely scan a head for '\0' string terminators
1526 we must keep track of how many bytes remain in the allocated1543 we must keep track of how many bytes remain in the allocated
1527 buffer or we might read past the end of the buffer.1544 buffer or we might read past the end of the buffer.
1528 */1545 */
1529 size_t bytes_remaining_in_packet= pkt_len;1546 bytes_remaining_in_packet= pkt_len;
1530 1547
1531 /*1548 /*
1532 Peek ahead on the client capability packet and determine which version of1549 Peek ahead on the client capability packet and determine which version of
1533 the protocol should be used.1550 the protocol should be used.
1534 */1551 */
1552 DBUG_EXECUTE_IF("host_error_packet_length",
1553 {
1554 bytes_remaining_in_packet= 0;
1555 };);
1535 if (bytes_remaining_in_packet < 2)1556 if (bytes_remaining_in_packet < 2)
1536 goto error;1557 goto error;
1537 1558
@@ -1590,6 +1611,10 @@
15901611
1591skip_to_ssl:1612skip_to_ssl:
15921613
1614 DBUG_EXECUTE_IF("host_error_charset",
1615 {
1616 goto error;
1617 };);
1593 DBUG_PRINT("info", ("client_character_set: %u", charset_code));1618 DBUG_PRINT("info", ("client_character_set: %u", charset_code));
1594 if (thd_init_client_charset(thd, charset_code))1619 if (thd_init_client_charset(thd, charset_code))
1595 goto error;1620 goto error;
@@ -1658,6 +1683,10 @@
1658 bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40;1683 bytes_remaining_in_packet -= AUTH_PACKET_HEADER_SIZE_PROTO_40;
1659 }1684 }
1660 1685
1686 DBUG_EXECUTE_IF("host_error_SSL_layering",
1687 {
1688 packet_has_required_size= 0;
1689 };);
1661 if (!packet_has_required_size)1690 if (!packet_has_required_size)
1662 goto error;1691 goto error;
1663 }1692 }
@@ -1683,6 +1712,11 @@
1683 get_string= get_40_protocol_string;1712 get_string= get_40_protocol_string;
16841713
1685 user= get_string(&end, &bytes_remaining_in_packet, &user_len);1714 user= get_string(&end, &bytes_remaining_in_packet, &user_len);
1715 DBUG_EXECUTE_IF("host_error_user",
1716 {
1717 user= NULL;
1718 };);
1719
1686 if (user == NULL)1720 if (user == NULL)
1687 goto error;1721 goto error;
16881722
@@ -1710,6 +1744,11 @@
1710 passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len);1744 passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len);
1711 }1745 }
17121746
1747 DBUG_EXECUTE_IF("host_error_password",
1748 {
1749 passwd= NULL;
1750 };);
1751
1713 if (passwd == NULL)1752 if (passwd == NULL)
1714 goto error;1753 goto error;
17151754
@@ -1770,7 +1809,20 @@
17701809
1771 if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME))))1810 if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME))))
1772 return 1; /* The error is set by my_strdup(). */1811 return 1; /* The error is set by my_strdup(). */
1773 return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE);1812
1813 if (!check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE))
1814 {
1815 /*
1816 Call to reset_host_errors() should be made only when all sanity checks
1817 are done and connection is going to be a successful.
1818 */
1819 reset_host_errors(&thd->remote.sin_addr);
1820 return 0;
1821 }
1822 else
1823 {
1824 return 1;
1825 }
1774 1826
1775error:1827error:
1776 inc_host_errors(&thd->remote.sin_addr);1828 inc_host_errors(&thd->remote.sin_addr);
17771829
=== modified file 'Percona-Server/sql/sql_lex.cc'
--- Percona-Server/sql/sql_lex.cc 2012-08-20 03:14:02 +0000
+++ Percona-Server/sql/sql_lex.cc 2013-01-10 04:35:33 +0000
@@ -1621,6 +1621,7 @@
1621 ref_pointer_array= 0;1621 ref_pointer_array= 0;
1622 select_n_where_fields= 0;1622 select_n_where_fields= 0;
1623 select_n_having_items= 0;1623 select_n_having_items= 0;
1624 n_child_sum_items= 0;
1624 subquery_in_having= explicit_limit= 0;1625 subquery_in_having= explicit_limit= 0;
1625 is_item_list_lookup= 0;1626 is_item_list_lookup= 0;
1626 first_execution= 1;1627 first_execution= 1;
16271628
=== modified file 'Percona-Server/sql/sql_list.h'
--- Percona-Server/sql/sql_list.h 2011-06-30 15:37:13 +0000
+++ Percona-Server/sql/sql_list.h 2013-01-10 04:35:33 +0000
@@ -1,7 +1,6 @@
1#ifndef INCLUDES_MYSQL_SQL_LIST_H1#ifndef INCLUDES_MYSQL_SQL_LIST_H
2#define INCLUDES_MYSQL_SQL_LIST_H2#define INCLUDES_MYSQL_SQL_LIST_H
3/*3/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
4 Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
54
6 This program is free software; you can redistribute it and/or modify5 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by6 it under the terms of the GNU General Public License as published by
@@ -165,6 +164,14 @@
165public:164public:
166 uint elements;165 uint elements;
167166
167 bool operator==(const base_list &rhs) const
168 {
169 return
170 elements == rhs.elements &&
171 first == rhs.first &&
172 last == rhs.last;
173 }
174
168 inline void empty() { elements=0; first= &end_of_list; last=&first;}175 inline void empty() { elements=0; first= &end_of_list; last=&first;}
169 inline base_list() { empty(); }176 inline base_list() { empty(); }
170 /**177 /**
171178
=== modified file 'Percona-Server/sql/sql_profile.cc'
--- Percona-Server/sql/sql_profile.cc 2012-08-20 03:14:02 +0000
+++ Percona-Server/sql/sql_profile.cc 2013-01-10 04:35:33 +0000
@@ -39,6 +39,7 @@
39#define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3)39#define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3)
4040
41#define MAX_QUERY_LENGTH 30041#define MAX_QUERY_LENGTH 300
42#define MAX_QUERY_HISTORY 101
4243
43/* Reserved for systems that can't record the function name in source. */44/* Reserved for systems that can't record the function name in source. */
44const char * const _unknown_func_ = "<unknown>";45const char * const _unknown_func_ = "<unknown>";
@@ -247,9 +248,12 @@
247QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg)248QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg)
248 :profiling(profiling_arg), profiling_query_id(0), query_source(NULL)249 :profiling(profiling_arg), profiling_query_id(0), query_source(NULL)
249{250{
250 profile_start= new PROF_MEASUREMENT(this, status_arg);251 m_seq_counter= 1;
251 entries.push_back(profile_start);252 PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg);
252 profile_end= profile_start;253 prof->m_seq= m_seq_counter++;
254 m_start_time_usecs= prof->time_usecs;
255 m_end_time_usecs= m_start_time_usecs;
256 entries.push_back(prof);
253}257}
254258
255QUERY_PROFILE::~QUERY_PROFILE()259QUERY_PROFILE::~QUERY_PROFILE()
@@ -289,9 +293,14 @@
289 else293 else
290 prof= new PROF_MEASUREMENT(this, status_arg);294 prof= new PROF_MEASUREMENT(this, status_arg);
291295
292 profile_end= prof;296 prof->m_seq= m_seq_counter++;
297 m_end_time_usecs= prof->time_usecs;
293 entries.push_back(prof);298 entries.push_back(prof);
294299
300 /* Maintain the query history size. */
301 while (entries.elements > MAX_QUERY_HISTORY)
302 delete entries.pop();
303
295 DBUG_VOID_RETURN;304 DBUG_VOID_RETURN;
296}305}
297306
@@ -452,8 +461,7 @@
452461
453 String elapsed;462 String elapsed;
454463
455 PROF_MEASUREMENT *ps= prof->profile_start;464 double query_time_usecs= prof->m_end_time_usecs - prof->m_start_time_usecs;
456 PROF_MEASUREMENT *pe= prof->profile_end;
457465
458 if (++idx <= unit->offset_limit_cnt)466 if (++idx <= unit->offset_limit_cnt)
459 continue;467 continue;
@@ -462,7 +470,7 @@
462470
463 protocol->prepare_for_resend();471 protocol->prepare_for_resend();
464 protocol->store((uint32)(prof->profiling_query_id));472 protocol->store((uint32)(prof->profiling_query_id));
465 protocol->store((double)(pe->time_usecs - ps->time_usecs)/(1000.0*1000),473 protocol->store((double)(query_time_usecs/(1000.0*1000)),
466 (uint32) TIME_FLOAT_DIGITS-1, &elapsed);474 (uint32) TIME_FLOAT_DIGITS-1, &elapsed);
467 if (prof->query_source != NULL)475 if (prof->query_source != NULL)
468 protocol->store(prof->query_source, strlen(prof->query_source),476 protocol->store(prof->query_source, strlen(prof->query_source),
@@ -634,17 +642,18 @@
634 us also include a numbering of each state per query. The query_id and642 us also include a numbering of each state per query. The query_id and
635 the "seq" together are unique.643 the "seq" together are unique.
636 */644 */
637 ulonglong seq;645 ulong seq;
638646
639 void *entry_iterator;647 void *entry_iterator;
640 PROF_MEASUREMENT *entry, *previous= NULL;648 PROF_MEASUREMENT *entry, *previous= NULL;
641 /* ...and for each query, go through all its state-change steps. */649 /* ...and for each query, go through all its state-change steps. */
642 for (seq= 0, entry_iterator= query->entries.new_iterator();650 for (entry_iterator= query->entries.new_iterator();
643 entry_iterator != NULL;651 entry_iterator != NULL;
644 entry_iterator= query->entries.iterator_next(entry_iterator),652 entry_iterator= query->entries.iterator_next(entry_iterator),
645 seq++, previous=entry, row_number++)653 previous=entry, row_number++)
646 {654 {
647 entry= query->entries.iterator_value(entry_iterator);655 entry= query->entries.iterator_value(entry_iterator);
656 seq= entry->m_seq;
648657
649 /* Skip the first. We count spans of fence, not fence-posts. */658 /* Skip the first. We count spans of fence, not fence-posts. */
650 if (previous == NULL) continue;659 if (previous == NULL) continue;
651660
=== modified file 'Percona-Server/sql/sql_profile.h'
--- Percona-Server/sql/sql_profile.h 2011-11-24 01:59:44 +0000
+++ Percona-Server/sql/sql_profile.h 2013-01-10 04:35:33 +0000
@@ -186,6 +186,7 @@
186 char *file;186 char *file;
187 unsigned int line;187 unsigned int line;
188188
189 ulong m_seq;
189 double time_usecs;190 double time_usecs;
190 double cpu_time_usecs;191 double cpu_time_usecs;
191 PROF_MEASUREMENT();192 PROF_MEASUREMENT();
@@ -212,8 +213,9 @@
212 query_id_t profiling_query_id; /* Session-specific id. */213 query_id_t profiling_query_id; /* Session-specific id. */
213 char *query_source;214 char *query_source;
214215
215 PROF_MEASUREMENT *profile_start;216 double m_start_time_usecs;
216 PROF_MEASUREMENT *profile_end;217 double m_end_time_usecs;
218 ulong m_seq_counter;
217 Queue<PROF_MEASUREMENT> entries;219 Queue<PROF_MEASUREMENT> entries;
218220
219221
220222
=== modified file 'Percona-Server/sql/sql_select.cc'
--- Percona-Server/sql/sql_select.cc 2013-01-10 04:35:31 +0000
+++ Percona-Server/sql/sql_select.cc 2013-01-10 04:35:33 +0000
@@ -1,4 +1,4 @@
1/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.1/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
22
3 This program is free software; you can redistribute it and/or modify3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by4 it under the terms of the GNU General Public License as published by
@@ -1699,6 +1699,8 @@
1699*/1699*/
1700void JOIN::restore_tmp()1700void JOIN::restore_tmp()
1701{1701{
1702 DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
1703 DBUG_ASSERT(tmp_join != this);
1702 memcpy(tmp_join, this, (size_t) sizeof(JOIN));1704 memcpy(tmp_join, this, (size_t) sizeof(JOIN));
1703}1705}
17041706
@@ -7116,21 +7118,19 @@
7116 }7118 }
7117 }7119 }
7118 }7120 }
7119 /*
7120 We are not using tables anymore
7121 Unlock all tables. We may be in an INSERT .... SELECT statement.
7122 */
7123 if (full)7121 if (full)
7124 {7122 {
7125 if (tmp_join)7123 /*
7126 tmp_table_param.copy_field= 0;7124 Ensure that the following delete_elements() would not be called
7125 twice for the same list.
7126 */
7127 if (tmp_join && tmp_join != this &&
7128 tmp_join->group_fields == this->group_fields)
7129 tmp_join->group_fields.empty();
7130
7131 // Run Cached_item DTORs!
7127 group_fields.delete_elements();7132 group_fields.delete_elements();
7128 /* 7133
7129 Ensure that the above delete_elements() would not be called
7130 twice for the same list.
7131 */
7132 if (tmp_join && tmp_join != this)
7133 tmp_join->group_fields= group_fields;
7134 /*7134 /*
7135 We can't call delete_elements() on copy_funcs as this will cause7135 We can't call delete_elements() on copy_funcs as this will cause
7136 problems in free_elements() as some of the elements are then deleted.7136 problems in free_elements() as some of the elements are then deleted.
71377137
=== modified file 'Percona-Server/storage/innobase/btr/btr0cur.c'
--- Percona-Server/storage/innobase/btr/btr0cur.c 2012-08-20 00:29:22 +0000
+++ Percona-Server/storage/innobase/btr/btr0cur.c 2013-01-10 04:35:33 +0000
@@ -2377,21 +2377,22 @@
2377}2377}
23782378
2379/***************************************************************2379/***************************************************************
2380Sets a secondary index record delete mark to FALSE. This function is only2380Sets a secondary index record delete mark. This function is only
2381used by the insert buffer insert merge mechanism. */2381used by the insert buffer insert merge mechanism. */
23822382
2383void2383void
2384btr_cur_del_unmark_for_ibuf(2384btr_cur_set_deleted_flag_for_ibuf(
2385/*========================*/2385/*==============================*/
2386 rec_t* rec, /* in: record to delete unmark */2386 rec_t* rec, /* in: record to delete unmark */
2387 ibool val, /* in: value to set */
2387 mtr_t* mtr) /* in: mtr */2388 mtr_t* mtr) /* in: mtr */
2388{2389{
2389 /* We do not need to reserve btr_search_latch, as the page has just2390 /* We do not need to reserve btr_search_latch, as the page has just
2390 been read to the buffer pool and there cannot be a hash index to it. */2391 been read to the buffer pool and there cannot be a hash index to it. */
23912392
2392 rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), FALSE);2393 rec_set_deleted_flag(rec, page_is_comp(buf_frame_align(rec)), val);
23932394
2394 btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr);2395 btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
2395}2396}
23962397
2397/*==================== B-TREE RECORD REMOVE =========================*/2398/*==================== B-TREE RECORD REMOVE =========================*/
23982399
=== modified file 'Percona-Server/storage/innobase/dict/dict0dict.c'
--- Percona-Server/storage/innobase/dict/dict0dict.c 2012-03-01 05:35:51 +0000
+++ Percona-Server/storage/innobase/dict/dict0dict.c 2013-01-10 04:35:33 +0000
@@ -1629,7 +1629,6 @@
1629{1629{
1630 dict_index_t* new_index;1630 dict_index_t* new_index;
1631 dict_field_t* field;1631 dict_field_t* field;
1632 ulint fixed_size;
1633 ulint trx_id_pos;1632 ulint trx_id_pos;
1634 ulint i;1633 ulint i;
1635 ibool* indexed;1634 ibool* indexed;
@@ -1706,7 +1705,7 @@
17061705
1707 for (i = 0; i < trx_id_pos; i++) {1706 for (i = 0; i < trx_id_pos; i++) {
17081707
1709 fixed_size = dict_col_get_fixed_size(1708 ulint fixed_size = dict_col_get_fixed_size(
1710 dict_index_get_nth_col(new_index, i));1709 dict_index_get_nth_col(new_index, i));
17111710
1712 if (fixed_size == 0) {1711 if (fixed_size == 0) {
@@ -1722,7 +1721,20 @@
1722 break;1721 break;
1723 }1722 }
17241723
1725 new_index->trx_id_offset += (unsigned int) fixed_size;1724 /* Add fixed_size to new_index->trx_id_offset.
1725 Because the latter is a bit-field, an overflow
1726 can theoretically occur. Check for it. */
1727 fixed_size += new_index->trx_id_offset;
1728
1729 new_index->trx_id_offset = fixed_size;
1730
1731 if (new_index->trx_id_offset != fixed_size) {
1732 /* Overflow. Pretend that this is a
1733 variable-length PRIMARY KEY. */
1734 ut_ad(0);
1735 new_index->trx_id_offset = 0;
1736 break;
1737 }
1726 }1738 }
17271739
1728 }1740 }
17291741
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-01-10 04:35:33 +0000
@@ -9274,8 +9274,8 @@
9274#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG9274#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
9275static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,9275static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
9276 PLUGIN_VAR_RQCMDARG,9276 PLUGIN_VAR_RQCMDARG,
9277 "Debug flags for InnoDB change buffering (0=none)",9277 "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)",
9278 NULL, NULL, 0, 0, 1, 0);9278 NULL, NULL, 0, 0, 2, 0);
9279#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */9279#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
92809280
9281#ifdef UNIV_DEBUG9281#ifdef UNIV_DEBUG
92829282
=== modified file 'Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c'
--- Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c 2012-01-16 12:22:03 +0000
+++ Percona-Server/storage/innobase/ibuf/ibuf0ibuf.c 2013-01-10 04:35:33 +0000
@@ -2978,7 +2978,7 @@
2978 /* The records only differ in the delete-mark.2978 /* The records only differ in the delete-mark.
2979 Clear the delete-mark, like we did before2979 Clear the delete-mark, like we did before
2980 Bug #56680 was fixed. */2980 Bug #56680 was fixed. */
2981 btr_cur_del_unmark_for_ibuf(rec, mtr);2981 btr_cur_set_deleted_flag_for_ibuf(rec, FALSE, mtr);
2982updated_in_place:2982updated_in_place:
2983 mem_heap_free(heap);2983 mem_heap_free(heap);
2984 return;2984 return;
@@ -3058,6 +3058,22 @@
30583058
3059 ut_ad(ibuf_inside());3059 ut_ad(ibuf_inside());
30603060
3061#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
3062 if (ibuf_debug == 2) {
3063 /* Inject a fault (crash). We do this before trying
3064 optimistic delete, because a pessimistic delete in the
3065 change buffer would require a larger test case. */
3066
3067 /* Flag the buffered record as processed, to avoid
3068 an assertion failure after crash recovery. */
3069 btr_cur_set_deleted_flag_for_ibuf(
3070 btr_pcur_get_rec(pcur), TRUE, mtr);
3071 mtr_commit(mtr);
3072 log_make_checkpoint_at(ut_dulint_max, TRUE);
3073 DBUG_SUICIDE();
3074 }
3075#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
3076
3061 success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);3077 success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
30623078
3063 if (success) {3079 if (success) {
@@ -3072,7 +3088,13 @@
3072 return(FALSE);3088 return(FALSE);
3073 }3089 }
30743090
3075 /* We have to resort to a pessimistic delete from ibuf */3091 /* We have to resort to a pessimistic delete from ibuf.
3092 Delete-mark the record so that it will not be applied again,
3093 in case the server crashes before the pessimistic delete is
3094 made persistent. */
3095 btr_cur_set_deleted_flag_for_ibuf(
3096 btr_pcur_get_rec(pcur), TRUE, mtr);
3097
3076 btr_pcur_store_position(pcur, mtr);3098 btr_pcur_store_position(pcur, mtr);
30773099
3078 btr_pcur_commit_specify_mtr(pcur, mtr);3100 btr_pcur_commit_specify_mtr(pcur, mtr);
@@ -3343,7 +3365,7 @@
3343 fputs("InnoDB: Discarding record\n ", stderr);3365 fputs("InnoDB: Discarding record\n ", stderr);
3344 rec_print_old(stderr, ibuf_rec);3366 rec_print_old(stderr, ibuf_rec);
3345 fputs("\n from the insert buffer!\n\n", stderr);3367 fputs("\n from the insert buffer!\n\n", stderr);
3346 } else if (page) {3368 } else if (page && !rec_get_deleted_flag(ibuf_rec, 0)) {
3347 /* Now we have at pcur a record which should be3369 /* Now we have at pcur a record which should be
3348 inserted to the index page; NOTE that the call below3370 inserted to the index page; NOTE that the call below
3349 copies pointers to fields in ibuf_rec, and we must3371 copies pointers to fields in ibuf_rec, and we must
33503372
=== modified file 'Percona-Server/storage/innobase/include/btr0cur.h'
--- Percona-Server/storage/innobase/include/btr0cur.h 2011-10-26 09:23:57 +0000
+++ Percona-Server/storage/innobase/include/btr0cur.h 2013-01-10 04:35:33 +0000
@@ -277,13 +277,14 @@
277 que_thr_t* thr, /* in: query thread */277 que_thr_t* thr, /* in: query thread */
278 mtr_t* mtr); /* in: mtr */278 mtr_t* mtr); /* in: mtr */
279/***************************************************************279/***************************************************************
280Sets a secondary index record delete mark to FALSE. This function is280Sets a secondary index record delete mark. This function is only
281only used by the insert buffer insert merge mechanism. */281used by the insert buffer insert merge mechanism. */
282282
283void283void
284btr_cur_del_unmark_for_ibuf(284btr_cur_set_deleted_flag_for_ibuf(
285/*========================*/285/*==============================*/
286 rec_t* rec, /* in: record to delete unmark */286 rec_t* rec, /* in: record to delete unmark */
287 ibool val, /* in: value to set */
287 mtr_t* mtr); /* in: mtr */288 mtr_t* mtr); /* in: mtr */
288/*****************************************************************289/*****************************************************************
289Tries to compress a page of the tree on the leaf level. It is assumed290Tries to compress a page of the tree on the leaf level. It is assumed
290291
=== modified file 'Percona-Server/storage/innobase/include/dict0mem.h'
--- Percona-Server/storage/innobase/include/dict0mem.h 2011-01-14 17:02:28 +0000
+++ Percona-Server/storage/innobase/include/dict0mem.h 2013-01-10 04:35:33 +0000
@@ -196,10 +196,15 @@
196 unsigned space:32;196 unsigned space:32;
197 /* space where the index tree is placed */197 /* space where the index tree is placed */
198 unsigned page:32;/* index tree root page number */198 unsigned page:32;/* index tree root page number */
199 unsigned trx_id_offset:10;/* position of the the trx id column199#define MAX_KEY_LENGTH_BITS 12
200 unsigned trx_id_offset:MAX_KEY_LENGTH_BITS;
201 /* position of the trx id column
200 in a clustered index record, if the fields202 in a clustered index record, if the fields
201 before it are known to be of a fixed size,203 before it are known to be of a fixed size,
202 0 otherwise */204 0 otherwise */
205#if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
206# error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
207#endif
203 unsigned n_user_defined_cols:10;208 unsigned n_user_defined_cols:10;
204 /* number of columns the user defined to209 /* number of columns the user defined to
205 be in the index: in the internal210 be in the index: in the internal
206211
=== modified file 'Percona-Server/storage/innobase/include/row0undo.h'
--- Percona-Server/storage/innobase/include/row0undo.h 2006-08-28 17:42:45 +0000
+++ Percona-Server/storage/innobase/include/row0undo.h 2013-01-10 04:35:33 +0000
@@ -78,8 +78,6 @@
78 dulint undo_no;/* undo number of the record */78 dulint undo_no;/* undo number of the record */
79 ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC,79 ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC,
80 ... */80 ... */
81 dulint new_roll_ptr; /* roll ptr to restore to clustered index
82 record */
83 dulint new_trx_id; /* trx id to restore to clustered index81 dulint new_trx_id; /* trx id to restore to clustered index
84 record */82 record */
85 btr_pcur_t pcur; /* persistent cursor used in searching the83 btr_pcur_t pcur; /* persistent cursor used in searching the
@@ -101,11 +99,8 @@
101/* Execution states for an undo node */99/* Execution states for an undo node */
102#define UNDO_NODE_FETCH_NEXT 1 /* we should fetch the next undo log100#define UNDO_NODE_FETCH_NEXT 1 /* we should fetch the next undo log
103 record */101 record */
104#define UNDO_NODE_PREV_VERS 2 /* the roll ptr to previous version of102#define UNDO_NODE_INSERT 2
105 a row is stored in node, and undo103#define UNDO_NODE_MODIFY 3
106 should be done based on it */
107#define UNDO_NODE_INSERT 3
108#define UNDO_NODE_MODIFY 4
109104
110105
111#ifndef UNIV_NONINL106#ifndef UNIV_NONINL
112107
=== modified file 'Percona-Server/storage/innobase/os/os0file.c'
--- Percona-Server/storage/innobase/os/os0file.c 2010-10-28 04:18:59 +0000
+++ Percona-Server/storage/innobase/os/os0file.c 2013-01-10 04:35:33 +0000
@@ -1215,6 +1215,14 @@
1215 DWORD create_flag;1215 DWORD create_flag;
1216 DWORD attributes;1216 DWORD attributes;
1217 ibool retry;1217 ibool retry;
1218
1219 DBUG_EXECUTE_IF(
1220 "ib_create_table_fail_disk_full",
1221 *success = FALSE;
1222 SetLastError(ERROR_DISK_FULL);
1223 return((os_file_t) -1);
1224 );
1225
1218try_again:1226try_again:
1219 ut_a(name);1227 ut_a(name);
12201228
@@ -1318,6 +1326,13 @@
1318 ibool retry;1326 ibool retry;
1319 const char* mode_str = NULL;1327 const char* mode_str = NULL;
13201328
1329 DBUG_EXECUTE_IF(
1330 "ib_create_table_fail_disk_full",
1331 *success = FALSE;
1332 errno = ENOSPC;
1333 return((os_file_t) -1);
1334 );
1335
1321try_again:1336try_again:
1322 ut_a(name);1337 ut_a(name);
13231338
13241339
=== modified file 'Percona-Server/storage/innobase/row/row0sel.c'
--- Percona-Server/storage/innobase/row/row0sel.c 2011-12-22 10:55:44 +0000
+++ Percona-Server/storage/innobase/row/row0sel.c 2013-01-10 04:35:33 +0000
@@ -3758,9 +3758,13 @@
3758 }3758 }
37593759
3760rec_loop:3760rec_loop:
3761 if (trx_is_interrupted(trx)) {
3762 err = DB_INTERRUPTED;
3763 goto normal_return;
3764 }
3765
3761 /*-------------------------------------------------------------*/3766 /*-------------------------------------------------------------*/
3762 /* PHASE 4: Look for matching records in a loop */3767 /* PHASE 4: Look for matching records in a loop */
3763
3764 rec = btr_pcur_get_rec(pcur);3768 rec = btr_pcur_get_rec(pcur);
3765 ut_ad(!!page_rec_is_comp(rec) == comp);3769 ut_ad(!!page_rec_is_comp(rec) == comp);
3766#ifdef UNIV_SEARCH_DEBUG3770#ifdef UNIV_SEARCH_DEBUG
@@ -4656,14 +4660,18 @@
4656 /* TODO: We have to cast away the const of rec for now. This needs4660 /* TODO: We have to cast away the const of rec for now. This needs
4657 to be fixed later.*/4661 to be fixed later.*/
4658 offsets = rec_get_offsets(4662 offsets = rec_get_offsets(
4659 (rec_t*) rec, index, offsets, ULINT_UNDEFINED, &heap);4663 (rec_t*) rec, index, offsets, col_no + 1, &heap);
4664
4665 if (rec_offs_nth_sql_null(offsets, col_no)) {
4666 /* There is no non-NULL value in the auto-increment column. */
4667 value = 0;
4668 goto func_exit;
4669 }
46604670
4661 /* TODO: We have to cast away the const of rec for now. This needs4671 /* TODO: We have to cast away the const of rec for now. This needs
4662 to be fixed later.*/4672 to be fixed later.*/
4663 data = rec_get_nth_field((rec_t*)rec, offsets, col_no, &len);4673 data = rec_get_nth_field((rec_t*)rec, offsets, col_no, &len);
46644674
4665 ut_a(len != UNIV_SQL_NULL);
4666
4667 switch (mtype) {4675 switch (mtype) {
4668 case DATA_INT:4676 case DATA_INT:
4669 ut_a(len <= sizeof value);4677 ut_a(len <= sizeof value);
@@ -4684,15 +4692,16 @@
4684 ut_error;4692 ut_error;
4685 }4693 }
46864694
4687 if (UNIV_LIKELY_NULL(heap)) {
4688 mem_heap_free(heap);
4689 }
4690
4691 /* We assume that the autoinc counter can't be negative. */4695 /* We assume that the autoinc counter can't be negative. */
4692 if (!unsigned_type && (ib_longlong) value < 0) {4696 if (!unsigned_type && (ib_longlong) value < 0) {
4693 value = 0;4697 value = 0;
4694 }4698 }
46954699
4700func_exit:
4701 if (UNIV_LIKELY_NULL(heap)) {
4702 mem_heap_free(heap);
4703 }
4704
4696 return(value);4705 return(value);
4697}4706}
46984707
46994708
=== modified file 'Percona-Server/storage/innobase/row/row0umod.c'
--- Percona-Server/storage/innobase/row/row0umod.c 2011-10-26 09:23:57 +0000
+++ Percona-Server/storage/innobase/row/row0umod.c 2013-01-10 04:35:33 +0000
@@ -42,37 +42,6 @@
42version has become obsolete at the time the undo is started. */42version has become obsolete at the time the undo is started. */
4343
44/***************************************************************44/***************************************************************
45Checks if also the previous version of the clustered index record was
46modified or inserted by the same transaction, and its undo number is such
47that it should be undone in the same rollback. */
48UNIV_INLINE
49ibool
50row_undo_mod_undo_also_prev_vers(
51/*=============================*/
52 /* out: TRUE if also previous modify or
53 insert of this row should be undone */
54 undo_node_t* node, /* in: row undo node */
55 dulint* undo_no)/* out: the undo number */
56{
57 trx_undo_rec_t* undo_rec;
58 trx_t* trx;
59
60 trx = node->trx;
61
62 if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) {
63
64 *undo_no = ut_dulint_zero;
65 return(FALSE);
66 }
67
68 undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap);
69
70 *undo_no = trx_undo_rec_get_undo_no(undo_rec);
71
72 return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0);
73}
74
75/***************************************************************
76Undoes a modify in a clustered index record. */45Undoes a modify in a clustered index record. */
77static46static
78ulint47ulint
@@ -202,17 +171,9 @@
202 btr_pcur_t* pcur;171 btr_pcur_t* pcur;
203 mtr_t mtr;172 mtr_t mtr;
204 ulint err;173 ulint err;
205 ibool success;
206 ibool more_vers;
207 dulint new_undo_no;
208174
209 ut_ad(node && thr);175 ut_ad(node && thr);
210176
211 /* Check if also the previous version of the clustered index record
212 should be undone in this same rollback operation */
213
214 more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no);
215
216 pcur = &(node->pcur);177 pcur = &(node->pcur);
217178
218 mtr_start(&mtr);179 mtr_start(&mtr);
@@ -260,20 +221,6 @@
260221
261 trx_undo_rec_release(node->trx, node->undo_no);222 trx_undo_rec_release(node->trx, node->undo_no);
262223
263 if (more_vers && err == DB_SUCCESS) {
264
265 /* Reserve the undo log record to the prior version after
266 committing &mtr: this is necessary to comply with the latching
267 order, as &mtr may contain the fsp latch which is lower in
268 the latch hierarchy than trx->undo_mutex. */
269
270 success = trx_undo_rec_reserve(node->trx, new_undo_no);
271
272 if (success) {
273 node->state = UNDO_NODE_PREV_VERS;
274 }
275 }
276
277 return(err);224 return(err);
278}225}
279226
@@ -702,7 +649,6 @@
702 trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,649 trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
703 roll_ptr, info_bits, trx,650 roll_ptr, info_bits, trx,
704 node->heap, &(node->update));651 node->heap, &(node->update));
705 node->new_roll_ptr = roll_ptr;
706 node->new_trx_id = trx_id;652 node->new_trx_id = trx_id;
707 node->cmpl_info = cmpl_info;653 node->cmpl_info = cmpl_info;
708}654}
709655
=== modified file 'Percona-Server/storage/innobase/row/row0undo.c'
--- Percona-Server/storage/innobase/row/row0undo.c 2010-06-25 08:18:41 +0000
+++ Percona-Server/storage/innobase/row/row0undo.c 2013-01-10 04:35:33 +0000
@@ -242,25 +242,6 @@
242 } else {242 } else {
243 node->state = UNDO_NODE_MODIFY;243 node->state = UNDO_NODE_MODIFY;
244 }244 }
245
246 } else if (node->state == UNDO_NODE_PREV_VERS) {
247
248 /* Undo should be done to the same clustered index record
249 again in this same rollback, restoring the previous version */
250
251 roll_ptr = node->new_roll_ptr;
252
253 node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr,
254 node->heap);
255 node->roll_ptr = roll_ptr;
256 node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec);
257
258 if (trx_undo_roll_ptr_is_insert(roll_ptr)) {
259
260 node->state = UNDO_NODE_INSERT;
261 } else {
262 node->state = UNDO_NODE_MODIFY;
263 }
264 }245 }
265246
266 /* Prevent DROP TABLE etc. while we are rolling back this row.247 /* Prevent DROP TABLE etc. while we are rolling back this row.
267248
=== modified file 'Percona-Server/storage/innodb_plugin/ChangeLog'
--- Percona-Server/storage/innodb_plugin/ChangeLog 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/ChangeLog 2013-01-10 04:35:33 +0000
@@ -1,3 +1,40 @@
12012-10-18 The InnoDB Team
2
3 * row/row0sel.c:
4 Fix Bug#14758405: ALTER TABLE: ADDING SERIAL NULL DATATYPE: ASSERTION:
5 LEN <= SIZEOF(ULONGLONG)
6
72012-10-16 The InnoDB Team
8
9 * dict/dict0dict.c, handler/handler0alter.cc, include/dict0dict.h:
10 Fix Bug#14729221 IN-PLACE ALTER TABLE REPORTS '' INSTEAD OF REAL
11 DUPLICATE VALUE FOR PREFIX KEYS
12
132012-10-09 The InnoDB Team
14
15 * row/row0mysql.c:
16 Fix Bug#14708715 CREATE TABLE MEMORY LEAK ON DB_OUT_OF_FILE_SPACE
17
182012-09-28 The InnoDB Team
19
20 * include/row0undo.h, row/row0umod.c, row/row0undo.c:
21 Fix Bug#13249921 ASSERT !BPAGE->FILE_PAGE_WAS_FREED, USUALLY
22 IN TRANSACTION ROLLBACK. This patch will ensure that the
23 undo logs will be applied in proper reverse order.
24
252012-09-18 The InnoDB Team
26
27 * btr/btr0cur.c, handler/ha_innodb.cc, ibuf/ibuf0ibuf.c,
28 include/btr0cur.h:
29 Fix Bug#14636528 INNODB CHANGE BUFFERING IS NOT ENTIRELY CRASH-SAFE
30
312012-09-17 The InnoDB Team
32
33 * btr/btr0btr.c, btr/btr0cur.c, buf/buf0lru.c,
34 include/page0zip.h, log/log0recv.c, page/page0cur.c,
35 page/page0page.c, page/page0zip.c:
36 Fix Bug#12701488 ASSERT PAGE_ZIP_VALIDATE, UNIV_ZIP_DEBUG
37
12012-08-29 The InnoDB Team382012-08-29 The InnoDB Team
239
3 * btr/btr0btr.c, page/page0cur.c, page/page0page.c:40 * btr/btr0btr.c, page/page0cur.c, page/page0page.c:
441
=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0btr.c'
--- Percona-Server/storage/innodb_plugin/btr/btr0btr.c 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/btr/btr0btr.c 2013-01-10 04:35:33 +0000
@@ -1620,7 +1620,7 @@
1620 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));1620 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
1621 ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));1621 ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
1622#ifdef UNIV_ZIP_DEBUG1622#ifdef UNIV_ZIP_DEBUG
1623 ut_a(!page_zip || page_zip_validate(page_zip, page));1623 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
1624#endif /* UNIV_ZIP_DEBUG */1624#endif /* UNIV_ZIP_DEBUG */
1625 data_size1 = page_get_data_size(page);1625 data_size1 = page_get_data_size(page);
1626 max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);1626 max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
@@ -1738,7 +1738,7 @@
17381738
1739func_exit:1739func_exit:
1740#ifdef UNIV_ZIP_DEBUG1740#ifdef UNIV_ZIP_DEBUG
1741 ut_a(!page_zip || page_zip_validate(page_zip, page));1741 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
1742#endif /* UNIV_ZIP_DEBUG */1742#endif /* UNIV_ZIP_DEBUG */
1743#ifndef UNIV_HOTBACKUP1743#ifndef UNIV_HOTBACKUP
1744 buf_block_free(temp_block);1744 buf_block_free(temp_block);
@@ -1813,7 +1813,7 @@
1813 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));1813 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
1814 ut_ad(page_zip == buf_block_get_page_zip(block));1814 ut_ad(page_zip == buf_block_get_page_zip(block));
1815#ifdef UNIV_ZIP_DEBUG1815#ifdef UNIV_ZIP_DEBUG
1816 ut_a(!page_zip || page_zip_validate(page_zip, page));1816 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
1817#endif /* UNIV_ZIP_DEBUG */1817#endif /* UNIV_ZIP_DEBUG */
18181818
1819 btr_search_drop_page_hash_index(block);1819 btr_search_drop_page_hash_index(block);
@@ -1870,10 +1870,10 @@
1870 root_block = btr_cur_get_block(cursor);1870 root_block = btr_cur_get_block(cursor);
1871 root_page_zip = buf_block_get_page_zip(root_block);1871 root_page_zip = buf_block_get_page_zip(root_block);
1872 ut_ad(page_get_n_recs(root) > 0);1872 ut_ad(page_get_n_recs(root) > 0);
1873 index = btr_cur_get_index(cursor);
1873#ifdef UNIV_ZIP_DEBUG1874#ifdef UNIV_ZIP_DEBUG
1874 ut_a(!root_page_zip || page_zip_validate(root_page_zip, root));1875 ut_a(!root_page_zip || page_zip_validate(root_page_zip, root, index));
1875#endif /* UNIV_ZIP_DEBUG */1876#endif /* UNIV_ZIP_DEBUG */
1876 index = btr_cur_get_index(cursor);
1877#ifdef UNIV_BTR_DEBUG1877#ifdef UNIV_BTR_DEBUG
1878 if (!dict_index_is_ibuf(index)) {1878 if (!dict_index_is_ibuf(index)) {
1879 ulint space = dict_index_get_space(index);1879 ulint space = dict_index_get_space(index);
@@ -2803,8 +2803,8 @@
28032803
2804#ifdef UNIV_ZIP_DEBUG2804#ifdef UNIV_ZIP_DEBUG
2805 if (UNIV_LIKELY_NULL(page_zip)) {2805 if (UNIV_LIKELY_NULL(page_zip)) {
2806 ut_a(page_zip_validate(page_zip, page));2806 ut_a(page_zip_validate(page_zip, page, cursor->index));
2807 ut_a(page_zip_validate(new_page_zip, new_page));2807 ut_a(page_zip_validate(new_page_zip, new_page, cursor->index));
2808 }2808 }
2809#endif /* UNIV_ZIP_DEBUG */2809#endif /* UNIV_ZIP_DEBUG */
28102810
@@ -2838,7 +2838,8 @@
2838 = buf_block_get_page_zip(insert_block);2838 = buf_block_get_page_zip(insert_block);
28392839
2840 ut_a(!insert_page_zip2840 ut_a(!insert_page_zip
2841 || page_zip_validate(insert_page_zip, insert_page));2841 || page_zip_validate(insert_page_zip, insert_page,
2842 cursor->index));
2842 }2843 }
2843#endif /* UNIV_ZIP_DEBUG */2844#endif /* UNIV_ZIP_DEBUG */
28442845
@@ -3203,7 +3204,7 @@
32033204
3204 btr_page_set_level(page, page_zip, page_level, mtr);3205 btr_page_set_level(page, page_zip, page_level, mtr);
3205#ifdef UNIV_ZIP_DEBUG3206#ifdef UNIV_ZIP_DEBUG
3206 ut_a(!page_zip || page_zip_validate(page_zip, page));3207 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
3207#endif /* UNIV_ZIP_DEBUG */3208#endif /* UNIV_ZIP_DEBUG */
3208 }3209 }
32093210
@@ -3379,8 +3380,8 @@
3379 const page_zip_des_t* page_zip3380 const page_zip_des_t* page_zip
3380 = buf_block_get_page_zip(block);3381 = buf_block_get_page_zip(block);
3381 ut_a(page_zip);3382 ut_a(page_zip);
3382 ut_a(page_zip_validate(merge_page_zip, merge_page));3383 ut_a(page_zip_validate(merge_page_zip, merge_page, index));
3383 ut_a(page_zip_validate(page_zip, page));3384 ut_a(page_zip_validate(page_zip, page, index));
3384 }3385 }
3385#endif /* UNIV_ZIP_DEBUG */3386#endif /* UNIV_ZIP_DEBUG */
33863387
@@ -3513,7 +3514,8 @@
35133514
3514 ut_ad(page_validate(merge_page, index));3515 ut_ad(page_validate(merge_page, index));
3515#ifdef UNIV_ZIP_DEBUG3516#ifdef UNIV_ZIP_DEBUG
3516 ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page));3517 ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page,
3518 index));
3517#endif /* UNIV_ZIP_DEBUG */3519#endif /* UNIV_ZIP_DEBUG */
35183520
3519 /* Free the file page */3521 /* Free the file page */
@@ -3696,7 +3698,7 @@
3696 page_zip_des_t* merge_page_zip3698 page_zip_des_t* merge_page_zip
3697 = buf_block_get_page_zip(merge_block);3699 = buf_block_get_page_zip(merge_block);
3698 ut_a(!merge_page_zip3700 ut_a(!merge_page_zip
3699 || page_zip_validate(merge_page_zip, merge_page));3701 || page_zip_validate(merge_page_zip, merge_page, index));
3700 }3702 }
3701#endif /* UNIV_ZIP_DEBUG */3703#endif /* UNIV_ZIP_DEBUG */
37023704
@@ -4173,7 +4175,7 @@
4173 ut_a(space == page_get_space_id(page));4175 ut_a(space == page_get_space_id(page));
4174#ifdef UNIV_ZIP_DEBUG4176#ifdef UNIV_ZIP_DEBUG
4175 page_zip = buf_block_get_page_zip(block);4177 page_zip = buf_block_get_page_zip(block);
4176 ut_a(!page_zip || page_zip_validate(page_zip, page));4178 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
4177#endif /* UNIV_ZIP_DEBUG */4179#endif /* UNIV_ZIP_DEBUG */
4178 ut_a(!page_is_leaf(page));4180 ut_a(!page_is_leaf(page));
41794181
@@ -4201,7 +4203,7 @@
42014203
4202#ifdef UNIV_ZIP_DEBUG4204#ifdef UNIV_ZIP_DEBUG
4203 page_zip = buf_block_get_page_zip(block);4205 page_zip = buf_block_get_page_zip(block);
4204 ut_a(!page_zip || page_zip_validate(page_zip, page));4206 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
4205#endif /* UNIV_ZIP_DEBUG */4207#endif /* UNIV_ZIP_DEBUG */
42064208
4207 /* Check ordering etc. of records */4209 /* Check ordering etc. of records */
42084210
=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0cur.c'
--- Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2013-01-10 04:35:33 +0000
@@ -651,7 +651,8 @@
651#ifdef UNIV_ZIP_DEBUG651#ifdef UNIV_ZIP_DEBUG
652 const page_zip_des_t* page_zip652 const page_zip_des_t* page_zip
653 = buf_block_get_page_zip(block);653 = buf_block_get_page_zip(block);
654 ut_a(!page_zip || page_zip_validate(page_zip, page));654 ut_a(!page_zip
655 || page_zip_validate(page_zip, page, index));
655#endif /* UNIV_ZIP_DEBUG */656#endif /* UNIV_ZIP_DEBUG */
656657
657 buf_block_dbg_add_level(658 buf_block_dbg_add_level(
@@ -2084,7 +2085,7 @@
20842085
2085 page_zip = buf_block_get_page_zip(block);2086 page_zip = buf_block_get_page_zip(block);
2086#ifdef UNIV_ZIP_DEBUG2087#ifdef UNIV_ZIP_DEBUG
2087 ut_a(!page_zip || page_zip_validate(page_zip, page));2088 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
2088#endif /* UNIV_ZIP_DEBUG */2089#endif /* UNIV_ZIP_DEBUG */
20892090
2090 if (page_zip2091 if (page_zip
@@ -2299,7 +2300,7 @@
2299 MTR_MEMO_X_LOCK));2300 MTR_MEMO_X_LOCK));
2300 ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));2301 ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
2301#ifdef UNIV_ZIP_DEBUG2302#ifdef UNIV_ZIP_DEBUG
2302 ut_a(!page_zip || page_zip_validate(page_zip, page));2303 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
2303#endif /* UNIV_ZIP_DEBUG */2304#endif /* UNIV_ZIP_DEBUG */
2304 /* The insert buffer tree should never be updated in place. */2305 /* The insert buffer tree should never be updated in place. */
2305 ut_ad(!dict_index_is_ibuf(index));2306 ut_ad(!dict_index_is_ibuf(index));
@@ -2454,7 +2455,7 @@
2454 btr_search_update_hash_on_delete(cursor);2455 btr_search_update_hash_on_delete(cursor);
24552456
2456#ifdef UNIV_ZIP_DEBUG2457#ifdef UNIV_ZIP_DEBUG
2457 ut_a(!page_zip || page_zip_validate(page_zip, page));2458 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
2458#endif /* UNIV_ZIP_DEBUG */2459#endif /* UNIV_ZIP_DEBUG */
2459 page_cursor = btr_cur_get_page_cur(cursor);2460 page_cursor = btr_cur_get_page_cur(cursor);
24602461
@@ -2561,7 +2562,7 @@
2561 buf_block_t* rec_block = btr_cur_get_block(cursor);2562 buf_block_t* rec_block = btr_cur_get_block(cursor);
25622563
2563#ifdef UNIV_ZIP_DEBUG2564#ifdef UNIV_ZIP_DEBUG
2564 ut_a(!page_zip || page_zip_validate(page_zip, page));2565 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
2565 page = buf_block_get_frame(rec_block);2566 page = buf_block_get_frame(rec_block);
2566#endif /* UNIV_ZIP_DEBUG */2567#endif /* UNIV_ZIP_DEBUG */
2567 page_zip = buf_block_get_page_zip(rec_block);2568 page_zip = buf_block_get_page_zip(rec_block);
@@ -2587,7 +2588,7 @@
25872588
2588return_after_reservations:2589return_after_reservations:
2589#ifdef UNIV_ZIP_DEBUG2590#ifdef UNIV_ZIP_DEBUG
2590 ut_a(!page_zip || page_zip_validate(page_zip, page));2591 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
2591#endif /* UNIV_ZIP_DEBUG */2592#endif /* UNIV_ZIP_DEBUG */
25922593
2593 if (n_extents > 0) {2594 if (n_extents > 0) {
@@ -2946,19 +2947,20 @@
2946 return(DB_SUCCESS);2947 return(DB_SUCCESS);
2947}2948}
29482949
2949/***********************************************************//**2950/***************************************************************
2950Clear a secondary index record's delete mark. This function is only2951Sets a secondary index record delete mark. This function is only
2951used by the insert buffer insert merge mechanism. */2952used by the insert buffer insert merge mechanism. */
2952UNIV_INTERN2953UNIV_INTERN
2953void2954void
2954btr_cur_del_unmark_for_ibuf(2955btr_cur_set_deleted_flag_for_ibuf(
2955/*========================*/2956/*==============================*/
2956 rec_t* rec, /*!< in/out: record to delete unmark */2957 rec_t* rec, /*!< in/out: record to delete unmark */
2957 page_zip_des_t* page_zip, /*!< in/out: compressed page2958 page_zip_des_t* page_zip, /*!< in/out: compressed page
2958 corresponding to rec, or NULL2959 corresponding to rec, or NULL
2959 when the tablespace is2960 when the tablespace is
2960 uncompressed */2961 uncompressed */
2961 mtr_t* mtr) /*!< in: mtr */2962 ibool val, /*!< in: value to set */
2963 mtr_t* mtr) /*!< in/out: mini-transaction */
2962{2964{
2963 /* We do not need to reserve btr_search_latch, as the page2965 /* We do not need to reserve btr_search_latch, as the page
2964 has just been read to the buffer pool and there cannot be2966 has just been read to the buffer pool and there cannot be
@@ -2966,9 +2968,9 @@
2966 updated in place and the adaptive hash index does not depend2968 updated in place and the adaptive hash index does not depend
2967 on it. */2969 on it. */
29682970
2969 btr_rec_set_deleted_flag(rec, page_zip, FALSE);2971 btr_rec_set_deleted_flag(rec, page_zip, val);
29702972
2971 btr_cur_del_mark_set_sec_rec_log(rec, FALSE, mtr);2973 btr_cur_del_mark_set_sec_rec_log(rec, val, mtr);
2972}2974}
29732975
2974/*==================== B-TREE RECORD REMOVE =========================*/2976/*==================== B-TREE RECORD REMOVE =========================*/
@@ -3063,12 +3065,14 @@
3063 page, 1);3065 page, 1);
3064 }3066 }
3065#ifdef UNIV_ZIP_DEBUG3067#ifdef UNIV_ZIP_DEBUG
3066 ut_a(!page_zip || page_zip_validate(page_zip, page));3068 ut_a(!page_zip
3069 || page_zip_validate(page_zip, page, cursor->index));
3067#endif /* UNIV_ZIP_DEBUG */3070#endif /* UNIV_ZIP_DEBUG */
3068 page_cur_delete_rec(btr_cur_get_page_cur(cursor),3071 page_cur_delete_rec(btr_cur_get_page_cur(cursor),
3069 cursor->index, offsets, mtr);3072 cursor->index, offsets, mtr);
3070#ifdef UNIV_ZIP_DEBUG3073#ifdef UNIV_ZIP_DEBUG
3071 ut_a(!page_zip || page_zip_validate(page_zip, page));3074 ut_a(!page_zip
3075 || page_zip_validate(page_zip, page, cursor->index));
3072#endif /* UNIV_ZIP_DEBUG */3076#endif /* UNIV_ZIP_DEBUG */
30733077
3074 if (dict_index_is_clust(cursor->index)3078 if (dict_index_is_clust(cursor->index)
@@ -3165,7 +3169,7 @@
3165 rec = btr_cur_get_rec(cursor);3169 rec = btr_cur_get_rec(cursor);
3166 page_zip = buf_block_get_page_zip(block);3170 page_zip = buf_block_get_page_zip(block);
3167#ifdef UNIV_ZIP_DEBUG3171#ifdef UNIV_ZIP_DEBUG
3168 ut_a(!page_zip || page_zip_validate(page_zip, page));3172 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
3169#endif /* UNIV_ZIP_DEBUG */3173#endif /* UNIV_ZIP_DEBUG */
31703174
3171 offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);3175 offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
@@ -3175,7 +3179,7 @@
3175 rec, offsets, page_zip,3179 rec, offsets, page_zip,
3176 rb_ctx, mtr);3180 rb_ctx, mtr);
3177#ifdef UNIV_ZIP_DEBUG3181#ifdef UNIV_ZIP_DEBUG
3178 ut_a(!page_zip || page_zip_validate(page_zip, page));3182 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
3179#endif /* UNIV_ZIP_DEBUG */3183#endif /* UNIV_ZIP_DEBUG */
3180 }3184 }
31813185
@@ -3236,7 +3240,7 @@
32363240
3237 page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr);3241 page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr);
3238#ifdef UNIV_ZIP_DEBUG3242#ifdef UNIV_ZIP_DEBUG
3239 ut_a(!page_zip || page_zip_validate(page_zip, page));3243 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
3240#endif /* UNIV_ZIP_DEBUG */3244#endif /* UNIV_ZIP_DEBUG */
32413245
3242 ut_ad(btr_check_node_ptr(index, block, mtr));3246 ut_ad(btr_check_node_ptr(index, block, mtr));
32433247
=== modified file 'Percona-Server/storage/innodb_plugin/buf/buf0buf.c'
--- Percona-Server/storage/innodb_plugin/buf/buf0buf.c 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/buf/buf0buf.c 2013-01-10 04:35:33 +0000
@@ -278,7 +278,7 @@
278278
279#ifndef UNIV_HOTBACKUP279#ifndef UNIV_HOTBACKUP
280/** Value in microseconds */280/** Value in microseconds */
281static const int WAIT_FOR_READ = 5000;281static const int WAIT_FOR_READ = 100;
282/** Number of attemtps made to read in a page in the buffer pool */282/** Number of attemtps made to read in a page in the buffer pool */
283static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;283static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
284284
@@ -2202,8 +2202,9 @@
2202 mutex_exit(&block->mutex);2202 mutex_exit(&block->mutex);
22032203
2204 if (io_fix == BUF_IO_READ) {2204 if (io_fix == BUF_IO_READ) {
22052205 /* wait by temporaly s-latch */
2206 os_thread_sleep(WAIT_FOR_READ);2206 rw_lock_s_lock(&(block->lock));
2207 rw_lock_s_unlock(&(block->lock));
2207 } else {2208 } else {
2208 break;2209 break;
2209 }2210 }
22102211
=== modified file 'Percona-Server/storage/innodb_plugin/buf/buf0lru.c'
--- Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-11-23 11:15:06 +0000
+++ Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2013-01-10 04:35:33 +0000
@@ -1839,7 +1839,9 @@
1839 break;1839 break;
1840 case FIL_PAGE_INDEX:1840 case FIL_PAGE_INDEX:
1841#ifdef UNIV_ZIP_DEBUG1841#ifdef UNIV_ZIP_DEBUG
1842 ut_a(page_zip_validate(&bpage->zip, page));1842 ut_a(page_zip_validate(
1843 &bpage->zip, page,
1844 ((buf_block_t*) bpage)->index));
1843#endif /* UNIV_ZIP_DEBUG */1845#endif /* UNIV_ZIP_DEBUG */
1844 break;1846 break;
1845 default:1847 default:
18461848
=== modified file 'Percona-Server/storage/innodb_plugin/dict/dict0dict.c'
--- Percona-Server/storage/innodb_plugin/dict/dict0dict.c 2012-08-20 03:14:02 +0000
+++ Percona-Server/storage/innodb_plugin/dict/dict0dict.c 2013-01-10 04:35:33 +0000
@@ -1,6 +1,6 @@
1/*****************************************************************************1/*****************************************************************************
22
3Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.3Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
44
5This program is free software; you can redistribute it and/or modify it under5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software6the terms of the GNU General Public License as published by the Free Software
@@ -498,38 +498,55 @@
498ULINT_UNDEFINED if not contained */498ULINT_UNDEFINED if not contained */
499UNIV_INTERN499UNIV_INTERN
500ulint500ulint
501dict_index_get_nth_col_or_prefix_pos(
502/*=================================*/
503 const dict_index_t* index, /*!< in: index */
504 ulint n, /*!< in: column number */
505 ibool inc_prefix) /*!< in: TRUE=consider
506 column prefixes too */
507{
508 const dict_field_t* field;
509 const dict_col_t* col;
510 ulint pos;
511 ulint n_fields;
512
513 ut_ad(index);
514 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
515
516 col = dict_table_get_nth_col(index->table, n);
517
518 if (dict_index_is_clust(index)) {
519
520 return(dict_col_get_clust_pos(col, index));
521 }
522
523 n_fields = dict_index_get_n_fields(index);
524
525 for (pos = 0; pos < n_fields; pos++) {
526 field = dict_index_get_nth_field(index, pos);
527
528 if (col == field->col
529 && (inc_prefix || field->prefix_len == 0)) {
530
531 return(pos);
532 }
533 }
534
535 return(ULINT_UNDEFINED);
536}
537
538/********************************************************************//**
539Looks for column n in an index.
540@return position in internal representation of the index;
541ULINT_UNDEFINED if not contained */
542UNIV_INTERN
543ulint
501dict_index_get_nth_col_pos(544dict_index_get_nth_col_pos(
502/*=======================*/545/*=======================*/
503 const dict_index_t* index, /*!< in: index */546 const dict_index_t* index, /*!< in: index */
504 ulint n) /*!< in: column number */547 ulint n) /*!< in: column number */
505{548{
506 const dict_field_t* field;549 return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE));
507 const dict_col_t* col;
508 ulint pos;
509 ulint n_fields;
510
511 ut_ad(index);
512 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
513
514 col = dict_table_get_nth_col(index->table, n);
515
516 if (dict_index_is_clust(index)) {
517
518 return(dict_col_get_clust_pos(col, index));
519 }
520
521 n_fields = dict_index_get_n_fields(index);
522
523 for (pos = 0; pos < n_fields; pos++) {
524 field = dict_index_get_nth_field(index, pos);
525
526 if (col == field->col && field->prefix_len == 0) {
527
528 return(pos);
529 }
530 }
531
532 return(ULINT_UNDEFINED);
533}550}
534551
535#ifndef UNIV_HOTBACKUP552#ifndef UNIV_HOTBACKUP
@@ -2062,7 +2079,6 @@
2062{2079{
2063 dict_index_t* new_index;2080 dict_index_t* new_index;
2064 dict_field_t* field;2081 dict_field_t* field;
2065 ulint fixed_size;
2066 ulint trx_id_pos;2082 ulint trx_id_pos;
2067 ulint i;2083 ulint i;
2068 ibool* indexed;2084 ibool* indexed;
@@ -2139,7 +2155,7 @@
21392155
2140 for (i = 0; i < trx_id_pos; i++) {2156 for (i = 0; i < trx_id_pos; i++) {
21412157
2142 fixed_size = dict_col_get_fixed_size(2158 ulint fixed_size = dict_col_get_fixed_size(
2143 dict_index_get_nth_col(new_index, i),2159 dict_index_get_nth_col(new_index, i),
2144 dict_table_is_comp(table));2160 dict_table_is_comp(table));
21452161
@@ -2156,7 +2172,20 @@
2156 break;2172 break;
2157 }2173 }
21582174
2159 new_index->trx_id_offset += (unsigned int) fixed_size;2175 /* Add fixed_size to new_index->trx_id_offset.
2176 Because the latter is a bit-field, an overflow
2177 can theoretically occur. Check for it. */
2178 fixed_size += new_index->trx_id_offset;
2179
2180 new_index->trx_id_offset = fixed_size;
2181
2182 if (new_index->trx_id_offset != fixed_size) {
2183 /* Overflow. Pretend that this is a
2184 variable-length PRIMARY KEY. */
2185 ut_ad(0);
2186 new_index->trx_id_offset = 0;
2187 break;
2188 }
2160 }2189 }
21612190
2162 }2191 }
21632192
=== modified file 'Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc'
--- Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2013-01-10 04:35:33 +0000
@@ -12123,8 +12123,8 @@
12123#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG12123#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
12124static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,12124static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
12125 PLUGIN_VAR_RQCMDARG,12125 PLUGIN_VAR_RQCMDARG,
12126 "Debug flags for InnoDB change buffering (0=none)",12126 "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)",
12127 NULL, NULL, 0, 0, 1, 0);12127 NULL, NULL, 0, 0, 2, 0);
12128#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */12128#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
1212912129
12130static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead,12130static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead,
1213112131
=== modified file 'Percona-Server/storage/innodb_plugin/handler/handler0alter.cc'
--- Percona-Server/storage/innodb_plugin/handler/handler0alter.cc 2012-08-20 03:14:02 +0000
+++ Percona-Server/storage/innodb_plugin/handler/handler0alter.cc 2013-01-10 04:35:33 +0000
@@ -108,13 +108,17 @@
108 /* These column types should never be shipped to MySQL. */108 /* These column types should never be shipped to MySQL. */
109 ut_ad(0);109 ut_ad(0);
110110
111 case DATA_CHAR:
112 case DATA_FIXBINARY:111 case DATA_FIXBINARY:
113 case DATA_FLOAT:112 case DATA_FLOAT:
114 case DATA_DOUBLE:113 case DATA_DOUBLE:
115 case DATA_DECIMAL:114 case DATA_DECIMAL:
116 /* Above are the valid column types for MySQL data. */115 /* Above are the valid column types for MySQL data. */
117 ut_ad(flen == len);116 ut_ad(flen == len);
117 /* fall through */
118 case DATA_CHAR:
119 /* We may have flen > len when there is a shorter
120 prefix on a CHAR column. */
121 ut_ad(flen >= len);
118#else /* UNIV_DEBUG */122#else /* UNIV_DEBUG */
119 default:123 default:
120#endif /* UNIV_DEBUG */124#endif /* UNIV_DEBUG */
@@ -147,7 +151,7 @@
147151
148 field->reset();152 field->reset();
149153
150 ipos = dict_index_get_nth_col_pos(index, i);154 ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE);
151155
152 if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) {156 if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) {
153null_field:157null_field:
154158
=== modified file 'Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c'
--- Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2013-01-10 04:35:33 +0000
@@ -3049,7 +3049,8 @@
3049 /* The records only differ in the delete-mark.3049 /* The records only differ in the delete-mark.
3050 Clear the delete-mark, like we did before3050 Clear the delete-mark, like we did before
3051 Bug #56680 was fixed. */3051 Bug #56680 was fixed. */
3052 btr_cur_del_unmark_for_ibuf(rec, page_zip, mtr);3052 btr_cur_set_deleted_flag_for_ibuf(
3053 rec, page_zip, FALSE, mtr);
3053updated_in_place:3054updated_in_place:
3054 mem_heap_free(heap);3055 mem_heap_free(heap);
3055 return;3056 return;
@@ -3134,6 +3135,22 @@
3134 ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);3135 ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
3135 ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);3136 ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
31363137
3138#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
3139 if (ibuf_debug == 2) {
3140 /* Inject a fault (crash). We do this before trying
3141 optimistic delete, because a pessimistic delete in the
3142 change buffer would require a larger test case. */
3143
3144 /* Flag the buffered record as processed, to avoid
3145 an assertion failure after crash recovery. */
3146 btr_cur_set_deleted_flag_for_ibuf(
3147 btr_pcur_get_rec(pcur), NULL, TRUE, mtr);
3148 mtr_commit(mtr);
3149 log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
3150 DBUG_SUICIDE();
3151 }
3152#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
3153
3137 success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);3154 success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
31383155
3139 if (success) {3156 if (success) {
@@ -3152,7 +3169,13 @@
3152 ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);3169 ut_ad(ibuf_rec_get_page_no(btr_pcur_get_rec(pcur)) == page_no);
3153 ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);3170 ut_ad(ibuf_rec_get_space(btr_pcur_get_rec(pcur)) == space);
31543171
3155 /* We have to resort to a pessimistic delete from ibuf */3172 /* We have to resort to a pessimistic delete from ibuf.
3173 Delete-mark the record so that it will not be applied again,
3174 in case the server crashes before the pessimistic delete is
3175 made persistent. */
3176 btr_cur_set_deleted_flag_for_ibuf(
3177 btr_pcur_get_rec(pcur), NULL, TRUE, mtr);
3178
3156 btr_pcur_store_position(pcur, mtr);3179 btr_pcur_store_position(pcur, mtr);
31573180
3158 btr_pcur_commit_specify_mtr(pcur, mtr);3181 btr_pcur_commit_specify_mtr(pcur, mtr);
@@ -3461,7 +3484,7 @@
3461 fputs("InnoDB: Discarding record\n ", stderr);3484 fputs("InnoDB: Discarding record\n ", stderr);
3462 rec_print_old(stderr, rec);3485 rec_print_old(stderr, rec);
3463 fputs("\nInnoDB: from the insert buffer!\n\n", stderr);3486 fputs("\nInnoDB: from the insert buffer!\n\n", stderr);
3464 } else if (block) {3487 } else if (block && !rec_get_deleted_flag(rec, 0)) {
3465 /* Now we have at pcur a record which should be3488 /* Now we have at pcur a record which should be
3466 inserted to the index page; NOTE that the call below3489 inserted to the index page; NOTE that the call below
3467 copies pointers to fields in rec, and we must3490 copies pointers to fields in rec, and we must
34683491
=== modified file 'Percona-Server/storage/innodb_plugin/include/btr0cur.h'
--- Percona-Server/storage/innodb_plugin/include/btr0cur.h 2012-10-16 11:18:45 +0000
+++ Percona-Server/storage/innodb_plugin/include/btr0cur.h 2013-01-10 04:35:33 +0000
@@ -358,19 +358,20 @@
358 ibool val, /*!< in: value to set */358 ibool val, /*!< in: value to set */
359 que_thr_t* thr, /*!< in: query thread */359 que_thr_t* thr, /*!< in: query thread */
360 mtr_t* mtr); /*!< in: mtr */360 mtr_t* mtr); /*!< in: mtr */
361/***********************************************************//**361/***************************************************************
362Clear a secondary index record's delete mark. This function is only362Sets a secondary index record delete mark. This function is only
363used by the insert buffer insert merge mechanism. */363used by the insert buffer insert merge mechanism. */
364UNIV_INTERN364UNIV_INTERN
365void365void
366btr_cur_del_unmark_for_ibuf(366btr_cur_set_deleted_flag_for_ibuf(
367/*========================*/367/*==============================*/
368 rec_t* rec, /*!< in/out: record to delete unmark */368 rec_t* rec, /*!< in/out: record to delete unmark */
369 page_zip_des_t* page_zip, /*!< in/out: compressed page369 page_zip_des_t* page_zip, /*!< in/out: compressed page
370 corresponding to rec, or NULL370 corresponding to rec, or NULL
371 when the tablespace is371 when the tablespace is
372 uncompressed */372 uncompressed */
373 mtr_t* mtr); /*!< in: mtr */373 ibool val, /*!< in: value to set */
374 mtr_t* mtr); /*!< in/out: mini-transaction */
374/*************************************************************//**375/*************************************************************//**
375Tries to compress a page of the tree if it seems useful. It is assumed376Tries to compress a page of the tree if it seems useful. It is assumed
376that mtr holds an x-latch on the tree and on the cursor page. To avoid377that mtr holds an x-latch on the tree and on the cursor page. To avoid
377378
=== modified file 'Percona-Server/storage/innodb_plugin/include/dict0dict.h'
--- Percona-Server/storage/innodb_plugin/include/dict0dict.h 2012-05-09 04:14:12 +0000
+++ Percona-Server/storage/innodb_plugin/include/dict0dict.h 2013-01-10 04:35:33 +0000
@@ -839,6 +839,18 @@
839 const dict_index_t* index, /*!< in: index */839 const dict_index_t* index, /*!< in: index */
840 ulint n); /*!< in: column number */840 ulint n); /*!< in: column number */
841/********************************************************************//**841/********************************************************************//**
842Looks for column n in an index.
843@return position in internal representation of the index;
844ULINT_UNDEFINED if not contained */
845UNIV_INTERN
846ulint
847dict_index_get_nth_col_or_prefix_pos(
848/*=================================*/
849 const dict_index_t* index, /*!< in: index */
850 ulint n, /*!< in: column number */
851 ibool inc_prefix); /*!< in: TRUE=consider
852 column prefixes too */
853/********************************************************************//**
842Returns TRUE if the index contains a column or a prefix of that column.854Returns TRUE if the index contains a column or a prefix of that column.
843@return TRUE if contains the column or its prefix */855@return TRUE if contains the column or its prefix */
844UNIV_INTERN856UNIV_INTERN
845857
=== modified file 'Percona-Server/storage/innodb_plugin/include/dict0mem.h'
--- Percona-Server/storage/innodb_plugin/include/dict0mem.h 2012-05-09 04:14:12 +0000
+++ Percona-Server/storage/innodb_plugin/include/dict0mem.h 2013-01-10 04:35:33 +0000
@@ -286,10 +286,15 @@
286#endif /* !UNIV_HOTBACKUP */286#endif /* !UNIV_HOTBACKUP */
287 unsigned type:4; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE,287 unsigned type:4; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE,
288 DICT_UNIVERSAL, DICT_IBUF) */288 DICT_UNIVERSAL, DICT_IBUF) */
289 unsigned trx_id_offset:10;/*!< position of the trx id column289#define MAX_KEY_LENGTH_BITS 12
290 unsigned trx_id_offset:MAX_KEY_LENGTH_BITS;
291 /*!< position of the trx id column
290 in a clustered index record, if the fields292 in a clustered index record, if the fields
291 before it are known to be of a fixed size,293 before it are known to be of a fixed size,
292 0 otherwise */294 0 otherwise */
295#if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
296# error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
297#endif
293 unsigned n_user_defined_cols:10;298 unsigned n_user_defined_cols:10;
294 /*!< number of columns the user defined to299 /*!< number of columns the user defined to
295 be in the index: in the internal300 be in the index: in the internal
296301
=== modified file 'Percona-Server/storage/innodb_plugin/include/page0zip.h'
--- Percona-Server/storage/innodb_plugin/include/page0zip.h 2011-11-24 02:00:38 +0000
+++ Percona-Server/storage/innodb_plugin/include/page0zip.h 2013-01-10 04:35:33 +0000
@@ -156,9 +156,10 @@
156/*==================*/156/*==================*/
157 const page_zip_des_t* page_zip,/*!< in: compressed page */157 const page_zip_des_t* page_zip,/*!< in: compressed page */
158 const page_t* page, /*!< in: uncompressed page */158 const page_t* page, /*!< in: uncompressed page */
159 const dict_index_t* index, /*!< in: index of the page, if known */
159 ibool sloppy) /*!< in: FALSE=strict,160 ibool sloppy) /*!< in: FALSE=strict,
160 TRUE=ignore the MIN_REC_FLAG */161 TRUE=ignore the MIN_REC_FLAG */
161 __attribute__((nonnull));162 __attribute__((nonnull(1,2)));
162/**********************************************************************//**163/**********************************************************************//**
163Check that the compressed and decompressed pages match. */164Check that the compressed and decompressed pages match. */
164UNIV_INTERN165UNIV_INTERN
@@ -166,8 +167,9 @@
166page_zip_validate(167page_zip_validate(
167/*==============*/168/*==============*/
168 const page_zip_des_t* page_zip,/*!< in: compressed page */169 const page_zip_des_t* page_zip,/*!< in: compressed page */
169 const page_t* page) /*!< in: uncompressed page */170 const page_t* page, /*!< in: uncompressed page */
170 __attribute__((nonnull));171 const dict_index_t* index) /*!< in: index of the page, if known */
172 __attribute__((nonnull(1,2)));
171#endif /* UNIV_ZIP_DEBUG */173#endif /* UNIV_ZIP_DEBUG */
172174
173/**********************************************************************//**175/**********************************************************************//**
174176
=== modified file 'Percona-Server/storage/innodb_plugin/include/row0undo.h'
--- Percona-Server/storage/innodb_plugin/include/row0undo.h 2009-05-26 12:28:49 +0000
+++ Percona-Server/storage/innodb_plugin/include/row0undo.h 2013-01-10 04:35:33 +0000
@@ -87,10 +87,6 @@
87enum undo_exec {87enum undo_exec {
88 UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next88 UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next
89 undo log record */89 undo log record */
90 UNDO_NODE_PREV_VERS, /*!< the roll ptr to previous
91 version of a row is stored in
92 node, and undo should be done
93 based on it */
94 UNDO_NODE_INSERT, /*!< undo a fresh insert of a90 UNDO_NODE_INSERT, /*!< undo a fresh insert of a
95 row to a table */91 row to a table */
96 UNDO_NODE_MODIFY /*!< undo a modify operation92 UNDO_NODE_MODIFY /*!< undo a modify operation
@@ -108,9 +104,6 @@
108 undo_no_t undo_no;/*!< undo number of the record */104 undo_no_t undo_no;/*!< undo number of the record */
109 ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC,105 ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC,
110 ... */106 ... */
111 roll_ptr_t new_roll_ptr;
112 /*!< roll ptr to restore to clustered index
113 record */
114 trx_id_t new_trx_id; /*!< trx id to restore to clustered index107 trx_id_t new_trx_id; /*!< trx id to restore to clustered index
115 record */108 record */
116 btr_pcur_t pcur; /*!< persistent cursor used in searching the109 btr_pcur_t pcur; /*!< persistent cursor used in searching the
117110
=== modified file 'Percona-Server/storage/innodb_plugin/log/log0recv.c'
--- Percona-Server/storage/innodb_plugin/log/log0recv.c 2012-06-14 09:16:03 +0000
+++ Percona-Server/storage/innodb_plugin/log/log0recv.c 2013-01-10 04:35:33 +0000
@@ -1687,9 +1687,8 @@
1687 if (fil_page_get_type(page) == FIL_PAGE_INDEX) {1687 if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
1688 page_zip_des_t* page_zip = buf_block_get_page_zip(block);1688 page_zip_des_t* page_zip = buf_block_get_page_zip(block);
16891689
1690 if (page_zip) {1690 ut_a(!page_zip
1691 ut_a(page_zip_validate_low(page_zip, page, FALSE));1691 || page_zip_validate_low(page_zip, page, NULL, FALSE));
1692 }
1693 }1692 }
1694#endif /* UNIV_ZIP_DEBUG */1693#endif /* UNIV_ZIP_DEBUG */
16951694
16961695
=== modified file 'Percona-Server/storage/innodb_plugin/os/os0file.c'
--- Percona-Server/storage/innodb_plugin/os/os0file.c 2013-01-04 07:28:01 +0000
+++ Percona-Server/storage/innodb_plugin/os/os0file.c 2013-01-10 04:35:33 +0000
@@ -1296,6 +1296,14 @@
1296 DWORD create_flag;1296 DWORD create_flag;
1297 DWORD attributes;1297 DWORD attributes;
1298 ibool retry;1298 ibool retry;
1299
1300 DBUG_EXECUTE_IF(
1301 "ib_create_table_fail_disk_full",
1302 *success = FALSE;
1303 SetLastError(ERROR_DISK_FULL);
1304 return((os_file_t) -1);
1305 );
1306
1299try_again:1307try_again:
1300 ut_a(name);1308 ut_a(name);
13011309
@@ -1411,6 +1419,13 @@
1411 ibool retry;1419 ibool retry;
1412 const char* mode_str = NULL;1420 const char* mode_str = NULL;
14131421
1422 DBUG_EXECUTE_IF(
1423 "ib_create_table_fail_disk_full",
1424 *success = FALSE;
1425 errno = ENOSPC;
1426 return((os_file_t) -1);
1427 );
1428
1414try_again:1429try_again:
1415 ut_a(name);1430 ut_a(name);
14161431
14171432
=== modified file 'Percona-Server/storage/innodb_plugin/page/page0cur.c'
--- Percona-Server/storage/innodb_plugin/page/page0cur.c 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/page/page0cur.c 2013-01-10 04:35:33 +0000
@@ -310,7 +310,7 @@
310#endif /* UNIV_DEBUG */310#endif /* UNIV_DEBUG */
311 page = buf_block_get_frame(block);311 page = buf_block_get_frame(block);
312#ifdef UNIV_ZIP_DEBUG312#ifdef UNIV_ZIP_DEBUG
313 ut_a(!page_zip || page_zip_validate(page_zip, page));313 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
314#endif /* UNIV_ZIP_DEBUG */314#endif /* UNIV_ZIP_DEBUG */
315315
316 page_check_dir(page);316 page_check_dir(page);
@@ -1248,7 +1248,7 @@
12481248
1249 ut_ad(!page_rec_is_supremum(*current_rec));1249 ut_ad(!page_rec_is_supremum(*current_rec));
1250#ifdef UNIV_ZIP_DEBUG1250#ifdef UNIV_ZIP_DEBUG
1251 ut_a(page_zip_validate(page_zip, page));1251 ut_a(page_zip_validate(page_zip, page, index));
1252#endif /* UNIV_ZIP_DEBUG */1252#endif /* UNIV_ZIP_DEBUG */
12531253
1254 /* 1. Get the size of the physical record in the page */1254 /* 1. Get the size of the physical record in the page */
@@ -1973,7 +1973,7 @@
1973 }1973 }
19741974
1975#ifdef UNIV_ZIP_DEBUG1975#ifdef UNIV_ZIP_DEBUG
1976 ut_a(!page_zip || page_zip_validate(page_zip, page));1976 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
1977#endif /* UNIV_ZIP_DEBUG */1977#endif /* UNIV_ZIP_DEBUG */
1978}1978}
19791979
19801980
=== modified file 'Percona-Server/storage/innodb_plugin/page/page0page.c'
--- Percona-Server/storage/innodb_plugin/page/page0page.c 2013-01-10 04:35:31 +0000
+++ Percona-Server/storage/innodb_plugin/page/page0page.c 2013-01-10 04:35:33 +0000
@@ -625,7 +625,7 @@
625 Furthermore, btr_compress() may set FIL_PAGE_PREV to625 Furthermore, btr_compress() may set FIL_PAGE_PREV to
626 FIL_NULL on new_page while leaving it intact on626 FIL_NULL on new_page while leaving it intact on
627 new_page_zip. So, we cannot validate new_page_zip. */627 new_page_zip. So, we cannot validate new_page_zip. */
628 ut_a(page_zip_validate_low(page_zip, page, TRUE));628 ut_a(page_zip_validate_low(page_zip, page, index, TRUE));
629 }629 }
630#endif /* UNIV_ZIP_DEBUG */630#endif /* UNIV_ZIP_DEBUG */
631 ut_ad(buf_block_get_frame(block) == page);631 ut_ad(buf_block_get_frame(block) == page);
@@ -945,7 +945,7 @@
945 ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE);945 ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE);
946 ut_ad(!page_zip || page_rec_is_comp(rec));946 ut_ad(!page_zip || page_rec_is_comp(rec));
947#ifdef UNIV_ZIP_DEBUG947#ifdef UNIV_ZIP_DEBUG
948 ut_a(!page_zip || page_zip_validate(page_zip, page));948 ut_a(!page_zip || page_zip_validate(page_zip, page, index));
949#endif /* UNIV_ZIP_DEBUG */949#endif /* UNIV_ZIP_DEBUG */
950950
951 if (page_rec_is_infimum(rec)) {951 if (page_rec_is_infimum(rec)) {
@@ -987,7 +987,7 @@
987 ULINT_UNDEFINED, &heap);987 ULINT_UNDEFINED, &heap);
988 rec = rec_get_next_ptr(rec, TRUE);988 rec = rec_get_next_ptr(rec, TRUE);
989#ifdef UNIV_ZIP_DEBUG989#ifdef UNIV_ZIP_DEBUG
990 ut_a(page_zip_validate(page_zip, page));990 ut_a(page_zip_validate(page_zip, page, index));
991#endif /* UNIV_ZIP_DEBUG */991#endif /* UNIV_ZIP_DEBUG */
992 page_cur_delete_rec(&cur, index, offsets, mtr);992 page_cur_delete_rec(&cur, index, offsets, mtr);
993 } while (page_offset(rec) != PAGE_NEW_SUPREMUM);993 } while (page_offset(rec) != PAGE_NEW_SUPREMUM);
@@ -1127,7 +1127,8 @@
1127 between btr_attach_half_pages() and insert_page = ...1127 between btr_attach_half_pages() and insert_page = ...
1128 when btr_page_get_split_rec_to_left() holds1128 when btr_page_get_split_rec_to_left() holds
1129 (direction == FSP_DOWN). */1129 (direction == FSP_DOWN). */
1130 ut_a(!page_zip || page_zip_validate_low(page_zip, page, TRUE));1130 ut_a(!page_zip
1131 || page_zip_validate_low(page_zip, page, index, TRUE));
1131 }1132 }
1132#endif /* UNIV_ZIP_DEBUG */1133#endif /* UNIV_ZIP_DEBUG */
11331134
@@ -1198,9 +1199,10 @@
1198 = buf_block_get_page_zip(block);1199 = buf_block_get_page_zip(block);
1199 ut_a(!new_page_zip == !page_zip);1200 ut_a(!new_page_zip == !page_zip);
1200 ut_a(!new_page_zip1201 ut_a(!new_page_zip
1201 || page_zip_validate(new_page_zip, new_page));1202 || page_zip_validate(new_page_zip, new_page, index));
1202 ut_a(!page_zip1203 ut_a(!page_zip
1203 || page_zip_validate(page_zip, page_align(split_rec)));1204 || page_zip_validate(page_zip, page_align(split_rec),
1205 index));
1204 }1206 }
1205#endif /* UNIV_ZIP_DEBUG */1207#endif /* UNIV_ZIP_DEBUG */
12061208
12071209
=== modified file 'Percona-Server/storage/innodb_plugin/page/page0zip.c'
--- Percona-Server/storage/innodb_plugin/page/page0zip.c 2011-11-24 02:00:43 +0000
+++ Percona-Server/storage/innodb_plugin/page/page0zip.c 2013-01-10 04:35:33 +0000
@@ -1437,7 +1437,7 @@
1437 page_zip_get_size(page_zip) - PAGE_DATA);1437 page_zip_get_size(page_zip) - PAGE_DATA);
1438 mem_heap_free(heap);1438 mem_heap_free(heap);
1439#ifdef UNIV_ZIP_DEBUG1439#ifdef UNIV_ZIP_DEBUG
1440 ut_a(page_zip_validate(page_zip, page));1440 ut_a(page_zip_validate(page_zip, page, index));
1441#endif /* UNIV_ZIP_DEBUG */1441#endif /* UNIV_ZIP_DEBUG */
14421442
1443 if (mtr) {1443 if (mtr) {
@@ -3123,6 +3123,7 @@
3123/*==================*/3123/*==================*/
3124 const page_zip_des_t* page_zip,/*!< in: compressed page */3124 const page_zip_des_t* page_zip,/*!< in: compressed page */
3125 const page_t* page, /*!< in: uncompressed page */3125 const page_t* page, /*!< in: uncompressed page */
3126 const dict_index_t* index, /*!< in: index of the page, if known */
3126 ibool sloppy) /*!< in: FALSE=strict,3127 ibool sloppy) /*!< in: FALSE=strict,
3127 TRUE=ignore the MIN_REC_FLAG */3128 TRUE=ignore the MIN_REC_FLAG */
3128{3129{
@@ -3210,39 +3211,102 @@
3210 committed. Let us tolerate that difference when we3211 committed. Let us tolerate that difference when we
3211 are performing a sloppy validation. */3212 are performing a sloppy validation. */
32123213
3213 if (sloppy) {3214 ulint* offsets;
3214 byte info_bits_diff;3215 mem_heap_t* heap;
3215 ulint offset3216 const rec_t* rec;
3216 = rec_get_next_offs(page + PAGE_NEW_INFIMUM,3217 const rec_t* trec;
3217 TRUE);3218 byte info_bits_diff;
3218 ut_a(offset >= PAGE_NEW_SUPREMUM);3219 ulint offset
3219 offset -= 5 /* REC_NEW_INFO_BITS */;3220 = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE);
32203221 ut_a(offset >= PAGE_NEW_SUPREMUM);
3221 info_bits_diff = page[offset] ^ temp_page[offset];3222 offset -= 5/*REC_NEW_INFO_BITS*/;
32223223
3223 if (info_bits_diff == REC_INFO_MIN_REC_FLAG) {3224 info_bits_diff = page[offset] ^ temp_page[offset];
3224 temp_page[offset] = page[offset];3225
32253226 if (info_bits_diff == REC_INFO_MIN_REC_FLAG) {
3226 if (!memcmp(page + PAGE_HEADER,3227 temp_page[offset] = page[offset];
3227 temp_page + PAGE_HEADER,3228
3228 UNIV_PAGE_SIZE - PAGE_HEADER3229 if (!memcmp(page + PAGE_HEADER,
3229 - FIL_PAGE_DATA_END)) {3230 temp_page + PAGE_HEADER,
32303231 UNIV_PAGE_SIZE - PAGE_HEADER
3231 /* Only the minimum record flag3232 - FIL_PAGE_DATA_END)) {
3232 differed. Let us ignore it. */3233
3233 page_zip_fail(("page_zip_validate: "3234 /* Only the minimum record flag
3234 "min_rec_flag "3235 differed. Let us ignore it. */
3235 "(ignored, "3236 page_zip_fail(("page_zip_validate: "
3236 "%lu,%lu,0x%02lx)\n",3237 "min_rec_flag "
3237 page_get_space_id(page),3238 "(%s"
3238 page_get_page_no(page),3239 "%lu,%lu,0x%02lx)\n",
3239 (ulong) page[offset]));3240 sloppy ? "ignored, " : "",
3240 goto func_exit;3241 page_get_space_id(page),
3242 page_get_page_no(page),
3243 (ulong) page[offset]));
3244 valid = sloppy;
3245 goto func_exit;
3246 }
3247 }
3248
3249 /* Compare the pointers in the PAGE_FREE list. */
3250 rec = page_header_get_ptr(page, PAGE_FREE);
3251 trec = page_header_get_ptr(temp_page, PAGE_FREE);
3252
3253 while (rec || trec) {
3254 if (page_offset(rec) != page_offset(trec)) {
3255 page_zip_fail(("page_zip_validate: "
3256 "PAGE_FREE list: %u!=%u\n",
3257 (unsigned) page_offset(rec),
3258 (unsigned) page_offset(trec)));
3259 valid = FALSE;
3260 goto func_exit;
3261 }
3262
3263 rec = page_rec_get_next_low(rec, TRUE);
3264 trec = page_rec_get_next_low(trec, TRUE);
3265 }
3266
3267 /* Compare the records. */
3268 heap = NULL;
3269 offsets = NULL;
3270 rec = page_rec_get_next_low(
3271 page + PAGE_NEW_INFIMUM, TRUE);
3272 trec = page_rec_get_next_low(
3273 temp_page + PAGE_NEW_INFIMUM, TRUE);
3274
3275 do {
3276 if (page_offset(rec) != page_offset(trec)) {
3277 page_zip_fail(("page_zip_validate: "
3278 "record list: 0x%02x!=0x%02x\n",
3279 (unsigned) page_offset(rec),
3280 (unsigned) page_offset(trec)));
3281 valid = FALSE;
3282 break;
3283 }
3284
3285 if (index) {
3286 /* Compare the data. */
3287 offsets = rec_get_offsets(
3288 rec, index, offsets,
3289 ULINT_UNDEFINED, &heap);
3290
3291 if (memcmp(rec - rec_offs_extra_size(offsets),
3292 trec - rec_offs_extra_size(offsets),
3293 rec_offs_size(offsets))) {
3294 page_zip_fail(
3295 ("page_zip_validate: "
3296 "record content: 0x%02x",
3297 (unsigned) page_offset(rec)));
3298 valid = FALSE;
3299 break;
3241 }3300 }
3242 }3301 }
3302
3303 rec = page_rec_get_next_low(rec, TRUE);
3304 trec = page_rec_get_next_low(trec, TRUE);
3305 } while (rec || trec);
3306
3307 if (heap) {
3308 mem_heap_free(heap);
3243 }3309 }
3244 page_zip_fail(("page_zip_validate: content\n"));
3245 valid = FALSE;
3246 }3310 }
32473311
3248func_exit:3312func_exit:
@@ -3264,9 +3328,10 @@
3264page_zip_validate(3328page_zip_validate(
3265/*==============*/3329/*==============*/
3266 const page_zip_des_t* page_zip,/*!< in: compressed page */3330 const page_zip_des_t* page_zip,/*!< in: compressed page */
3267 const page_t* page) /*!< in: uncompressed page */3331 const page_t* page, /*!< in: uncompressed page */
3332 const dict_index_t* index) /*!< in: index of the page, if known */
3268{3333{
3269 return(page_zip_validate_low(page_zip, page,3334 return(page_zip_validate_low(page_zip, page, index,
3270 recv_recovery_is_on()));3335 recv_recovery_is_on()));
3271}3336}
3272#endif /* UNIV_ZIP_DEBUG */3337#endif /* UNIV_ZIP_DEBUG */
@@ -3597,7 +3662,7 @@
3597 page_zip->m_nonempty = TRUE;3662 page_zip->m_nonempty = TRUE;
35983663
3599#ifdef UNIV_ZIP_DEBUG3664#ifdef UNIV_ZIP_DEBUG
3600 ut_a(page_zip_validate(page_zip, page_align(rec)));3665 ut_a(page_zip_validate(page_zip, page_align(rec), index));
3601#endif /* UNIV_ZIP_DEBUG */3666#endif /* UNIV_ZIP_DEBUG */
3602}3667}
36033668
@@ -3644,7 +3709,7 @@
3644 }3709 }
36453710
3646#ifdef UNIV_ZIP_DEBUG3711#ifdef UNIV_ZIP_DEBUG
3647 ut_a(page_zip_validate(page_zip, page));3712 ut_a(page_zip_validate(page_zip, page, NULL));
3648#endif /* UNIV_ZIP_DEBUG */3713#endif /* UNIV_ZIP_DEBUG */
36493714
3650 memcpy(page + offset,3715 memcpy(page + offset,
@@ -3653,7 +3718,7 @@
3653 ptr + 4, BTR_EXTERN_FIELD_REF_SIZE);3718 ptr + 4, BTR_EXTERN_FIELD_REF_SIZE);
36543719
3655#ifdef UNIV_ZIP_DEBUG3720#ifdef UNIV_ZIP_DEBUG
3656 ut_a(page_zip_validate(page_zip, page));3721 ut_a(page_zip_validate(page_zip, page, NULL));
3657#endif /* UNIV_ZIP_DEBUG */3722#endif /* UNIV_ZIP_DEBUG */
3658 }3723 }
36593724
@@ -3720,7 +3785,7 @@
3720 memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE);3785 memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE);
37213786
3722#ifdef UNIV_ZIP_DEBUG3787#ifdef UNIV_ZIP_DEBUG
3723 ut_a(page_zip_validate(page_zip, page));3788 ut_a(page_zip_validate(page_zip, page, index));
3724#endif /* UNIV_ZIP_DEBUG */3789#endif /* UNIV_ZIP_DEBUG */
37253790
3726 if (mtr) {3791 if (mtr) {
@@ -3791,7 +3856,7 @@
3791 }3856 }
37923857
3793#ifdef UNIV_ZIP_DEBUG3858#ifdef UNIV_ZIP_DEBUG
3794 ut_a(page_zip_validate(page_zip, page));3859 ut_a(page_zip_validate(page_zip, page, NULL));
3795#endif /* UNIV_ZIP_DEBUG */3860#endif /* UNIV_ZIP_DEBUG */
37963861
3797 field = page + offset;3862 field = page + offset;
@@ -3812,7 +3877,7 @@
3812 memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE);3877 memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE);
38133878
3814#ifdef UNIV_ZIP_DEBUG3879#ifdef UNIV_ZIP_DEBUG
3815 ut_a(page_zip_validate(page_zip, page));3880 ut_a(page_zip_validate(page_zip, page, NULL));
3816#endif /* UNIV_ZIP_DEBUG */3881#endif /* UNIV_ZIP_DEBUG */
3817 }3882 }
38183883
@@ -4039,7 +4104,7 @@
4039 }4104 }
40404105
4041#ifdef UNIV_ZIP_DEBUG4106#ifdef UNIV_ZIP_DEBUG
4042 ut_a(page_zip_validate(page_zip, page));4107 ut_a(page_zip_validate(page_zip, page, index));
4043#endif /* UNIV_ZIP_DEBUG */4108#endif /* UNIV_ZIP_DEBUG */
4044}4109}
40454110
@@ -4063,7 +4128,7 @@
4063 *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8);4128 *slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8);
4064 }4129 }
4065#ifdef UNIV_ZIP_DEBUG4130#ifdef UNIV_ZIP_DEBUG
4066 ut_a(page_zip_validate(page_zip, page_align(rec)));4131 ut_a(page_zip_validate(page_zip, page_align(rec), NULL));
4067#endif /* UNIV_ZIP_DEBUG */4132#endif /* UNIV_ZIP_DEBUG */
4068}4133}
40694134
@@ -4364,14 +4429,14 @@
4364 goto corrupt;4429 goto corrupt;
4365 }4430 }
4366#ifdef UNIV_ZIP_DEBUG4431#ifdef UNIV_ZIP_DEBUG
4367 ut_a(page_zip_validate(page_zip, page));4432 ut_a(page_zip_validate(page_zip, page, NULL));
4368#endif /* UNIV_ZIP_DEBUG */4433#endif /* UNIV_ZIP_DEBUG */
43694434
4370 memcpy(page + offset, ptr, len);4435 memcpy(page + offset, ptr, len);
4371 memcpy(page_zip->data + offset, ptr, len);4436 memcpy(page_zip->data + offset, ptr, len);
43724437
4373#ifdef UNIV_ZIP_DEBUG4438#ifdef UNIV_ZIP_DEBUG
4374 ut_a(page_zip_validate(page_zip, page));4439 ut_a(page_zip_validate(page_zip, page, NULL));
4375#endif /* UNIV_ZIP_DEBUG */4440#endif /* UNIV_ZIP_DEBUG */
4376 }4441 }
43774442
@@ -4446,7 +4511,7 @@
4446 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));4511 ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
4447 ut_ad(page_is_comp(page));4512 ut_ad(page_is_comp(page));
4448 ut_ad(!dict_index_is_ibuf(index));4513 ut_ad(!dict_index_is_ibuf(index));
4449 /* Note that page_zip_validate(page_zip, page) may fail here. */4514 /* Note that page_zip_validate(page_zip, page, index) may fail here. */
4450 UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);4515 UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
4451 UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));4516 UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
44524517
@@ -4533,7 +4598,7 @@
4533 FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag4598 FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag
4534 mismatch. A strict page_zip_validate() will be executed later4599 mismatch. A strict page_zip_validate() will be executed later
4535 during the B-tree operations. */4600 during the B-tree operations. */
4536 ut_a(page_zip_validate_low(src_zip, src, TRUE));4601 ut_a(page_zip_validate_low(src_zip, src, index, TRUE));
4537#endif /* UNIV_ZIP_DEBUG */4602#endif /* UNIV_ZIP_DEBUG */
4538 ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip));4603 ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip));
4539 if (UNIV_UNLIKELY(src_zip->n_blobs)) {4604 if (UNIV_UNLIKELY(src_zip->n_blobs)) {
@@ -4594,7 +4659,7 @@
4594 }4659 }
45954660
4596#ifdef UNIV_ZIP_DEBUG4661#ifdef UNIV_ZIP_DEBUG
4597 ut_a(page_zip_validate(page_zip, page));4662 ut_a(page_zip_validate(page_zip, page, index));
4598#endif /* UNIV_ZIP_DEBUG */4663#endif /* UNIV_ZIP_DEBUG */
4599 btr_blob_dbg_add(page, index, "page_zip_copy_recs");4664 btr_blob_dbg_add(page, index, "page_zip_copy_recs");
46004665
46014666
=== modified file 'Percona-Server/storage/innodb_plugin/row/row0mysql.c'
--- Percona-Server/storage/innodb_plugin/row/row0mysql.c 2012-10-17 11:00:21 +0000
+++ Percona-Server/storage/innodb_plugin/row/row0mysql.c 2013-01-10 04:35:33 +0000
@@ -1792,7 +1792,8 @@
1792one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",1792one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
1793"innodb_table_monitor", then this will also start the printing of monitor1793"innodb_table_monitor", then this will also start the printing of monitor
1794output by the master thread. If the table name ends in "innodb_mem_validate",1794output by the master thread. If the table name ends in "innodb_mem_validate",
1795InnoDB will try to invoke mem_validate().1795InnoDB will try to invoke mem_validate(). On failure the transaction will
1796be rolled back and the 'table' object will be freed.
1796@return error code or DB_SUCCESS */1797@return error code or DB_SUCCESS */
1797UNIV_INTERN1798UNIV_INTERN
1798int1799int
@@ -1931,6 +1932,8 @@
19311932
1932 row_drop_table_for_mysql(table->name, trx, FALSE);1933 row_drop_table_for_mysql(table->name, trx, FALSE);
1933 trx_commit_for_mysql(trx);1934 trx_commit_for_mysql(trx);
1935 } else {
1936 dict_mem_table_free(table);
1934 }1937 }
1935 break;1938 break;
19361939
19371940
=== modified file 'Percona-Server/storage/innodb_plugin/row/row0sel.c'
--- Percona-Server/storage/innodb_plugin/row/row0sel.c 2012-04-02 02:09:15 +0000
+++ Percona-Server/storage/innodb_plugin/row/row0sel.c 2013-01-10 04:35:33 +0000
@@ -3926,6 +3926,11 @@
3926 }3926 }
39273927
3928rec_loop:3928rec_loop:
3929 if (trx_is_interrupted(trx)) {
3930 err = DB_INTERRUPTED;
3931 goto normal_return;
3932 }
3933
3929 /*-------------------------------------------------------------*/3934 /*-------------------------------------------------------------*/
3930 /* PHASE 4: Look for matching records in a loop */3935 /* PHASE 4: Look for matching records in a loop */
39313936
@@ -4860,12 +4865,16 @@
48604865
4861 rec_offs_init(offsets_);4866 rec_offs_init(offsets_);
48624867
4863 offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);4868 offsets = rec_get_offsets(rec, index, offsets, col_no + 1, &heap);
4869
4870 if (rec_offs_nth_sql_null(offsets, col_no)) {
4871 /* There is no non-NULL value in the auto-increment column. */
4872 value = 0;
4873 goto func_exit;
4874 }
48644875
4865 data = rec_get_nth_field(rec, offsets, col_no, &len);4876 data = rec_get_nth_field(rec, offsets, col_no, &len);
48664877
4867 ut_a(len != UNIV_SQL_NULL);
4868
4869 switch (mtype) {4878 switch (mtype) {
4870 case DATA_INT:4879 case DATA_INT:
4871 ut_a(len <= sizeof value);4880 ut_a(len <= sizeof value);
@@ -4886,14 +4895,15 @@
4886 ut_error;4895 ut_error;
4887 }4896 }
48884897
4889 if (UNIV_LIKELY_NULL(heap)) {
4890 mem_heap_free(heap);
4891 }
4892
4893 if (!unsigned_type && (ib_int64_t) value < 0) {4898 if (!unsigned_type && (ib_int64_t) value < 0) {
4894 value = 0;4899 value = 0;
4895 }4900 }
48964901
4902func_exit:
4903 if (UNIV_LIKELY_NULL(heap)) {
4904 mem_heap_free(heap);
4905 }
4906
4897 return(value);4907 return(value);
4898}4908}
48994909
49004910
=== modified file 'Percona-Server/storage/innodb_plugin/row/row0umod.c'
--- Percona-Server/storage/innodb_plugin/row/row0umod.c 2011-02-02 12:12:49 +0000
+++ Percona-Server/storage/innodb_plugin/row/row0umod.c 2013-01-10 04:35:33 +0000
@@ -69,36 +69,6 @@
69introduced where a call to log_free_check() is bypassed. */69introduced where a call to log_free_check() is bypassed. */
7070
71/***********************************************************//**71/***********************************************************//**
72Checks if also the previous version of the clustered index record was
73modified or inserted by the same transaction, and its undo number is such
74that it should be undone in the same rollback.
75@return TRUE if also previous modify or insert of this row should be undone */
76static
77ibool
78row_undo_mod_undo_also_prev_vers(
79/*=============================*/
80 undo_node_t* node, /*!< in: row undo node */
81 undo_no_t* undo_no)/*!< out: the undo number */
82{
83 trx_undo_rec_t* undo_rec;
84 trx_t* trx;
85
86 trx = node->trx;
87
88 if (0 != ut_dulint_cmp(node->new_trx_id, trx->id)) {
89
90 *undo_no = ut_dulint_zero;
91 return(FALSE);
92 }
93
94 undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap);
95
96 *undo_no = trx_undo_rec_get_undo_no(undo_rec);
97
98 return(ut_dulint_cmp(trx->roll_limit, *undo_no) <= 0);
99}
100
101/***********************************************************//**
102Undoes a modify in a clustered index record.72Undoes a modify in a clustered index record.
103@return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */73@return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */
104static74static
@@ -226,19 +196,11 @@
226 btr_pcur_t* pcur;196 btr_pcur_t* pcur;
227 mtr_t mtr;197 mtr_t mtr;
228 ulint err;198 ulint err;
229 ibool success;
230 ibool more_vers;
231 undo_no_t new_undo_no;
232199
233 ut_ad(node && thr);200 ut_ad(node && thr);
234201
235 log_free_check();202 log_free_check();
236203
237 /* Check if also the previous version of the clustered index record
238 should be undone in this same rollback operation */
239
240 more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no);
241
242 pcur = &(node->pcur);204 pcur = &(node->pcur);
243205
244 mtr_start(&mtr);206 mtr_start(&mtr);
@@ -286,20 +248,6 @@
286248
287 trx_undo_rec_release(node->trx, node->undo_no);249 trx_undo_rec_release(node->trx, node->undo_no);
288250
289 if (more_vers && err == DB_SUCCESS) {
290
291 /* Reserve the undo log record to the prior version after
292 committing &mtr: this is necessary to comply with the latching
293 order, as &mtr may contain the fsp latch which is lower in
294 the latch hierarchy than trx->undo_mutex. */
295
296 success = trx_undo_rec_reserve(node->trx, new_undo_no);
297
298 if (success) {
299 node->state = UNDO_NODE_PREV_VERS;
300 }
301 }
302
303 return(err);251 return(err);
304}252}
305253
@@ -799,7 +747,6 @@
799 trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,747 trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
800 roll_ptr, info_bits, trx,748 roll_ptr, info_bits, trx,
801 node->heap, &(node->update));749 node->heap, &(node->update));
802 node->new_roll_ptr = roll_ptr;
803 node->new_trx_id = trx_id;750 node->new_trx_id = trx_id;
804 node->cmpl_info = cmpl_info;751 node->cmpl_info = cmpl_info;
805}752}
806753
=== modified file 'Percona-Server/storage/innodb_plugin/row/row0undo.c'
--- Percona-Server/storage/innodb_plugin/row/row0undo.c 2010-06-29 13:00:58 +0000
+++ Percona-Server/storage/innodb_plugin/row/row0undo.c 2013-01-10 04:35:33 +0000
@@ -283,25 +283,6 @@
283 } else {283 } else {
284 node->state = UNDO_NODE_MODIFY;284 node->state = UNDO_NODE_MODIFY;
285 }285 }
286
287 } else if (node->state == UNDO_NODE_PREV_VERS) {
288
289 /* Undo should be done to the same clustered index record
290 again in this same rollback, restoring the previous version */
291
292 roll_ptr = node->new_roll_ptr;
293
294 node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr,
295 node->heap);
296 node->roll_ptr = roll_ptr;
297 node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec);
298
299 if (trx_undo_roll_ptr_is_insert(roll_ptr)) {
300
301 node->state = UNDO_NODE_INSERT;
302 } else {
303 node->state = UNDO_NODE_MODIFY;
304 }
305 }286 }
306287
307 /* Prevent DROP TABLE etc. while we are rolling back this row.288 /* Prevent DROP TABLE etc. while we are rolling back this row.
308289
=== modified file 'Percona-Server/storage/myisam/myisamchk.c'
--- Percona-Server/storage/myisam/myisamchk.c 2011-06-30 15:37:13 +0000
+++ Percona-Server/storage/myisam/myisamchk.c 2013-01-10 04:35:33 +0000
@@ -310,7 +310,14 @@
310 &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,310 &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
311 (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,311 (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
312 INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},312 INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
313 { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",313 { "sort_buffer_size", OPT_SORT_BUFFER_SIZE,
314 "Deprecated. myisam_sort_buffer_size alias is being used",
315 &check_param.sort_buffer_length,
316 &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
317 (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
318 ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
319 { "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE,
320 "Alias of sort_buffer_size parameter",
314 &check_param.sort_buffer_length,321 &check_param.sort_buffer_length,
315 &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,322 &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
316 (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),323 (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
317324
=== modified file 'Percona-Server/tests/mysql_client_test.c'
--- Percona-Server/tests/mysql_client_test.c 2012-08-20 00:29:22 +0000
+++ Percona-Server/tests/mysql_client_test.c 2013-01-10 04:35:33 +0000
@@ -15278,6 +15278,7 @@
1527815278
15279 rc= mysql_query(mysql, "set names default");15279 rc= mysql_query(mysql, "set names default");
15280 myquery(rc);15280 myquery(rc);
15281 DBUG_VOID_RETURN;
15281}15282}
1528215283
1528315284

Subscribers

People subscribed via source and target branches