Merge lp:~percona-core/percona-server/release-5.1.66-14.1 into lp:percona-server/5.1

Proposed by Ignacio Nin on 2012-10-29
Status: Merged
Approved by: Laurynas Biveinis on 2012-10-30
Approved revision: 495
Merged at revision: 514
Proposed branch: lp:~percona-core/percona-server/release-5.1.66-14.1
Merge into: lp:percona-server/5.1
Diff against target: 5112 lines (+2955/-403)
95 files modified
Makefile (+2/-2)
Percona-Server/CMakeLists.txt (+3/-0)
Percona-Server/Docs/INSTALL-BINARY (+3/-3)
Percona-Server/client/mysql.cc (+14/-6)
Percona-Server/client/mysql_upgrade.c (+2/-2)
Percona-Server/client/mysqladmin.cc (+3/-3)
Percona-Server/client/mysqlbinlog.cc (+13/-1)
Percona-Server/client/mysqlcheck.c (+2/-2)
Percona-Server/client/mysqldump.c (+1/-1)
Percona-Server/client/mysqlimport.c (+2/-2)
Percona-Server/client/mysqlshow.c (+2/-2)
Percona-Server/client/mysqlslap.c (+3/-3)
Percona-Server/client/mysqltest.cc (+1/-1)
Percona-Server/client/sql_string.h (+7/-3)
Percona-Server/configure.in (+1/-1)
Percona-Server/extra/perror.c (+3/-2)
Percona-Server/extra/yassl/src/ssl.cpp (+1/-1)
Percona-Server/extra/yassl/taocrypt/src/Makefile.am (+1/-1)
Percona-Server/extra/yassl/taocrypt/src/crypto.cpp (+0/-37)
Percona-Server/include/welcome_copyright_notice.h (+13/-8)
Percona-Server/mysql-test/Makefile.am (+1/-0)
Percona-Server/mysql-test/lib/mtr_cases.pm (+33/-0)
Percona-Server/mysql-test/r/information_schema.result (+18/-4)
Percona-Server/mysql-test/r/information_schema_db.result (+4/-1)
Percona-Server/mysql-test/r/mysqlshow.result (+8/-2)
Percona-Server/mysql-test/r/openssl_1.result (+3/-3)
Percona-Server/mysql-test/r/subselect.result (+0/-2)
Percona-Server/mysql-test/suite/federated/federated.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_archive.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_bug_13118.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_bug_25714.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_bug_35333.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_debug.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_innodb.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_server.test (+2/-2)
Percona-Server/mysql-test/suite/federated/federated_transactions.test (+2/-2)
Percona-Server/mysql-test/suite/federated/include/federated.inc (+1/-1)
Percona-Server/mysql-test/suite/funcs_1/t/is_engines_federated.test (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-zip.result (+3/-3)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb.result (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_information_schema_buffer.result (+127/-0)
Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_misc1.result (+1/-1)
Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result (+3/-0)
Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_information_schema_buffer.test (+76/-0)
Percona-Server/mysql-test/t/openssl_1.test (+6/-0)
Percona-Server/mysql-test/t/partition_federated.test (+1/-1)
Percona-Server/scripts/mysql_secure_installation.pl.in (+7/-3)
Percona-Server/scripts/mysql_secure_installation.sh (+13/-5)
Percona-Server/sql/filesort.cc (+2/-3)
Percona-Server/sql/gen_lex_hash.cc (+3/-3)
Percona-Server/sql/ha_partition.cc (+90/-43)
Percona-Server/sql/ha_partition.h (+2/-10)
Percona-Server/sql/handler.cc (+27/-2)
Percona-Server/sql/item.cc (+6/-1)
Percona-Server/sql/item_strfunc.cc (+35/-18)
Percona-Server/sql/item_subselect.cc (+1/-1)
Percona-Server/sql/log_event.h (+1/-1)
Percona-Server/sql/mysqld.cc (+1/-1)
Percona-Server/sql/share/charsets/Index.xml (+1/-1)
Percona-Server/sql/spatial.cc (+6/-5)
Percona-Server/sql/spatial.h (+8/-0)
Percona-Server/sql/sql_prepare.cc (+8/-0)
Percona-Server/sql/sql_select.cc (+9/-6)
Percona-Server/sql/sql_show.cc (+3/-2)
Percona-Server/sql/sql_string.h (+7/-3)
Percona-Server/storage/federated/ha_federated.cc (+1/-1)
Percona-Server/storage/innobase/btr/btr0pcur.c (+32/-37)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+0/-1)
Percona-Server/storage/innodb_plugin/ChangeLog (+29/-0)
Percona-Server/storage/innodb_plugin/btr/btr0btr.c (+41/-6)
Percona-Server/storage/innodb_plugin/btr/btr0cur.c (+23/-18)
Percona-Server/storage/innodb_plugin/btr/btr0pcur.c (+31/-36)
Percona-Server/storage/innodb_plugin/buf/buf0buf.c (+129/-0)
Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc (+20/-6)
Percona-Server/storage/innodb_plugin/handler/i_s.cc (+1757/-0)
Percona-Server/storage/innodb_plugin/handler/i_s.h (+3/-0)
Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c (+13/-5)
Percona-Server/storage/innodb_plugin/include/buf0buf.h (+102/-1)
Percona-Server/storage/innodb_plugin/include/buf0buf.ic (+20/-0)
Percona-Server/storage/innodb_plugin/include/fil0fil.h (+2/-0)
Percona-Server/storage/innodb_plugin/include/log0log.h (+3/-0)
Percona-Server/storage/innodb_plugin/include/univ.i (+18/-0)
Percona-Server/storage/innodb_plugin/page/page0cur.c (+1/-0)
Percona-Server/storage/innodb_plugin/page/page0page.c (+19/-12)
Percona-Server/storage/innodb_plugin/row/row0ins.c (+8/-1)
Percona-Server/storage/innodb_plugin/row/row0merge.c (+14/-0)
Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins.sql (+3/-0)
Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins_win.sql (+3/-0)
Percona-Server/support-files/mysql.spec.sh (+6/-1)
Percona-Server/vio/viosslfactories.c (+59/-41)
build/debian/rules (+1/-1)
build/percona-server.spec (+2/-6)
build/percona-shared-compat.spec (+1/-1)
To merge this branch: bzr merge lp:~percona-core/percona-server/release-5.1.66-14.1
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) 2012-10-29 Approve on 2012-10-30
Review via email: mp+131961@code.launchpad.net
To post a comment you must log in.
review: Approve
Stewart Smith (stewart) wrote :

As discussed on IRC between Alexey and myself, we're going to hold off pushing this into PS 5.1 trunk until the next MySQL 5.5 release, which will contain the MySQL changesets that are in 5.1.66 but not in 5.5.28.

496. By Ignacio Nin on 2012-11-03

Enable SSL support without YaSSL

In the fix for bug lp:1028240, --with yassl was removed from the RPM
builder script. Internal logic inside percona-server.spec led to having
the server built without SSL support at all (--without-ssl) instead of
having it built with the libcrypto functions.

This fix ensures that the server is built --with-ssl.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-08-20 03:14:02 +0000
3+++ Makefile 2012-11-08 17:45:27 +0000
4@@ -1,5 +1,5 @@
5-MYSQL_VERSION=5.1.65
6-PERCONA_SERVER_VERSION=rel14.0
7+MYSQL_VERSION=5.1.66
8+PERCONA_SERVER_VERSION=rel14.1
9 PERCONA_SERVER ?=Percona-Server-$(MYSQL_VERSION)-$(PERCONA_SERVER_VERSION)
10 PERCONA_SERVER_SHORT_1 ?=Percona-Server-$(MYSQL_VERSION)
11 PERCONA_SERVER_SHORT_2 ?=Percona-Server
12
13=== modified file 'Percona-Server/CMakeLists.txt'
14--- Percona-Server/CMakeLists.txt 2011-07-03 15:47:37 +0000
15+++ Percona-Server/CMakeLists.txt 2012-11-08 17:45:27 +0000
16@@ -310,3 +310,6 @@
17 ADD_SUBDIRECTORY(libmysqld/examples)
18 ENDIF(WITH_EMBEDDED_SERVER)
19 ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
20+IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
21+ ADD_SUBDIRECTORY(internal)
22+ENDIF()
23
24=== modified file 'Percona-Server/Docs/INSTALL-BINARY'
25--- Percona-Server/Docs/INSTALL-BINARY 2012-08-20 00:29:22 +0000
26+++ Percona-Server/Docs/INSTALL-BINARY 2012-11-08 17:45:27 +0000
27@@ -1,8 +1,8 @@
28
29-You can find information about how to install binary distributions at
30+You can find information about installing MySQL at
31
32- http://dev.mysql.com/doc/refman/5.1/en/quick-standard-installation.html
33+ http://dev.mysql.com/doc/refman/5.1/en/installing.html
34
35 The MySQL Reference Manual is also available in various formats on
36 http://dev.mysql.com/doc; if you're interested in the DocBook XML
37-sources go to http://svn.mysql.com.
38+sources go to http://dev.mysql.com/doc/index-other.html.
39
40=== modified file 'Percona-Server/client/mysql.cc'
41--- Percona-Server/client/mysql.cc 2011-11-24 16:33:30 +0000
42+++ Percona-Server/client/mysql.cc 2012-11-08 17:45:27 +0000
43@@ -1,5 +1,5 @@
44 /*
45- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
46+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
47
48 This program is free software; you can redistribute it and/or modify
49 it under the terms of the GNU General Public License as published by
50@@ -1178,7 +1178,7 @@
51 mysql_thread_id(&mysql), server_version_string(&mysql));
52 put_info((char*) glob_buffer.ptr(),INFO_INFO);
53
54- put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"), INFO_INFO);
55+ put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
56
57 #ifdef HAVE_READLINE
58 initialize_readline((char*) my_progname);
59@@ -1605,7 +1605,7 @@
60
61 if (version)
62 return;
63- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
64+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
65 printf("Usage: %s [OPTIONS] [database]\n", my_progname);
66 my_print_help(my_long_options);
67 print_defaults("my", load_default_groups);
68@@ -2858,7 +2858,7 @@
69 char *line __attribute__((unused)), char *help_arg)
70 {
71 MYSQL_ROW cur;
72- const char *server_cmd= buffer->ptr();
73+ const char *server_cmd;
74 char cmd_buf[100 + 1];
75 MYSQL_RES *result;
76 int error;
77@@ -2873,9 +2873,12 @@
78 *++end_arg= '\0';
79 }
80 (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS);
81- server_cmd= cmd_buf;
82 }
83-
84+ else
85+ (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help ", help_arg, NullS);
86+
87+ server_cmd= cmd_buf;
88+
89 if (!status.batch)
90 {
91 old_buffer= *buffer;
92@@ -2943,6 +2946,11 @@
93 else
94 {
95 put_info("\nNothing found", INFO_INFO);
96+ if (strncasecmp(server_cmd, "help 'contents'", 15) == 0)
97+ {
98+ put_info("\nPlease check if 'help tables' are loaded.\n", INFO_INFO);
99+ goto err;
100+ }
101 put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO);
102 }
103 }
104
105=== modified file 'Percona-Server/client/mysql_upgrade.c'
106--- Percona-Server/client/mysql_upgrade.c 2011-07-22 07:46:45 +0000
107+++ Percona-Server/client/mysql_upgrade.c 2012-11-08 17:45:27 +0000
108@@ -1,5 +1,5 @@
109 /*
110- Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
111+ Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
112
113 This program is free software; you can redistribute it and/or modify
114 it under the terms of the GNU General Public License as published by
115@@ -230,7 +230,7 @@
116 switch (optid) {
117
118 case '?':
119- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
120+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
121 printf("%s Ver %s Distrib %s, for %s (%s)\n",
122 my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
123 puts("MySQL utility for upgrading databases to new MySQL versions.\n");
124
125=== modified file 'Percona-Server/client/mysqladmin.cc'
126--- Percona-Server/client/mysqladmin.cc 2011-07-22 07:46:45 +0000
127+++ Percona-Server/client/mysqladmin.cc 2012-11-08 17:45:27 +0000
128@@ -1,5 +1,5 @@
129 /*
130- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
131+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
132
133 This program is free software; you can redistribute it and/or modify
134 it under the terms of the GNU General Public License as published by
135@@ -693,7 +693,7 @@
136 case ADMIN_VER:
137 new_line=1;
138 print_version();
139- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
140+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
141 printf("Server version\t\t%s\n", mysql_get_server_info(mysql));
142 printf("Protocol version\t%d\n", mysql_get_proto_info(mysql));
143 printf("Connection\t\t%s\n",mysql_get_host_info(mysql));
144@@ -1072,7 +1072,7 @@
145 static void usage(void)
146 {
147 print_version();
148- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
149+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
150 puts("Administration program for the mysqld daemon.");
151 printf("Usage: %s [OPTIONS] command command....\n", my_progname);
152 my_print_help(my_long_options);
153
154=== modified file 'Percona-Server/client/mysqlbinlog.cc'
155--- Percona-Server/client/mysqlbinlog.cc 2012-08-20 03:14:02 +0000
156+++ Percona-Server/client/mysqlbinlog.cc 2012-11-08 17:45:27 +0000
157@@ -36,6 +36,7 @@
158 #include "mysql_priv.h"
159 #include "log_event.h"
160 #include "sql_common.h"
161+#include "my_dir.h"
162 #include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
163
164 /* Needed for Rpl_filter */
165@@ -1357,7 +1358,7 @@
166 static void usage()
167 {
168 print_version();
169- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
170+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
171 printf("\
172 Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
173 the mysql command line client.\n\n");
174@@ -1897,6 +1898,7 @@
175 uchar header[BIN_LOG_HEADER_SIZE];
176 uchar buf[PROBE_HEADER_LEN];
177 my_off_t tmp_pos, pos;
178+ MY_STAT my_file_stat;
179
180 delete glob_description_event;
181 if (!(glob_description_event= new Format_description_log_event(3)))
182@@ -1907,6 +1909,16 @@
183
184 pos= my_b_tell(file);
185 DBUG_ASSERT(pos == 0);
186+
187+ /* fstat the file to check if the file is a regular file. */
188+ if (my_fstat(file->file, &my_file_stat, MYF(0)) == -1)
189+ {
190+ error("Unable to stat the file.");
191+ return ERROR_STOP;
192+ }
193+ if ((my_file_stat.st_mode & S_IFMT) == S_IFREG)
194+ my_b_seek(file, (my_off_t)0);
195+
196 if (my_b_read(file, header, sizeof(header)))
197 {
198 error("Failed reading header; probably an empty file.");
199
200=== modified file 'Percona-Server/client/mysqlcheck.c'
201--- Percona-Server/client/mysqlcheck.c 2011-07-22 07:46:45 +0000
202+++ Percona-Server/client/mysqlcheck.c 2012-11-08 17:45:27 +0000
203@@ -1,5 +1,5 @@
204 /*
205- Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
206+ Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
207
208 This program is free software; you can redistribute it and/or modify
209 it under the terms of the GNU General Public License as published by
210@@ -222,7 +222,7 @@
211 static void usage(void)
212 {
213 print_version();
214- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
215+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
216 puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
217 puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
218 puts("used at the same time. Not all options are supported by all storage engines.");
219
220=== modified file 'Percona-Server/client/mysqldump.c'
221--- Percona-Server/client/mysqldump.c 2012-08-20 03:14:02 +0000
222+++ Percona-Server/client/mysqldump.c 2012-11-08 17:45:27 +0000
223@@ -601,7 +601,7 @@
224 static void usage(void)
225 {
226 print_version();
227- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
228+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
229 puts("Dumping structure and contents of MySQL databases and tables.");
230 short_usage_sub();
231 print_defaults("my",load_default_groups);
232
233=== modified file 'Percona-Server/client/mysqlimport.c'
234--- Percona-Server/client/mysqlimport.c 2011-07-22 07:46:45 +0000
235+++ Percona-Server/client/mysqlimport.c 2012-11-08 17:45:27 +0000
236@@ -1,5 +1,5 @@
237 /*
238- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
239+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
240
241 This program is free software; you can redistribute it and/or modify
242 it under the terms of the GNU General Public License as published by
243@@ -196,7 +196,7 @@
244 static void usage(void)
245 {
246 print_version();
247- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
248+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
249 printf("\
250 Loads tables from text files in various formats. The base name of the\n\
251 text file must be the name of the table that should be used.\n\
252
253=== modified file 'Percona-Server/client/mysqlshow.c'
254--- Percona-Server/client/mysqlshow.c 2011-07-22 07:46:45 +0000
255+++ Percona-Server/client/mysqlshow.c 2012-11-08 17:45:27 +0000
256@@ -1,5 +1,5 @@
257 /*
258- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
259+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
260
261 This program is free software; you can redistribute it and/or modify
262 it under the terms of the GNU General Public License as published by
263@@ -256,7 +256,7 @@
264 static void usage(void)
265 {
266 print_version();
267- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011)"));
268+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
269 puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
270 printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
271 puts("\n\
272
273=== modified file 'Percona-Server/client/mysqlslap.c'
274--- Percona-Server/client/mysqlslap.c 2012-04-09 11:12:41 +0000
275+++ Percona-Server/client/mysqlslap.c 2012-11-08 17:45:27 +0000
276@@ -1,5 +1,5 @@
277 /*
278- Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
279+ Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
280
281 This program is free software; you can redistribute it and/or modify
282 it under the terms of the GNU General Public License as published by
283@@ -95,6 +95,7 @@
284 #include <sys/wait.h>
285 #endif
286 #include <ctype.h>
287+#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
288
289 #ifdef __WIN__
290 #define srandom srand
291@@ -691,8 +692,7 @@
292 static void usage(void)
293 {
294 print_version();
295- puts("Copyright (C) 2005 MySQL AB");
296- puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license.\n");
297+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005"));
298 puts("Run a query multiple times against the server.\n");
299 printf("Usage: %s [OPTIONS]\n",my_progname);
300 print_defaults("my",load_default_groups);
301
302=== modified file 'Percona-Server/client/mysqltest.cc'
303--- Percona-Server/client/mysqltest.cc 2012-08-20 00:29:22 +0000
304+++ Percona-Server/client/mysqltest.cc 2012-11-08 17:45:27 +0000
305@@ -6135,7 +6135,7 @@
306 void usage()
307 {
308 print_version();
309- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
310+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
311 printf("Runs a test against the mysql server and compares output with a results file.\n\n");
312 printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
313 my_print_help(my_long_options);
314
315=== modified file 'Percona-Server/client/sql_string.h'
316--- Percona-Server/client/sql_string.h 2012-02-09 15:03:59 +0000
317+++ Percona-Server/client/sql_string.h 2012-11-08 17:45:27 +0000
318@@ -1,5 +1,5 @@
319 /*
320- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
321+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
322
323 This program is free software; you can redistribute it and/or modify
324 it under the terms of the GNU General Public License as published by
325@@ -198,8 +198,12 @@
326 }
327 bool real_alloc(uint32 arg_length); // Empties old string
328 bool realloc(uint32 arg_length);
329- inline void shrink(uint32 arg_length) // Shrink buffer
330+
331+ // Shrink the buffer, but only if it is allocated on the heap.
332+ inline void shrink(uint32 arg_length)
333 {
334+ if (!is_alloced())
335+ return;
336 if (arg_length < Alloced_length)
337 {
338 char *new_ptr;
339@@ -215,7 +219,7 @@
340 }
341 }
342 }
343- bool is_alloced() { return alloced; }
344+ bool is_alloced() const { return alloced; }
345 inline String& operator = (const String &s)
346 {
347 if (&s != this)
348
349=== modified file 'Percona-Server/configure.in'
350--- Percona-Server/configure.in 2012-10-10 10:43:22 +0000
351+++ Percona-Server/configure.in 2012-11-08 17:45:27 +0000
352@@ -12,7 +12,7 @@
353 dnl When changing the major version number please also check the switch
354 dnl statement in mysqlbinlog::check_master_version(). You may also need
355 dnl to update version.c in ndb.
356-AC_INIT([MySQL Server], [5.1.65], [], [mysql])
357+AC_INIT([MySQL Server], [5.1.66], [], [mysql])
358
359 AC_CONFIG_SRCDIR([sql/mysqld.cc])
360 AC_CANONICAL_SYSTEM
361
362=== modified file 'Percona-Server/extra/perror.c'
363--- Percona-Server/extra/perror.c 2011-07-03 15:47:37 +0000
364+++ Percona-Server/extra/perror.c 2012-11-08 17:45:27 +0000
365@@ -1,5 +1,5 @@
366 /*
367- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
368+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
369
370 This program is free software; you can redistribute it and/or modify
371 it under the terms of the GNU General Public License as published by
372@@ -29,6 +29,7 @@
373 #include "../storage/ndb/src/kernel/error/ndbd_exit_codes.c"
374 #include "../storage/ndb/include/mgmapi/mgmapi_error.h"
375 #endif
376+#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
377
378 static my_bool verbose, print_all_codes;
379
380@@ -115,7 +116,7 @@
381 static void usage(void)
382 {
383 print_version();
384- puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
385+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
386 printf("Print a description for a system error code or a MySQL error code.\n");
387 printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
388 printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);
389
390=== modified file 'Percona-Server/extra/yassl/src/ssl.cpp'
391--- Percona-Server/extra/yassl/src/ssl.cpp 2012-02-13 11:40:12 +0000
392+++ Percona-Server/extra/yassl/src/ssl.cpp 2012-11-08 17:45:27 +0000
393@@ -747,7 +747,7 @@
394 int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
395 const char* path)
396 {
397- int ret = SSL_SUCCESS;
398+ int ret = SSL_FAILURE;
399 const int HALF_PATH = 128;
400
401 if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA);
402
403=== modified file 'Percona-Server/extra/yassl/taocrypt/src/Makefile.am'
404--- Percona-Server/extra/yassl/taocrypt/src/Makefile.am 2012-08-27 05:43:12 +0000
405+++ Percona-Server/extra/yassl/taocrypt/src/Makefile.am 2012-11-08 17:45:27 +0000
406@@ -21,7 +21,7 @@
407 asn.cpp bftables.cpp blowfish.cpp coding.cpp des.cpp dh.cpp \
408 dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md4.cpp md5.cpp misc.cpp \
409 random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \
410- tftables.cpp twofish.cpp crypto.cpp rabbit.cpp hc128.cpp
411+ tftables.cpp twofish.cpp rabbit.cpp hc128.cpp
412
413 libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \
414 @yassl_thread_cxxflags@ -fno-omit-frame-pointer
415
416=== removed file 'Percona-Server/extra/yassl/taocrypt/src/crypto.cpp'
417--- Percona-Server/extra/yassl/taocrypt/src/crypto.cpp 2007-08-28 08:35:55 +0000
418+++ Percona-Server/extra/yassl/taocrypt/src/crypto.cpp 1970-01-01 00:00:00 +0000
419@@ -1,37 +0,0 @@
420-/*
421- Copyright (C) 2000-2007 MySQL AB
422-
423- This program is free software; you can redistribute it and/or modify
424- it under the terms of the GNU General Public License as published by
425- the Free Software Foundation; version 2 of the License.
426-
427- This program is distributed in the hope that it will be useful,
428- but WITHOUT ANY WARRANTY; without even the implied warranty of
429- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
430- GNU General Public License for more details.
431-
432- You should have received a copy of the GNU General Public License
433- along with this program; see the file COPYING. If not, write to the
434- Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
435- MA 02110-1301 USA.
436-*/
437-
438-/* put features that other apps expect from OpenSSL type crypto */
439-
440-
441-
442-extern "C" {
443-
444- // for libcurl configure test, these are the signatures they use
445- // locking handled internally by library
446- char CRYPTO_lock() { return 0;}
447- char CRYPTO_add_lock() { return 0;}
448-
449-
450- // for openvpn, test are the signatures they use
451- char EVP_CIPHER_CTX_init() { return 0; }
452- char CRYPTO_mem_ctrl() { return 0; }
453-} // extern "C"
454-
455-
456-
457
458=== modified file 'Percona-Server/include/welcome_copyright_notice.h'
459--- Percona-Server/include/welcome_copyright_notice.h 2011-07-11 16:11:41 +0000
460+++ Percona-Server/include/welcome_copyright_notice.h 2012-11-08 17:45:27 +0000
461@@ -1,4 +1,4 @@
462-/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
463+/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
464
465 This program is free software; you can redistribute it and/or modify
466 it under the terms of the GNU General Public License as published by
467@@ -16,16 +16,21 @@
468 #ifndef _welcome_copyright_notice_h_
469 #define _welcome_copyright_notice_h_
470
471+#define COPYRIGHT_NOTICE_CURRENT_YEAR "2012"
472+
473 /*
474 This define specifies copyright notice which is displayed by every MySQL
475 program on start, or on help screen.
476 */
477-
478-#define ORACLE_WELCOME_COPYRIGHT_NOTICE(years) \
479- "Copyright (c) " years ", Oracle and/or its affiliates. All rights reserved.\n" \
480- "\n" \
481- "Oracle is a registered trademark of Oracle Corporation and/or its\n" \
482- "affiliates. Other names may be trademarks of their respective\n" \
483- "owners.\n"
484+#define ORACLE_WELCOME_COPYRIGHT_NOTICE(first_year) \
485+ (strcmp(first_year, COPYRIGHT_NOTICE_CURRENT_YEAR) ? \
486+ "Copyright (c) " first_year ", " COPYRIGHT_NOTICE_CURRENT_YEAR ", " \
487+ "Oracle and/or its affiliates. All rights reserved.\n\nOracle is a " \
488+ "registered trademark of Oracle Corporation and/or its\naffiliates. " \
489+ "Other names may be trademarks of their respective\nowners.\n" : \
490+ "Copyright (c) " first_year ", Oracle and/or its affiliates. " \
491+ "All rights reserved.\n\nOracle is a registered trademark of " \
492+ "Oracle Corporation and/or its\naffiliates. Other names may be " \
493+ "trademarks of their respective\nowners.\n")
494
495 #endif /* _welcome_copyright_notice_h_ */
496
497=== modified file 'Percona-Server/mysql-test/Makefile.am'
498--- Percona-Server/mysql-test/Makefile.am 2012-07-10 01:50:02 +0000
499+++ Percona-Server/mysql-test/Makefile.am 2012-11-08 17:45:27 +0000
500@@ -82,6 +82,7 @@
501 extra/binlog_tests/ extra/rpl_tests \
502 suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \
503 suite/federated \
504+ suite/federated/include \
505 suite/funcs_1 suite/funcs_1/bitdata \
506 suite/funcs_1/include suite/funcs_1/lib suite/funcs_1/r \
507 suite/funcs_1/t suite/funcs_1/views suite/funcs_1/cursors \
508
509=== modified file 'Percona-Server/mysql-test/lib/mtr_cases.pm'
510--- Percona-Server/mysql-test/lib/mtr_cases.pm 2012-08-20 03:14:02 +0000
511+++ Percona-Server/mysql-test/lib/mtr_cases.pm 2012-11-08 17:45:27 +0000
512@@ -980,6 +980,39 @@
513 return $tinfo;
514 }
515 }
516+ elsif ( $tinfo->{'innodb_plugin_test'} )
517+ {
518+ # This is a test that needs the innodb plugin
519+ if (!&find_innodb_plugin)
520+ {
521+ # innodb plugin is not supported, skip it
522+ $tinfo->{'skip'}= 1;
523+ $tinfo->{'comment'}= "No innodb plugin support";
524+ return $tinfo;
525+ }
526+
527+ my $sep= (IS_WINDOWS) ? ';' : ':';
528+ my $plugin_filename= basename($lib_innodb_plugin);
529+ my $plugin_list=
530+ "innodb=$plugin_filename$sep" .
531+ "innodb_trx=$plugin_filename$sep" .
532+ "innodb_locks=$plugin_filename$sep" .
533+ "innodb_lock_waits=$plugin_filename$sep" .
534+ "innodb_cmp=$plugin_filename$sep" .
535+ "innodb_cmp_reset=$plugin_filename$sep" .
536+ "innodb_cmpmem=$plugin_filename$sep" .
537+ "innodb_buffer_page=$plugin_filename$sep" .
538+ "innodb_buffer_page_lru=$plugin_filename$sep" .
539+ "innodb_buffer_pool_stats=$plugin_filename$sep" .
540+ "innodb_cmpmem_reset=$plugin_filename";
541+
542+ foreach my $k ('master_opt', 'slave_opt')
543+ {
544+ push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
545+ push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
546+ push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
547+ }
548+ }
549 else
550 {
551 push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
552
553=== modified file 'Percona-Server/mysql-test/r/information_schema.result'
554--- Percona-Server/mysql-test/r/information_schema.result 2012-08-15 14:05:13 +0000
555+++ Percona-Server/mysql-test/r/information_schema.result 2012-11-08 17:45:27 +0000
556@@ -89,7 +89,7 @@
557 INNODB_LOCK_WAITS
558 INNODB_SYS_TABLES
559 INNODB_CMP
560-INNODB_SYS_STATS
561+INNODB_BUFFER_POOL_STATS
562 INNODB_CMP_RESET
563 INNODB_CMPMEM
564 INNODB_INDEX_STATS
565@@ -97,6 +97,9 @@
566 INNODB_BUFFER_POOL_PAGES_BLOB
567 INNODB_CMPMEM_RESET
568 INNODB_LOCKS
569+INNODB_BUFFER_PAGE
570+INNODB_SYS_STATS
571+INNODB_BUFFER_PAGE_LRU
572 columns_priv
573 db
574 event
575@@ -903,12 +906,14 @@
576 VIEWS TABLE_NAME select
577 INNODB_TABLE_STATS table_name select
578 INNODB_INDEX_STATS table_name select
579+INNODB_BUFFER_PAGE TABLE_NAME select
580+INNODB_BUFFER_PAGE_LRU TABLE_NAME select
581 delete from mysql.user where user='mysqltest_4';
582 delete from mysql.db where user='mysqltest_4';
583 flush privileges;
584 SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
585 table_schema count(*)
586-information_schema 54
587+information_schema 57
588 mysql 22
589 create table t1 (i int, j int);
590 create trigger trg1 before insert on t1 for each row
591@@ -1341,7 +1346,7 @@
592 INNODB_LOCK_WAITS requesting_trx_id
593 INNODB_SYS_TABLES SCHEMA
594 INNODB_CMP page_size
595-INNODB_SYS_STATS INDEX_ID
596+INNODB_BUFFER_POOL_STATS POOL_SIZE
597 INNODB_CMP_RESET page_size
598 INNODB_CMPMEM page_size
599 INNODB_INDEX_STATS table_schema
600@@ -1349,6 +1354,9 @@
601 INNODB_BUFFER_POOL_PAGES_BLOB space_id
602 INNODB_CMPMEM_RESET page_size
603 INNODB_LOCKS lock_id
604+INNODB_BUFFER_PAGE BLOCK_ID
605+INNODB_SYS_STATS INDEX_ID
606+INNODB_BUFFER_PAGE_LRU LRU_POSITION
607 SELECT t.table_name, c1.column_name
608 FROM information_schema.tables t
609 INNER JOIN
610@@ -1410,7 +1418,7 @@
611 INNODB_LOCK_WAITS requesting_trx_id
612 INNODB_SYS_TABLES SCHEMA
613 INNODB_CMP page_size
614-INNODB_SYS_STATS INDEX_ID
615+INNODB_BUFFER_POOL_STATS POOL_SIZE
616 INNODB_CMP_RESET page_size
617 INNODB_CMPMEM page_size
618 INNODB_INDEX_STATS table_schema
619@@ -1418,6 +1426,9 @@
620 INNODB_BUFFER_POOL_PAGES_BLOB space_id
621 INNODB_CMPMEM_RESET page_size
622 INNODB_LOCKS lock_id
623+INNODB_BUFFER_PAGE BLOCK_ID
624+INNODB_SYS_STATS INDEX_ID
625+INNODB_BUFFER_PAGE_LRU LRU_POSITION
626 SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
627 MAX(table_name)
628 XTRADB_ADMIN_COMMAND
629@@ -1497,9 +1508,12 @@
630 GLOBAL_TEMPORARY_TABLES information_schema.GLOBAL_TEMPORARY_TABLES 1
631 GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1
632 INDEX_STATISTICS information_schema.INDEX_STATISTICS 1
633+INNODB_BUFFER_PAGE information_schema.INNODB_BUFFER_PAGE 1
634+INNODB_BUFFER_PAGE_LRU information_schema.INNODB_BUFFER_PAGE_LRU 1
635 INNODB_BUFFER_POOL_PAGES information_schema.INNODB_BUFFER_POOL_PAGES 1
636 INNODB_BUFFER_POOL_PAGES_BLOB information_schema.INNODB_BUFFER_POOL_PAGES_BLOB 1
637 INNODB_BUFFER_POOL_PAGES_INDEX information_schema.INNODB_BUFFER_POOL_PAGES_INDEX 1
638+INNODB_BUFFER_POOL_STATS information_schema.INNODB_BUFFER_POOL_STATS 1
639 INNODB_CHANGED_PAGES information_schema.INNODB_CHANGED_PAGES 1
640 INNODB_CMP information_schema.INNODB_CMP 1
641 INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
642
643=== modified file 'Percona-Server/mysql-test/r/information_schema_db.result'
644--- Percona-Server/mysql-test/r/information_schema_db.result 2012-08-15 14:05:13 +0000
645+++ Percona-Server/mysql-test/r/information_schema_db.result 2012-11-08 17:45:27 +0000
646@@ -51,7 +51,7 @@
647 INNODB_LOCK_WAITS
648 INNODB_SYS_TABLES
649 INNODB_CMP
650-INNODB_SYS_STATS
651+INNODB_BUFFER_POOL_STATS
652 INNODB_CMP_RESET
653 INNODB_CMPMEM
654 INNODB_INDEX_STATS
655@@ -59,6 +59,9 @@
656 INNODB_BUFFER_POOL_PAGES_BLOB
657 INNODB_CMPMEM_RESET
658 INNODB_LOCKS
659+INNODB_BUFFER_PAGE
660+INNODB_SYS_STATS
661+INNODB_BUFFER_PAGE_LRU
662 show tables from INFORMATION_SCHEMA like 'T%';
663 Tables_in_information_schema (T%)
664 TABLES
665
666=== modified file 'Percona-Server/mysql-test/r/mysqlshow.result'
667--- Percona-Server/mysql-test/r/mysqlshow.result 2012-08-15 14:05:13 +0000
668+++ Percona-Server/mysql-test/r/mysqlshow.result 2012-11-08 17:45:27 +0000
669@@ -125,7 +125,7 @@
670 | INNODB_LOCK_WAITS |
671 | INNODB_SYS_TABLES |
672 | INNODB_CMP |
673-| INNODB_SYS_STATS |
674+| INNODB_BUFFER_POOL_STATS |
675 | INNODB_CMP_RESET |
676 | INNODB_CMPMEM |
677 | INNODB_INDEX_STATS |
678@@ -133,6 +133,9 @@
679 | INNODB_BUFFER_POOL_PAGES_BLOB |
680 | INNODB_CMPMEM_RESET |
681 | INNODB_LOCKS |
682+| INNODB_BUFFER_PAGE |
683+| INNODB_SYS_STATS |
684+| INNODB_BUFFER_PAGE_LRU |
685 +---------------------------------------+
686 Database: INFORMATION_SCHEMA
687 +---------------------------------------+
688@@ -184,7 +187,7 @@
689 | INNODB_LOCK_WAITS |
690 | INNODB_SYS_TABLES |
691 | INNODB_CMP |
692-| INNODB_SYS_STATS |
693+| INNODB_BUFFER_POOL_STATS |
694 | INNODB_CMP_RESET |
695 | INNODB_CMPMEM |
696 | INNODB_INDEX_STATS |
697@@ -192,6 +195,9 @@
698 | INNODB_BUFFER_POOL_PAGES_BLOB |
699 | INNODB_CMPMEM_RESET |
700 | INNODB_LOCKS |
701+| INNODB_BUFFER_PAGE |
702+| INNODB_SYS_STATS |
703+| INNODB_BUFFER_PAGE_LRU |
704 +---------------------------------------+
705 Wildcard: inf_rmation_schema
706 +--------------------+
707
708=== modified file 'Percona-Server/mysql-test/r/openssl_1.result'
709--- Percona-Server/mysql-test/r/openssl_1.result 2010-01-29 14:54:27 +0000
710+++ Percona-Server/mysql-test/r/openssl_1.result 2012-11-08 17:45:27 +0000
711@@ -44,9 +44,9 @@
712 drop user ssl_user1@localhost, ssl_user2@localhost,
713 ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
714 drop table t1;
715-mysqltest: Could not open connection 'default': 2026 SSL connection error
716-mysqltest: Could not open connection 'default': 2026 SSL connection error
717-mysqltest: Could not open connection 'default': 2026 SSL connection error
718+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
719+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
720+mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx
721 SSL error: Unable to get private key from ''
722 mysqltest: Could not open connection 'default': 2026 SSL connection error
723 SSL error: Unable to get certificate from ''
724
725=== modified file 'Percona-Server/mysql-test/r/subselect.result'
726--- Percona-Server/mysql-test/r/subselect.result 2012-03-27 12:39:27 +0000
727+++ Percona-Server/mysql-test/r/subselect.result 2012-11-08 17:45:27 +0000
728@@ -4555,8 +4555,6 @@
729 WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
730 pk a
731 1 10
732-3 30
733-2 20
734 DROP TABLE t1,t2;
735 CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), KEY b (b));
736 INSERT INTO t1 VALUES (1,NULL), (9,NULL);
737
738=== modified file 'Percona-Server/mysql-test/suite/federated/federated.test'
739--- Percona-Server/mysql-test/suite/federated/federated.test 2010-03-05 10:51:37 +0000
740+++ Percona-Server/mysql-test/suite/federated/federated.test 2012-11-08 17:45:27 +0000
741@@ -6,7 +6,7 @@
742
743 # should work with embedded server after mysqltest is fixed
744 --source include/not_embedded.inc
745---source federated.inc
746+--source suite/federated/include/federated.inc
747
748 connection default;
749
750@@ -1999,4 +1999,4 @@
751 SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
752
753 connection default;
754-source federated_cleanup.inc;
755+source suite/federated/include/federated_cleanup.inc;
756
757=== modified file 'Percona-Server/mysql-test/suite/federated/federated_archive.test'
758--- Percona-Server/mysql-test/suite/federated/federated_archive.test 2007-12-12 17:19:24 +0000
759+++ Percona-Server/mysql-test/suite/federated/federated_archive.test 2012-11-08 17:45:27 +0000
760@@ -1,5 +1,5 @@
761 source include/have_archive.inc;
762-source federated.inc;
763+source suite/federated/include/federated.inc;
764
765
766 connection slave;
767@@ -54,5 +54,5 @@
768 DROP TABLE federated.archive_table;
769
770
771-source federated_cleanup.inc;
772+source suite/federated/include/federated_cleanup.inc;
773
774
775=== modified file 'Percona-Server/mysql-test/suite/federated/federated_bug_13118.test'
776--- Percona-Server/mysql-test/suite/federated/federated_bug_13118.test 2007-12-12 17:19:24 +0000
777+++ Percona-Server/mysql-test/suite/federated/federated_bug_13118.test 2012-11-08 17:45:27 +0000
778@@ -1,4 +1,4 @@
779-source federated.inc;
780+source suite/federated/include/federated.inc;
781
782 connection slave;
783 --disable_warnings
784@@ -37,5 +37,5 @@
785 DROP TABLE federated.bug_13118_table;
786
787
788-source federated_cleanup.inc;
789+source suite/federated/include/federated_cleanup.inc;
790
791
792=== modified file 'Percona-Server/mysql-test/suite/federated/federated_bug_25714.test'
793--- Percona-Server/mysql-test/suite/federated/federated_bug_25714.test 2009-02-02 11:36:03 +0000
794+++ Percona-Server/mysql-test/suite/federated/federated_bug_25714.test 2012-11-08 17:45:27 +0000
795@@ -4,7 +4,7 @@
796 skip Need bug25714 test program;
797 }
798
799-source federated.inc;
800+source suite/federated/include/federated.inc;
801
802 connection master;
803 # Disable concurrent inserts to avoid test failures when reading
804@@ -59,4 +59,4 @@
805
806
807
808-source federated_cleanup.inc;
809+source suite/federated/include/federated_cleanup.inc;
810
811=== modified file 'Percona-Server/mysql-test/suite/federated/federated_bug_35333.test'
812--- Percona-Server/mysql-test/suite/federated/federated_bug_35333.test 2010-11-30 04:46:43 +0000
813+++ Percona-Server/mysql-test/suite/federated/federated_bug_35333.test 2012-11-08 17:45:27 +0000
814@@ -9,7 +9,7 @@
815 --echo # to complete while still indicating a problem. This fix applies to any non-fatal system
816 --echo # error that occurs during a query against I_S.TABLES.de
817
818---source federated.inc
819+--source suite/federated/include/federated.inc
820
821 --disable_warnings
822 CREATE DATABASE IF NOT EXISTS realdb;
823@@ -71,4 +71,4 @@
824 DROP DATABASE realdb;
825 --enable_warnings
826
827---source federated_cleanup.inc
828+--source suite/federated/include/federated_cleanup.inc
829
830=== modified file 'Percona-Server/mysql-test/suite/federated/federated_debug.test'
831--- Percona-Server/mysql-test/suite/federated/federated_debug.test 2009-09-30 22:25:06 +0000
832+++ Percona-Server/mysql-test/suite/federated/federated_debug.test 2012-11-08 17:45:27 +0000
833@@ -1,5 +1,5 @@
834 --source include/have_debug.inc
835---source federated.inc
836+--source suite/federated/include/federated.inc
837
838 --echo #
839 --echo # Bug#47525: MySQL crashed (Federated)
840@@ -36,4 +36,4 @@
841
842 connection default;
843 --echo # Federated cleanup
844-source federated_cleanup.inc;
845+source suite/federated/include/federated_cleanup.inc;
846
847=== modified file 'Percona-Server/mysql-test/suite/federated/federated_innodb.test'
848--- Percona-Server/mysql-test/suite/federated/federated_innodb.test 2008-12-13 19:42:12 +0000
849+++ Percona-Server/mysql-test/suite/federated/federated_innodb.test 2012-11-08 17:45:27 +0000
850@@ -4,7 +4,7 @@
851 # See Bug #40645 Test main.federated_innodb does not always clean up after itself
852
853 source include/have_innodb.inc;
854-source federated.inc;
855+source suite/federated/include/federated.inc;
856
857 #
858 # Bug#25513 Federated transaction failures
859@@ -36,4 +36,4 @@
860 drop table federated.t1;
861
862
863-source federated_cleanup.inc;
864+source suite/federated/include/federated_cleanup.inc;
865
866=== modified file 'Percona-Server/mysql-test/suite/federated/federated_server.test'
867--- Percona-Server/mysql-test/suite/federated/federated_server.test 2012-04-02 02:09:15 +0000
868+++ Percona-Server/mysql-test/suite/federated/federated_server.test 2012-11-08 17:45:27 +0000
869@@ -1,6 +1,6 @@
870 # WL #3031 This test tests the new servers table as well as
871 # if federated can utilise the servers table
872--- source federated.inc
873+-- source suite/federated/include/federated.inc
874
875 connection slave;
876 create database first_db;
877@@ -333,4 +333,4 @@
878 drop server if exists s;
879
880
881-source federated_cleanup.inc;
882+source suite/federated/include/federated_cleanup.inc;
883
884=== modified file 'Percona-Server/mysql-test/suite/federated/federated_transactions.test'
885--- Percona-Server/mysql-test/suite/federated/federated_transactions.test 2007-12-12 17:19:24 +0000
886+++ Percona-Server/mysql-test/suite/federated/federated_transactions.test 2012-11-08 17:45:27 +0000
887@@ -1,5 +1,5 @@
888 source include/have_innodb.inc;
889-source federated.inc;
890+source suite/federated/include/federated.inc;
891
892 connection slave;
893 DROP TABLE IF EXISTS federated.t1;
894@@ -35,4 +35,4 @@
895 SELECT * FROM federated.t1;
896 DELETE FROM federated.t1;
897
898-source federated_cleanup.inc;
899+source suite/federated/include/federated_cleanup.inc;
900
901=== added directory 'Percona-Server/mysql-test/suite/federated/include'
902=== renamed file 'Percona-Server/mysql-test/suite/federated/federated.inc' => 'Percona-Server/mysql-test/suite/federated/include/federated.inc'
903--- Percona-Server/mysql-test/suite/federated/federated.inc 2009-02-02 11:36:03 +0000
904+++ Percona-Server/mysql-test/suite/federated/include/federated.inc 2012-11-08 17:45:27 +0000
905@@ -1,5 +1,5 @@
906 --source include/not_embedded.inc
907---source have_federated_db.inc
908+--source suite/federated/include/have_federated_db.inc
909
910 connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
911 connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
912
913=== renamed file 'Percona-Server/mysql-test/suite/federated/federated_cleanup.inc' => 'Percona-Server/mysql-test/suite/federated/include/federated_cleanup.inc'
914=== renamed file 'Percona-Server/mysql-test/suite/federated/have_federated_db.inc' => 'Percona-Server/mysql-test/suite/federated/include/have_federated_db.inc'
915=== modified file 'Percona-Server/mysql-test/suite/funcs_1/t/is_engines_federated.test'
916--- Percona-Server/mysql-test/suite/funcs_1/t/is_engines_federated.test 2009-01-31 19:22:59 +0000
917+++ Percona-Server/mysql-test/suite/funcs_1/t/is_engines_federated.test 2012-11-08 17:45:27 +0000
918@@ -9,7 +9,7 @@
919 #
920
921 let $engine_type= FEDERATED;
922---source suite/federated/have_federated_db.inc
923+--source suite/federated/include/have_federated_db.inc
924 --vertical_results
925 eval SELECT * FROM information_schema.engines
926 WHERE ENGINE = '$engine_type';
927
928=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result'
929--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result 2012-02-02 11:38:32 +0000
930+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-index.result 2012-11-08 17:45:27 +0000
931@@ -1096,7 +1096,7 @@
932 INSERT INTO bug12547647 VALUES (5,repeat('khdfo5AlOq',1900),repeat('g',7731));
933 COMMIT;
934 UPDATE bug12547647 SET c = REPEAT('b',16928);
935-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
936+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
937 DROP TABLE bug12547647;
938 SET @r=REPEAT('a',500);
939 CREATE TABLE t1(a INT,
940
941=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-zip.result'
942--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-zip.result 2011-08-08 08:22:18 +0000
943+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb-zip.result 2012-11-08 17:45:27 +0000
944@@ -125,12 +125,12 @@
945 c TEXT NOT NULL, d TEXT NOT NULL,
946 PRIMARY KEY (c(767),d(767)))
947 ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
948-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
949+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
950 CREATE TABLE t1(
951 c TEXT NOT NULL, d TEXT NOT NULL,
952 PRIMARY KEY (c(767),d(767)))
953 ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
954-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
955+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
956 CREATE TABLE t1(
957 c TEXT NOT NULL, d TEXT NOT NULL,
958 PRIMARY KEY (c(767),d(767)))
959@@ -138,7 +138,7 @@
960 drop table t1;
961 CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
962 ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
963-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
964+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
965 CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
966 ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
967 INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
968
969=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb.result'
970--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb.result 2011-12-13 08:56:12 +0000
971+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb.result 2012-11-08 17:45:27 +0000
972@@ -3151,7 +3151,7 @@
973 c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
974 c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
975 ) ENGINE = InnoDB;
976-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
977+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
978 DROP TABLE IF EXISTS t1;
979 Warnings:
980 Note 1051 Unknown table 't1'
981
982=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result'
983--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result 2011-09-27 10:56:05 +0000
984+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result 2012-11-08 17:45:27 +0000
985@@ -8,7 +8,7 @@
986 SHOW WARNINGS;
987 Level Code Message
988 Error 139 Too big row
989-Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
990+Error 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
991 Error 1030 Got error 139 from storage engine
992 DROP TABLE bug53591;
993 SET GLOBAL innodb_file_format=Antelope;
994
995=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_information_schema_buffer.result'
996--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_information_schema_buffer.result 1970-01-01 00:00:00 +0000
997+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_information_schema_buffer.result 2012-11-08 17:45:27 +0000
998@@ -0,0 +1,127 @@
999+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
1000+SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
1001+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
1002+SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
1003+CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB;
1004+INSERT INTO infoschema_buffer_test VALUES(9);
1005+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1006+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1007+WHERE TABLE_NAME like "%infoschema_buffer_test"
1008+ and PAGE_STATE="file_page" and PAGE_TYPE="index";
1009+TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
1010+test/infoschema_buffer_test GEN_CLUST_INDEX 1 29 FILE_PAGE INDEX
1011+INSERT INTO infoschema_buffer_test VALUES(19);
1012+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1013+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1014+WHERE TABLE_NAME like "%infoschema_buffer_test"
1015+and PAGE_STATE="file_page" and PAGE_TYPE="index";
1016+TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
1017+test/infoschema_buffer_test GEN_CLUST_INDEX 2 58 FILE_PAGE INDEX
1018+CREATE INDEX idx ON infoschema_buffer_test(col1);
1019+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1020+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1021+WHERE TABLE_NAME like "%infoschema_buffer_test"
1022+and PAGE_STATE="file_page" and INDEX_NAME = "idx" and PAGE_TYPE="index";
1023+TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
1024+test/infoschema_buffer_test idx 2 32 FILE_PAGE INDEX
1025+DROP TABLE infoschema_buffer_test;
1026+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1027+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1028+WHERE TABLE_NAME like "%infoschema_buffer_test";
1029+TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
1030+CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id))
1031+ENGINE=INNODB;
1032+CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id),
1033+FOREIGN KEY (parent_id)
1034+REFERENCES infoschema_parent(id)
1035+ON DELETE CASCADE)
1036+ENGINE=INNODB;
1037+SELECT count(*)
1038+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1039+WHERE TABLE_NAME like "%infoschema_child" and PAGE_STATE="file_page"
1040+and PAGE_TYPE="index";
1041+count(*)
1042+2
1043+DROP TABLE infoschema_child;
1044+DROP TABLE infoschema_parent;
1045+show create table information_schema.innodb_buffer_page;
1046+Table Create Table
1047+INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
1048+ `BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT '0',
1049+ `SPACE` bigint(21) unsigned NOT NULL DEFAULT '0',
1050+ `PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT '0',
1051+ `PAGE_TYPE` varchar(64) DEFAULT NULL,
1052+ `FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT '0',
1053+ `FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT '0',
1054+ `IS_HASHED` varchar(3) DEFAULT NULL,
1055+ `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
1056+ `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
1057+ `ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT '0',
1058+ `TABLE_NAME` varchar(1024) DEFAULT NULL,
1059+ `INDEX_NAME` varchar(1024) DEFAULT NULL,
1060+ `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT '0',
1061+ `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
1062+ `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
1063+ `PAGE_STATE` varchar(64) DEFAULT NULL,
1064+ `IO_FIX` varchar(64) DEFAULT NULL,
1065+ `IS_OLD` varchar(3) DEFAULT NULL,
1066+ `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT '0'
1067+) ENGINE=MEMORY DEFAULT CHARSET=utf8
1068+show create table information_schema.innodb_buffer_page_lru;
1069+Table Create Table
1070+INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
1071+ `LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT '0',
1072+ `SPACE` bigint(21) unsigned NOT NULL DEFAULT '0',
1073+ `PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT '0',
1074+ `PAGE_TYPE` varchar(64) DEFAULT NULL,
1075+ `FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT '0',
1076+ `FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT '0',
1077+ `IS_HASHED` varchar(3) DEFAULT NULL,
1078+ `NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
1079+ `OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
1080+ `ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT '0',
1081+ `TABLE_NAME` varchar(1024) DEFAULT NULL,
1082+ `INDEX_NAME` varchar(1024) DEFAULT NULL,
1083+ `NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT '0',
1084+ `DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
1085+ `COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
1086+ `COMPRESSED` varchar(3) DEFAULT NULL,
1087+ `IO_FIX` varchar(64) DEFAULT NULL,
1088+ `IS_OLD` varchar(3) DEFAULT NULL,
1089+ `FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT '0'
1090+) ENGINE=MEMORY DEFAULT CHARSET=utf8
1091+show create table information_schema.innodb_buffer_pool_stats;
1092+Table Create Table
1093+INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` (
1094+ `POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
1095+ `FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT '0',
1096+ `DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
1097+ `OLD_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
1098+ `MODIFIED_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
1099+ `PENDING_DECOMPRESS` bigint(21) unsigned NOT NULL DEFAULT '0',
1100+ `PENDING_READS` bigint(21) unsigned NOT NULL DEFAULT '0',
1101+ `PENDING_FLUSH_LRU` bigint(21) unsigned NOT NULL DEFAULT '0',
1102+ `PENDING_FLUSH_LIST` bigint(21) unsigned NOT NULL DEFAULT '0',
1103+ `PAGES_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT '0',
1104+ `PAGES_NOT_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT '0',
1105+ `PAGES_MADE_YOUNG_RATE` double NOT NULL DEFAULT '0',
1106+ `PAGES_MADE_NOT_YOUNG_RATE` double NOT NULL DEFAULT '0',
1107+ `NUMBER_PAGES_READ` bigint(21) unsigned NOT NULL DEFAULT '0',
1108+ `NUMBER_PAGES_CREATED` bigint(21) unsigned NOT NULL DEFAULT '0',
1109+ `NUMBER_PAGES_WRITTEN` bigint(21) unsigned NOT NULL DEFAULT '0',
1110+ `PAGES_READ_RATE` double NOT NULL DEFAULT '0',
1111+ `PAGES_CREATE_RATE` double NOT NULL DEFAULT '0',
1112+ `PAGES_WRITTEN_RATE` double NOT NULL DEFAULT '0',
1113+ `NUMBER_PAGES_GET` bigint(21) unsigned NOT NULL DEFAULT '0',
1114+ `HIT_RATE` bigint(21) unsigned NOT NULL DEFAULT '0',
1115+ `YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT '0',
1116+ `NOT_YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT '0',
1117+ `NUMBER_PAGES_READ_AHEAD` bigint(21) unsigned NOT NULL DEFAULT '0',
1118+ `NUMBER_READ_AHEAD_EVICTED` bigint(21) unsigned NOT NULL DEFAULT '0',
1119+ `READ_AHEAD_RATE` double NOT NULL DEFAULT '0',
1120+ `READ_AHEAD_EVICTED_RATE` double NOT NULL DEFAULT '0',
1121+ `LRU_IO_TOTAL` bigint(21) unsigned NOT NULL DEFAULT '0',
1122+ `LRU_IO_CURRENT` bigint(21) unsigned NOT NULL DEFAULT '0',
1123+ `UNCOMPRESS_TOTAL` bigint(21) unsigned NOT NULL DEFAULT '0',
1124+ `UNCOMPRESS_CURRENT` bigint(21) unsigned NOT NULL DEFAULT '0'
1125+) ENGINE=MEMORY DEFAULT CHARSET=utf8
1126
1127=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_misc1.result'
1128--- Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_misc1.result 2011-10-26 06:38:28 +0000
1129+++ Percona-Server/mysql-test/suite/innodb_plugin/r/innodb_misc1.result 2012-11-08 17:45:27 +0000
1130@@ -774,7 +774,7 @@
1131 c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
1132 c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
1133 ) ENGINE = InnoDB;
1134-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
1135+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
1136 SET innodb_strict_mode=OFF;
1137 DROP TABLE IF EXISTS t1;
1138 Warnings:
1139
1140=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result'
1141--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result 2012-08-15 14:05:13 +0000
1142+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_skip_innodb_i_s.result 2012-11-08 17:45:27 +0000
1143@@ -1,8 +1,11 @@
1144 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='INFORMATION_SCHEMA' AND TABLE_NAME LIKE 'INNODB%' ORDER BY TABLE_NAME;
1145 TABLE_NAME
1146+INNODB_BUFFER_PAGE
1147+INNODB_BUFFER_PAGE_LRU
1148 INNODB_BUFFER_POOL_PAGES
1149 INNODB_BUFFER_POOL_PAGES_BLOB
1150 INNODB_BUFFER_POOL_PAGES_INDEX
1151+INNODB_BUFFER_POOL_STATS
1152 INNODB_CHANGED_PAGES
1153 INNODB_CMP
1154 INNODB_CMPMEM
1155
1156=== added file 'Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_information_schema_buffer.test'
1157--- Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_information_schema_buffer.test 1970-01-01 00:00:00 +0000
1158+++ Percona-Server/mysql-test/suite/innodb_plugin/t/innodb_information_schema_buffer.test 2012-11-08 17:45:27 +0000
1159@@ -0,0 +1,76 @@
1160+# Exercise the code path for INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS
1161+# and INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1162+
1163+-- source include/have_innodb_plugin.inc
1164+
1165+-- disable_result_log
1166+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
1167+
1168+# How many buffer pools we have
1169+SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
1170+
1171+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
1172+
1173+# This gives the over all buffer pool size
1174+SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
1175+
1176+-- enable_result_log
1177+
1178+# Create a table and check its page info behave correctly in the pool
1179+CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB;
1180+
1181+INSERT INTO infoschema_buffer_test VALUES(9);
1182+
1183+# We should be able to see this table in the buffer pool if we check
1184+# right away
1185+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1186+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1187+WHERE TABLE_NAME like "%infoschema_buffer_test"
1188+ and PAGE_STATE="file_page" and PAGE_TYPE="index";
1189+
1190+# The NUMBER_RECORDS and DATA_SIZE should check with each insertion
1191+INSERT INTO infoschema_buffer_test VALUES(19);
1192+
1193+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1194+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1195+WHERE TABLE_NAME like "%infoschema_buffer_test"
1196+and PAGE_STATE="file_page" and PAGE_TYPE="index";
1197+
1198+CREATE INDEX idx ON infoschema_buffer_test(col1);
1199+
1200+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1201+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1202+WHERE TABLE_NAME like "%infoschema_buffer_test"
1203+and PAGE_STATE="file_page" and INDEX_NAME = "idx" and PAGE_TYPE="index";
1204+
1205+
1206+# Check the buffer after dropping the table
1207+DROP TABLE infoschema_buffer_test;
1208+
1209+SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
1210+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1211+WHERE TABLE_NAME like "%infoschema_buffer_test";
1212+
1213+# Do one more test
1214+#--replace_regex /'*[0-9]*'/'NUM'/
1215+CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id))
1216+ENGINE=INNODB;
1217+
1218+CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id),
1219+ FOREIGN KEY (parent_id)
1220+ REFERENCES infoschema_parent(id)
1221+ ON DELETE CASCADE)
1222+ENGINE=INNODB;
1223+
1224+SELECT count(*)
1225+FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
1226+WHERE TABLE_NAME like "%infoschema_child" and PAGE_STATE="file_page"
1227+and PAGE_TYPE="index";
1228+
1229+DROP TABLE infoschema_child;
1230+DROP TABLE infoschema_parent;
1231+
1232+show create table information_schema.innodb_buffer_page;
1233+show create table information_schema.innodb_buffer_page_lru;
1234+show create table information_schema.innodb_buffer_pool_stats;
1235+
1236
1237=== modified file 'Percona-Server/mysql-test/t/openssl_1.test'
1238--- Percona-Server/mysql-test/t/openssl_1.test 2010-01-29 14:54:27 +0000
1239+++ Percona-Server/mysql-test/t/openssl_1.test 2012-11-08 17:45:27 +0000
1240@@ -73,22 +73,28 @@
1241 # a different cacert
1242 #
1243 --exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql
1244+--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
1245 --error 1
1246 --exec $MYSQL_TEST --ssl-ca=$MYSQL_TEST_DIR/std_data/untrusted-cacert.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
1247+--echo
1248
1249 #
1250 # Test that we can't open connection to server if we are using
1251 # a blank ca
1252 #
1253+--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
1254 --error 1
1255 --exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
1256+--echo
1257
1258 #
1259 # Test that we can't open connection to server if we are using
1260 # a nonexistent ca file
1261 #
1262+--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
1263 --error 1
1264 --exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
1265+--echo
1266
1267 #
1268 # Test that we can't open connection to server if we are using
1269
1270=== modified file 'Percona-Server/mysql-test/t/partition_federated.test'
1271--- Percona-Server/mysql-test/t/partition_federated.test 2007-12-12 17:19:24 +0000
1272+++ Percona-Server/mysql-test/t/partition_federated.test 2012-11-08 17:45:27 +0000
1273@@ -3,7 +3,7 @@
1274 #
1275 -- source include/have_partition.inc
1276 -- source include/not_embedded.inc
1277--- source suite/federated/have_federated_db.inc
1278+-- source suite/federated/include/have_federated_db.inc
1279
1280 --disable_warnings
1281 drop table if exists t1;
1282
1283=== modified file 'Percona-Server/scripts/mysql_secure_installation.pl.in'
1284--- Percona-Server/scripts/mysql_secure_installation.pl.in 2011-06-30 15:37:13 +0000
1285+++ Percona-Server/scripts/mysql_secure_installation.pl.in 2012-11-08 17:45:27 +0000
1286@@ -1,7 +1,7 @@
1287 #!/usr/bin/perl
1288 # -*- cperl -*-
1289 #
1290-# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
1291+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
1292 #
1293 # This program is free software; you can redistribute it and/or modify
1294 # it under the terms of the GNU General Public License as published by
1295@@ -28,7 +28,7 @@
1296 my $rootpass = "";
1297
1298
1299-$SIG{QUIT} = $SIG{INT} = sub {
1300+$SIG{QUIT} = $SIG{INT} = $SIG{TERM} = $SIG{ABRT} = $SIG{HUP} = sub {
1301 print "\nAborting!\n\n";
1302 echo_on();
1303 cleanup();
1304@@ -242,7 +242,11 @@
1305 }
1306
1307 sub cleanup {
1308- unlink($config,$command);
1309+ print "Cleaning up...\n";
1310+
1311+ foreach my $file ($config, $command) {
1312+ unlink $file or warn "Warning: Could not unlink $file: $!\n";
1313+ }
1314 }
1315
1316
1317
1318=== modified file 'Percona-Server/scripts/mysql_secure_installation.sh'
1319--- Percona-Server/scripts/mysql_secure_installation.sh 2011-06-30 15:37:13 +0000
1320+++ Percona-Server/scripts/mysql_secure_installation.sh 2012-11-08 17:45:27 +0000
1321@@ -1,6 +1,6 @@
1322 #!/bin/sh
1323
1324-# Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
1325+# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
1326 #
1327 # This program is free software; you can redistribute it and/or modify
1328 # it under the terms of the GNU General Public License as published by
1329@@ -19,7 +19,7 @@
1330 command=".mysql.$$"
1331 mysql_client=""
1332
1333-trap "interrupt" 2
1334+trap "interrupt" 1 2 3 6 15
1335
1336 rootpass=""
1337 echo_n=
1338@@ -139,13 +139,16 @@
1339 if [ $? -eq 0 ]; then
1340 echo "Password updated successfully!"
1341 echo "Reloading privilege tables.."
1342- reload_privilege_tables || exit 1
1343+ reload_privilege_tables
1344+ if [ $? -eq 1 ]; then
1345+ clean_and_exit
1346+ fi
1347 echo
1348 rootpass=$password1
1349 make_config
1350 else
1351 echo "Password update failed!"
1352- exit 1
1353+ clean_and_exit
1354 fi
1355
1356 return 0
1357@@ -157,7 +160,7 @@
1358 echo " ... Success!"
1359 else
1360 echo " ... Failed!"
1361- exit 1
1362+ clean_and_exit
1363 fi
1364
1365 return 0
1366@@ -217,6 +220,11 @@
1367 rm -f $config $command
1368 }
1369
1370+# Remove the files before exiting.
1371+clean_and_exit() {
1372+ cleanup
1373+ exit 1
1374+}
1375
1376 # The actual script starts here
1377
1378
1379=== modified file 'Percona-Server/sql/filesort.cc'
1380--- Percona-Server/sql/filesort.cc 2012-04-02 02:09:15 +0000
1381+++ Percona-Server/sql/filesort.cc 2012-11-08 17:45:27 +0000
1382@@ -1,5 +1,5 @@
1383 /*
1384- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
1385+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
1386
1387 This program is free software; you can redistribute it and/or modify
1388 it under the terms of the GNU General Public License as published by
1389@@ -298,8 +298,7 @@
1390 Use also the space previously used by string pointers in sort_buffer
1391 for temporary key storage.
1392 */
1393- param.keys=((param.keys*(param.rec_length+sizeof(char*))) /
1394- param.rec_length-1);
1395+ param.keys= table_sort.sort_keys_size / param.rec_length;
1396 maxbuffer--; // Offset from 0
1397 if (merge_many_buff(&param,(uchar*) sort_keys,buffpek,&maxbuffer,
1398 &tempfile))
1399
1400=== modified file 'Percona-Server/sql/gen_lex_hash.cc'
1401--- Percona-Server/sql/gen_lex_hash.cc 2011-07-22 07:46:45 +0000
1402+++ Percona-Server/sql/gen_lex_hash.cc 2012-11-08 17:45:27 +0000
1403@@ -1,5 +1,5 @@
1404 /*
1405- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
1406+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
1407
1408 This program is free software; you can redistribute it and/or modify
1409 it under the terms of the GNU General Public License as published by
1410@@ -350,7 +350,7 @@
1411 my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
1412 if (version)
1413 return;
1414- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
1415+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
1416 puts("This program generates a perfect hashing function for the sql_lex.cc");
1417 printf("Usage: %s [OPTIONS]\n\n", my_progname);
1418 my_print_help(my_long_options);
1419@@ -453,7 +453,7 @@
1420 printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
1421
1422 puts("/*");
1423- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
1424+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
1425 puts("*/");
1426
1427 /* Broken up to indicate that it's not advice to you, gentle reader. */
1428
1429=== modified file 'Percona-Server/sql/ha_partition.cc'
1430--- Percona-Server/sql/ha_partition.cc 2012-02-29 19:51:38 +0000
1431+++ Percona-Server/sql/ha_partition.cc 2012-11-08 17:45:27 +0000
1432@@ -320,7 +320,7 @@
1433 for (i= 0; i < m_tot_parts; i++)
1434 delete m_file[i];
1435 }
1436- my_free((char*) m_ordered_rec_buffer, MYF(MY_ALLOW_ZERO_PTR));
1437+ destroy_record_priority_queue();
1438
1439 clear_handler_file();
1440 DBUG_VOID_RETURN;
1441@@ -2594,7 +2594,6 @@
1442 {
1443 char *name_buffer_ptr;
1444 int error= HA_ERR_INITIALIZATION;
1445- uint alloc_len;
1446 handler **file;
1447 char name_buff[FN_REFLEN];
1448 bool is_not_tmp_table= (table_share->tmp_table == NO_TMP_TABLE);
1449@@ -2612,32 +2611,6 @@
1450 m_start_key.length= 0;
1451 m_rec0= table->record[0];
1452 m_rec_length= table_share->reclength;
1453- alloc_len= m_tot_parts * (m_rec_length + PARTITION_BYTES_IN_POS);
1454- alloc_len+= table_share->max_key_length;
1455- if (!m_ordered_rec_buffer)
1456- {
1457- if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
1458- {
1459- DBUG_RETURN(error);
1460- }
1461- {
1462- /*
1463- We set-up one record per partition and each record has 2 bytes in
1464- front where the partition id is written. This is used by ordered
1465- index_read.
1466- We also set-up a reference to the first record for temporary use in
1467- setting up the scan.
1468- */
1469- char *ptr= (char*)m_ordered_rec_buffer;
1470- uint i= 0;
1471- do
1472- {
1473- int2store(ptr, i);
1474- ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
1475- } while (++i < m_tot_parts);
1476- m_start_key.key= (const uchar*)ptr;
1477- }
1478- }
1479
1480 /* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
1481 if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
1482@@ -2657,7 +2630,7 @@
1483
1484 if (m_is_clone_of)
1485 {
1486- uint i;
1487+ uint i, alloc_len;
1488 DBUG_ASSERT(m_clone_mem_root);
1489 /* Allocate an array of handler pointers for the partitions handlers. */
1490 alloc_len= (m_tot_parts + 1) * sizeof(handler*);
1491@@ -2733,12 +2706,6 @@
1492 being opened once.
1493 */
1494 clear_handler_file();
1495- /*
1496- Initialize priority queue, initialized to reading forward.
1497- */
1498- if ((error= init_queue(&m_queue, m_tot_parts, (uint) PARTITION_BYTES_IN_POS,
1499- 0, key_rec_cmp, (void*)this)))
1500- goto err_handler;
1501
1502 /*
1503 Use table_share->ha_data to share auto_increment_value among all handlers
1504@@ -2861,7 +2828,7 @@
1505 DBUG_ENTER("ha_partition::close");
1506
1507 DBUG_ASSERT(table->s == table_share);
1508- delete_queue(&m_queue);
1509+ destroy_record_priority_queue();
1510 bitmap_free(&m_bulk_insert_started);
1511 if (!m_is_clone_of)
1512 bitmap_free(&(m_part_info->used_partitions));
1513@@ -4073,6 +4040,78 @@
1514 subset of the partitions are used, then only use those partitions.
1515 */
1516
1517+
1518+/**
1519+ Setup the ordered record buffer and the priority queue.
1520+*/
1521+
1522+bool ha_partition::init_record_priority_queue()
1523+{
1524+ DBUG_ENTER("ha_partition::init_record_priority_queue");
1525+ DBUG_ASSERT(!m_ordered_rec_buffer);
1526+ /*
1527+ Initialize the ordered record buffer.
1528+ */
1529+ if (!m_ordered_rec_buffer)
1530+ {
1531+ uint alloc_len;
1532+ uint used_parts= bitmap_bits_set(&m_part_info->used_partitions);
1533+ /* Allocate record buffer for each used partition. */
1534+ alloc_len= used_parts * (m_rec_length + PARTITION_BYTES_IN_POS);
1535+ /* Allocate a key for temporary use when setting up the scan. */
1536+ alloc_len+= table_share->max_key_length;
1537+
1538+ if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
1539+ DBUG_RETURN(true);
1540+
1541+ /*
1542+ We set-up one record per partition and each record has 2 bytes in
1543+ front where the partition id is written. This is used by ordered
1544+ index_read.
1545+ We also set-up a reference to the first record for temporary use in
1546+ setting up the scan.
1547+ */
1548+ char *ptr= (char*) m_ordered_rec_buffer;
1549+ uint16 i= 0;
1550+ do
1551+ {
1552+ if (bitmap_is_set(&m_part_info->used_partitions, i))
1553+ {
1554+ int2store(ptr, i);
1555+ ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
1556+ }
1557+ } while (++i < m_tot_parts);
1558+ m_start_key.key= (const uchar*)ptr;
1559+ /* Initialize priority queue, initialized to reading forward. */
1560+ if (init_queue(&m_queue, used_parts, (uint) PARTITION_BYTES_IN_POS,
1561+ 0, key_rec_cmp, (void*)m_curr_key_info))
1562+ {
1563+ my_free(m_ordered_rec_buffer, MYF(0));
1564+ m_ordered_rec_buffer= NULL;
1565+ DBUG_RETURN(true);
1566+ }
1567+ }
1568+ DBUG_RETURN(false);
1569+}
1570+
1571+
1572+/**
1573+ Destroy the ordered record buffer and the priority queue.
1574+*/
1575+
1576+void ha_partition::destroy_record_priority_queue()
1577+{
1578+ DBUG_ENTER("ha_partition::destroy_record_priority_queue");
1579+ if (m_ordered_rec_buffer)
1580+ {
1581+ delete_queue(&m_queue);
1582+ my_free(m_ordered_rec_buffer, MYF(0));
1583+ m_ordered_rec_buffer= NULL;
1584+ }
1585+ DBUG_VOID_RETURN;
1586+}
1587+
1588+
1589 /*
1590 Initialize handler before start of index scan
1591
1592@@ -4114,6 +4153,10 @@
1593 }
1594 else
1595 m_curr_key_info[1]= NULL;
1596+
1597+ if (init_record_priority_queue())
1598+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
1599+
1600 /*
1601 Some handlers only read fields as specified by the bitmap for the
1602 read set. For partitioned handlers we always require that the
1603@@ -4188,11 +4231,11 @@
1604 do
1605 {
1606 int tmp;
1607- /* TODO RONM: Change to index_end() when code is stable */
1608 if (bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
1609 if ((tmp= (*file)->ha_index_end()))
1610 error= tmp;
1611 } while (*(++file));
1612+ destroy_record_priority_queue();
1613 DBUG_RETURN(error);
1614 }
1615
1616@@ -4932,6 +4975,7 @@
1617 uint i;
1618 uint j= 0;
1619 bool found= FALSE;
1620+ uchar *part_rec_buf_ptr= m_ordered_rec_buffer;
1621 DBUG_ENTER("ha_partition::handle_ordered_index_scan");
1622
1623 m_top_entry= NO_CURRENT_PART_ID;
1624@@ -4942,7 +4986,7 @@
1625 {
1626 if (!(bitmap_is_set(&(m_part_info->used_partitions), i)))
1627 continue;
1628- uchar *rec_buf_ptr= rec_buf(i);
1629+ uchar *rec_buf_ptr= part_rec_buf_ptr + PARTITION_BYTES_IN_POS;
1630 int error;
1631 handler *file= m_file[i];
1632
1633@@ -4989,12 +5033,13 @@
1634 /*
1635 Initialize queue without order first, simply insert
1636 */
1637- queue_element(&m_queue, j++)= (uchar*)queue_buf(i);
1638+ queue_element(&m_queue, j++)= part_rec_buf_ptr;
1639 }
1640 else if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
1641 {
1642 DBUG_RETURN(error);
1643 }
1644+ part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
1645 }
1646 if (found)
1647 {
1648@@ -5057,18 +5102,19 @@
1649 {
1650 int error;
1651 uint part_id= m_top_entry;
1652+ uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS;
1653 handler *file= m_file[part_id];
1654 DBUG_ENTER("ha_partition::handle_ordered_next");
1655
1656 if (m_index_scan_type == partition_read_range)
1657 {
1658 error= file->read_range_next();
1659- memcpy(rec_buf(part_id), table->record[0], m_rec_length);
1660+ memcpy(rec_buf, table->record[0], m_rec_length);
1661 }
1662 else if (!is_next_same)
1663- error= file->index_next(rec_buf(part_id));
1664+ error= file->index_next(rec_buf);
1665 else
1666- error= file->index_next_same(rec_buf(part_id), m_start_key.key,
1667+ error= file->index_next_same(rec_buf, m_start_key.key,
1668 m_start_key.length);
1669 if (error)
1670 {
1671@@ -5111,10 +5157,11 @@
1672 {
1673 int error;
1674 uint part_id= m_top_entry;
1675+ uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS;
1676 handler *file= m_file[part_id];
1677 DBUG_ENTER("ha_partition::handle_ordered_prev");
1678
1679- if ((error= file->index_prev(rec_buf(part_id))))
1680+ if ((error= file->index_prev(rec_buf)))
1681 {
1682 if (error == HA_ERR_END_OF_FILE)
1683 {
1684
1685=== modified file 'Percona-Server/sql/ha_partition.h'
1686--- Percona-Server/sql/ha_partition.h 2012-02-29 19:51:38 +0000
1687+++ Percona-Server/sql/ha_partition.h 2012-11-08 17:45:27 +0000
1688@@ -517,21 +517,13 @@
1689 virtual int read_range_next();
1690
1691 private:
1692+ bool init_record_priority_queue();
1693+ void destroy_record_priority_queue();
1694 int common_index_read(uchar * buf, bool have_start_key);
1695 int common_first_last(uchar * buf);
1696 int partition_scan_set_up(uchar * buf, bool idx_read_flag);
1697 int handle_unordered_next(uchar * buf, bool next_same);
1698 int handle_unordered_scan_next_partition(uchar * buf);
1699- uchar *queue_buf(uint part_id)
1700- {
1701- return (m_ordered_rec_buffer +
1702- (part_id * (m_rec_length + PARTITION_BYTES_IN_POS)));
1703- }
1704- uchar *rec_buf(uint part_id)
1705- {
1706- return (queue_buf(part_id) +
1707- PARTITION_BYTES_IN_POS);
1708- }
1709 int handle_ordered_index_scan(uchar * buf, bool reverse_order);
1710 int handle_ordered_next(uchar * buf, bool next_same);
1711 int handle_ordered_prev(uchar * buf);
1712
1713=== modified file 'Percona-Server/sql/handler.cc'
1714--- Percona-Server/sql/handler.cc 2012-08-20 03:14:02 +0000
1715+++ Percona-Server/sql/handler.cc 2012-11-08 17:45:27 +0000
1716@@ -4400,7 +4400,19 @@
1717 ? HA_ERR_END_OF_FILE
1718 : result);
1719
1720- DBUG_RETURN (compare_key(end_range) <= 0 ? 0 : HA_ERR_END_OF_FILE);
1721+ if (compare_key(end_range) <= 0)
1722+ {
1723+ DBUG_RETURN(0);
1724+ }
1725+ else
1726+ {
1727+ /*
1728+ The last read row does not fall in the range. So request
1729+ storage engine to release row lock if possible.
1730+ */
1731+ unlock_row();
1732+ DBUG_RETURN(HA_ERR_END_OF_FILE);
1733+ }
1734 }
1735
1736
1737@@ -4432,7 +4444,20 @@
1738 result= index_next(table->record[0]);
1739 if (result)
1740 DBUG_RETURN(result);
1741- DBUG_RETURN(compare_key(end_range) <= 0 ? 0 : HA_ERR_END_OF_FILE);
1742+
1743+ if (compare_key(end_range) <= 0)
1744+ {
1745+ DBUG_RETURN(0);
1746+ }
1747+ else
1748+ {
1749+ /*
1750+ The last read row does not fall in the range. So request
1751+ storage engine to release row lock if possible.
1752+ */
1753+ unlock_row();
1754+ DBUG_RETURN(HA_ERR_END_OF_FILE);
1755+ }
1756 }
1757
1758
1759
1760=== modified file 'Percona-Server/sql/item.cc'
1761--- Percona-Server/sql/item.cc 2012-08-20 00:29:22 +0000
1762+++ Percona-Server/sql/item.cc 2012-11-08 17:45:27 +0000
1763@@ -6010,7 +6010,12 @@
1764 if (from_field != not_found_field)
1765 {
1766 Item_field* fld;
1767- if (!(fld= new Item_field(thd, last_checked_context, from_field)))
1768+ Query_arena backup, *arena;
1769+ arena= thd->activate_stmt_arena_if_needed(&backup);
1770+ fld= new Item_field(thd, last_checked_context, from_field);
1771+ if (arena)
1772+ thd->restore_active_arena(arena, &backup);
1773+ if (!fld)
1774 goto error;
1775 thd->change_item_tree(reference, fld);
1776 mark_as_dependent(thd, last_checked_context->select_lex,
1777
1778=== modified file 'Percona-Server/sql/item_strfunc.cc'
1779--- Percona-Server/sql/item_strfunc.cc 2012-02-15 16:21:38 +0000
1780+++ Percona-Server/sql/item_strfunc.cc 2012-11-08 17:45:27 +0000
1781@@ -3047,23 +3047,21 @@
1782 String* Item_func_export_set::val_str(String* str)
1783 {
1784 DBUG_ASSERT(fixed == 1);
1785- ulonglong the_set = (ulonglong) args[0]->val_int();
1786- String yes_buf, *yes;
1787- yes = args[1]->val_str(&yes_buf);
1788- String no_buf, *no;
1789- no = args[2]->val_str(&no_buf);
1790- String *sep = NULL, sep_buf ;
1791+ String yes_buf, no_buf, sep_buf;
1792+ const ulonglong the_set = (ulonglong) args[0]->val_int();
1793+ const String *yes= args[1]->val_str(&yes_buf);
1794+ const String *no= args[2]->val_str(&no_buf);
1795+ const String *sep= NULL;
1796
1797 uint num_set_values = 64;
1798- ulonglong mask = 0x1;
1799 str->length(0);
1800 str->set_charset(collation.collation);
1801
1802 /* Check if some argument is a NULL value */
1803 if (args[0]->null_value || args[1]->null_value || args[2]->null_value)
1804 {
1805- null_value=1;
1806- return 0;
1807+ null_value= true;
1808+ return NULL;
1809 }
1810 /*
1811 Arg count can only be 3, 4 or 5 here. This is guaranteed from the
1812@@ -3076,37 +3074,56 @@
1813 num_set_values=64;
1814 if (args[4]->null_value)
1815 {
1816- null_value=1;
1817- return 0;
1818+ null_value= true;
1819+ return NULL;
1820 }
1821 /* Fall through */
1822 case 4:
1823 if (!(sep = args[3]->val_str(&sep_buf))) // Only true if NULL
1824 {
1825- null_value=1;
1826- return 0;
1827+ null_value= true;
1828+ return NULL;
1829 }
1830 break;
1831 case 3:
1832 {
1833 /* errors is not checked - assume "," can always be converted */
1834 uint errors;
1835- sep_buf.copy(STRING_WITH_LEN(","), &my_charset_bin, collation.collation, &errors);
1836+ sep_buf.copy(STRING_WITH_LEN(","), &my_charset_bin,
1837+ collation.collation, &errors);
1838 sep = &sep_buf;
1839 }
1840 break;
1841 default:
1842 DBUG_ASSERT(0); // cannot happen
1843 }
1844- null_value=0;
1845-
1846- for (uint i = 0; i < num_set_values; i++, mask = (mask << 1))
1847+ null_value= false;
1848+
1849+ const ulong max_allowed_packet= current_thd->variables.max_allowed_packet;
1850+ const uint num_separators= num_set_values > 0 ? num_set_values - 1 : 0;
1851+ const ulonglong max_total_length=
1852+ num_set_values * max(yes->length(), no->length()) +
1853+ num_separators * sep->length();
1854+
1855+ if (unlikely(max_total_length > max_allowed_packet))
1856+ {
1857+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1858+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
1859+ ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED),
1860+ func_name(), max_allowed_packet);
1861+ null_value= true;
1862+ return NULL;
1863+ }
1864+
1865+ uint ix;
1866+ ulonglong mask;
1867+ for (ix= 0, mask=0x1; ix < num_set_values; ++ix, mask = (mask << 1))
1868 {
1869 if (the_set & mask)
1870 str->append(*yes);
1871 else
1872 str->append(*no);
1873- if (i != num_set_values - 1)
1874+ if (ix != num_separators)
1875 str->append(*sep);
1876 }
1877 return str;
1878
1879=== modified file 'Percona-Server/sql/item_subselect.cc'
1880--- Percona-Server/sql/item_subselect.cc 2012-04-10 11:21:57 +0000
1881+++ Percona-Server/sql/item_subselect.cc 2012-11-08 17:45:27 +0000
1882@@ -1135,7 +1135,7 @@
1883 }
1884 else
1885 {
1886- Item *item= (Item*) select_lex->item_list.head();
1887+ Item *item= (Item*) select_lex->item_list.head()->real_item();
1888
1889 if (select_lex->table_list.elements)
1890 {
1891
1892=== modified file 'Percona-Server/sql/log_event.h'
1893--- Percona-Server/sql/log_event.h 2012-08-20 03:14:02 +0000
1894+++ Percona-Server/sql/log_event.h 2012-11-08 17:45:27 +0000
1895@@ -2505,7 +2505,7 @@
1896 User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
1897 char *val_arg, ulong val_len_arg, Item_result type_arg,
1898 uint charset_number_arg)
1899- :Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
1900+ :Log_event(thd_arg,0,0), name(name_arg), name_len(name_len_arg), val(val_arg),
1901 val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
1902 deferred(false)
1903 { is_null= !val; }
1904
1905=== modified file 'Percona-Server/sql/mysqld.cc'
1906--- Percona-Server/sql/mysqld.cc 2012-09-05 22:27:47 +0000
1907+++ Percona-Server/sql/mysqld.cc 2012-11-08 17:45:27 +0000
1908@@ -8028,7 +8028,7 @@
1909 if (!default_collation_name)
1910 default_collation_name= (char*) default_charset_info->name;
1911 print_version();
1912- puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
1913+ puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
1914 puts("Starts the MySQL database server.\n");
1915 printf("Usage: %s [OPTIONS]\n", my_progname);
1916 if (!opt_verbose)
1917
1918=== modified file 'Percona-Server/sql/share/charsets/Index.xml'
1919--- Percona-Server/sql/share/charsets/Index.xml 2006-12-23 19:20:40 +0000
1920+++ Percona-Server/sql/share/charsets/Index.xml 2012-11-08 17:45:27 +0000
1921@@ -3,7 +3,7 @@
1922 <charsets max-id="99">
1923
1924 <copyright>
1925- Copyright (C) 2003 MySQL AB
1926+ Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
1927
1928 This program is free software; you can redistribute it and/or modify
1929 it under the terms of the GNU General Public License as published by
1930
1931=== modified file 'Percona-Server/sql/spatial.cc'
1932--- Percona-Server/sql/spatial.cc 2012-03-05 17:58:07 +0000
1933+++ Percona-Server/sql/spatial.cc 2012-11-08 17:45:27 +0000
1934@@ -525,12 +525,13 @@
1935 const char *wkb_end;
1936 Gis_point p;
1937
1938- if (len < 4)
1939+ if (len < 4 ||
1940+ (n_points= wkb_get_uint(wkb, bo)) < 1 ||
1941+ n_points > max_n_points)
1942 return 0;
1943- n_points= wkb_get_uint(wkb, bo);
1944 proper_length= 4 + n_points * POINT_DATA_SIZE;
1945
1946- if (!n_points || len < proper_length || res->reserve(proper_length))
1947+ if (len < proper_length || res->reserve(proper_length))
1948 return 0;
1949
1950 res->q_append(n_points);
1951@@ -1072,9 +1073,9 @@
1952 Gis_point p;
1953 const char *wkb_end;
1954
1955- if (len < 4)
1956+ if (len < 4 ||
1957+ (n_points= wkb_get_uint(wkb, bo)) > max_n_points)
1958 return 0;
1959- n_points= wkb_get_uint(wkb, bo);
1960 proper_size= 4 + n_points * (WKB_HEADER_SIZE + POINT_DATA_SIZE);
1961
1962 if (len < proper_size || res->reserve(proper_size))
1963
1964=== modified file 'Percona-Server/sql/spatial.h'
1965--- Percona-Server/sql/spatial.h 2011-06-30 15:37:13 +0000
1966+++ Percona-Server/sql/spatial.h 2012-11-08 17:45:27 +0000
1967@@ -379,6 +379,10 @@
1968
1969 class Gis_line_string: public Geometry
1970 {
1971+ // Maximum number of points in LineString that can fit into String
1972+ static const uint32 max_n_points=
1973+ (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
1974+ POINT_DATA_SIZE;
1975 public:
1976 Gis_line_string() {} /* Remove gcc warning */
1977 virtual ~Gis_line_string() {} /* Remove gcc warning */
1978@@ -435,6 +439,10 @@
1979
1980 class Gis_multi_point: public Geometry
1981 {
1982+ // Maximum number of points in MultiPoint that can fit into String
1983+ static const uint32 max_n_points=
1984+ (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
1985+ (WKB_HEADER_SIZE + POINT_DATA_SIZE);
1986 public:
1987 Gis_multi_point() {} /* Remove gcc warning */
1988 virtual ~Gis_multi_point() {} /* Remove gcc warning */
1989
1990=== modified file 'Percona-Server/sql/sql_prepare.cc'
1991--- Percona-Server/sql/sql_prepare.cc 2012-08-20 03:14:02 +0000
1992+++ Percona-Server/sql/sql_prepare.cc 2012-11-08 17:45:27 +0000
1993@@ -788,6 +788,14 @@
1994 param->set_param_func(param, &read_pos, (uint) (data_end - read_pos));
1995 if (param->state == Item_param::NO_VALUE)
1996 DBUG_RETURN(1);
1997+
1998+ if (param->limit_clause_param && param->item_type != Item::INT_ITEM)
1999+ {
2000+ param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS);
2001+ param->item_type= Item::INT_ITEM;
2002+ if (!param->unsigned_flag && param->value.integer < 0)
2003+ DBUG_RETURN(1);
2004+ }
2005 }
2006 }
2007 /*
2008
2009=== modified file 'Percona-Server/sql/sql_select.cc'
2010--- Percona-Server/sql/sql_select.cc 2012-08-20 03:14:02 +0000
2011+++ Percona-Server/sql/sql_select.cc 2012-11-08 17:45:27 +0000
2012@@ -551,8 +551,6 @@
2013
2014 if (having)
2015 {
2016- Query_arena backup, *arena;
2017- arena= thd->activate_stmt_arena_if_needed(&backup);
2018 nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
2019 thd->where="having clause";
2020 thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level;
2021@@ -562,8 +560,6 @@
2022 having->check_cols(1)));
2023 select_lex->having_fix_field= 0;
2024 select_lex->having= having;
2025- if (arena)
2026- thd->restore_active_arena(arena, &backup);
2027
2028 if (having_fix_rc || thd->is_error())
2029 DBUG_RETURN(-1); /* purecov: inspected */
2030@@ -1505,12 +1501,19 @@
2031 DBUG_RETURN(1);
2032 }
2033 }
2034-
2035+ /*
2036+ Calculate a possible 'limit' of table rows for 'GROUP BY': 'need_tmp'
2037+ implies that there will be more postprocessing so the specified
2038+ 'limit' should not be enforced yet in the call to
2039+ 'test_if_skip_sort_order'.
2040+ */
2041+ const ha_rows limit = need_tmp ? HA_POS_ERROR : unit->select_limit_cnt;
2042+
2043 if (!(select_options & SELECT_BIG_RESULT) &&
2044 ((group_list &&
2045 (!simple_group ||
2046 !test_if_skip_sort_order(&join_tab[const_tables], group_list,
2047- unit->select_limit_cnt, 0,
2048+ limit, 0,
2049 &join_tab[const_tables].table->
2050 keys_in_use_for_group_by))) ||
2051 select_distinct) &&
2052
2053=== modified file 'Percona-Server/sql/sql_show.cc'
2054--- Percona-Server/sql/sql_show.cc 2012-08-20 03:14:02 +0000
2055+++ Percona-Server/sql/sql_show.cc 2012-11-08 17:45:27 +0000
2056@@ -3489,8 +3489,9 @@
2057 /* Restore original LEX value, statement's arena and THD arena values. */
2058 lex_end(thd->lex);
2059
2060- if (i_s_arena.free_list)
2061- i_s_arena.free_items();
2062+ // Free items, before restoring backup_arena below.
2063+ DBUG_ASSERT(i_s_arena.free_list == NULL);
2064+ thd->free_items();
2065
2066 /*
2067 For safety reset list of open temporary tables before closing
2068
2069=== modified file 'Percona-Server/sql/sql_string.h'
2070--- Percona-Server/sql/sql_string.h 2012-02-09 15:03:59 +0000
2071+++ Percona-Server/sql/sql_string.h 2012-11-08 17:45:27 +0000
2072@@ -2,7 +2,7 @@
2073 #define MYSQL_SQL_STRING_H_INCLUDED
2074
2075 /*
2076- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
2077+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
2078
2079 This program is free software; you can redistribute it and/or modify
2080 it under the terms of the GNU General Public License as published by
2081@@ -232,8 +232,12 @@
2082 }
2083 bool real_alloc(uint32 arg_length); // Empties old string
2084 bool realloc(uint32 arg_length);
2085- inline void shrink(uint32 arg_length) // Shrink buffer
2086+
2087+ // Shrink the buffer, but only if it is allocated on the heap.
2088+ inline void shrink(uint32 arg_length)
2089 {
2090+ if (!is_alloced())
2091+ return;
2092 if (arg_length < Alloced_length)
2093 {
2094 char *new_ptr;
2095@@ -249,7 +253,7 @@
2096 }
2097 }
2098 }
2099- bool is_alloced() { return alloced; }
2100+ bool is_alloced() const { return alloced; }
2101 inline String& operator = (const String &s)
2102 {
2103 if (&s != this)
2104
2105=== modified file 'Percona-Server/storage/federated/ha_federated.cc'
2106--- Percona-Server/storage/federated/ha_federated.cc 2012-04-02 04:58:41 +0000
2107+++ Percona-Server/storage/federated/ha_federated.cc 2012-11-08 17:45:27 +0000
2108@@ -1364,7 +1364,7 @@
2109 break;
2110 }
2111 DBUG_PRINT("info", ("federated HA_READ_AFTER_KEY %d", i));
2112- if (store_length >= length) /* end key */
2113+ if ((store_length >= length) || (i > 0)) /* for all parts of end key*/
2114 {
2115 if (emit_key_part_name(&tmp, key_part))
2116 goto err;
2117
2118=== modified file 'Percona-Server/storage/innobase/btr/btr0pcur.c'
2119--- Percona-Server/storage/innobase/btr/btr0pcur.c 2012-03-08 15:10:10 +0000
2120+++ Percona-Server/storage/innobase/btr/btr0pcur.c 2012-11-08 17:45:27 +0000
2121@@ -312,45 +312,40 @@
2122 /* Restore the old search mode */
2123 cursor->search_mode = old_mode;
2124
2125- if (btr_pcur_is_on_user_rec(cursor, mtr)) {
2126- switch (cursor->rel_pos) {
2127- case BTR_PCUR_ON:
2128- if (!cmp_dtuple_rec(
2129- tuple, btr_pcur_get_rec(cursor),
2130- rec_get_offsets(btr_pcur_get_rec(cursor),
2131- index, NULL,
2132- ULINT_UNDEFINED, &heap))) {
2133-
2134- /* We have to store the NEW value for
2135- the modify clock, since the cursor can
2136- now be on a different page! But we can
2137- retain the value of old_rec */
2138-
2139- cursor->block_when_stored =
2140- buf_block_align(
2141- btr_pcur_get_page(cursor));
2142- cursor->modify_clock =
2143- buf_block_get_modify_clock(
2144- cursor->block_when_stored);
2145- cursor->old_stored = BTR_PCUR_OLD_STORED;
2146-
2147- mem_heap_free(heap);
2148-
2149- return(TRUE);
2150- }
2151-
2152- break;
2153- case BTR_PCUR_BEFORE:
2154- page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
2155- break;
2156- case BTR_PCUR_AFTER:
2157- page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
2158- break;
2159+ switch (cursor->rel_pos) {
2160+ case BTR_PCUR_ON:
2161+ if (btr_pcur_is_on_user_rec(cursor, mtr)
2162+ && !cmp_dtuple_rec(
2163+ tuple, btr_pcur_get_rec(cursor),
2164+ rec_get_offsets(btr_pcur_get_rec(cursor),
2165+ index, NULL,
2166+ ULINT_UNDEFINED, &heap))) {
2167+
2168+ /* We have to store the NEW value for
2169+ the modify clock, since the cursor can
2170+ now be on a different page! But we can
2171+ retain the value of old_rec */
2172+
2173+ cursor->block_when_stored =
2174+ buf_block_align(
2175+ btr_pcur_get_page(cursor));
2176+ cursor->modify_clock =
2177+ buf_block_get_modify_clock(
2178+ cursor->block_when_stored);
2179+ cursor->old_stored = BTR_PCUR_OLD_STORED;
2180+
2181+ mem_heap_free(heap);
2182+
2183+ return(TRUE);
2184+ }
2185 #ifdef UNIV_DEBUG
2186- default:
2187- ut_error;
2188+ /* fall through */
2189+ case BTR_PCUR_BEFORE:
2190+ case BTR_PCUR_AFTER:
2191+ break;
2192+ default:
2193+ ut_error;
2194 #endif /* UNIV_DEBUG */
2195- }
2196 }
2197
2198 mem_heap_free(heap);
2199
2200=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
2201--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-08-20 03:14:02 +0000
2202+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-11-08 17:45:27 +0000
2203@@ -6389,7 +6389,6 @@
2204 void* heap2;
2205
2206 DBUG_ENTER("records_in_range");
2207- DBUG_ASSERT(min_key || max_key);
2208
2209 ut_a(prebuilt->trx == thd_to_trx(ha_thd()));
2210
2211
2212=== modified file 'Percona-Server/storage/innodb_plugin/ChangeLog'
2213--- Percona-Server/storage/innodb_plugin/ChangeLog 2012-03-21 12:53:09 +0000
2214+++ Percona-Server/storage/innodb_plugin/ChangeLog 2012-11-08 17:45:27 +0000
2215@@ -1,3 +1,32 @@
2216+2012-08-29 The InnoDB Team
2217+
2218+ * btr/btr0btr.c, page/page0cur.c, page/page0page.c:
2219+ Fix Bug#14554000 CRASH IN PAGE_REC_GET_NTH_CONST(NTH=0)
2220+ DURING COMPRESSED PAGE SPLIT
2221+
2222+2012-08-16 The InnoDB Team
2223+
2224+ * btr/btr0cur.c:
2225+ Fix Bug#12595091 POSSIBLY INVALID ASSERTION IN
2226+ BTR_CUR_PESSIMISTIC_UPDATE()
2227+
2228+2012-08-16 The InnoDB Team
2229+
2230+ * btr/btr0btr.c, btr/btr0cur.c:
2231+ Fix Bug#12845774 OPTIMISTIC INSERT/UPDATE USES WRONG HEURISTICS FOR
2232+ COMPRESSED PAGE SIZE
2233+
2234+2012-08-16 The InnoDB Team
2235+
2236+ * btr/btr0cur.c, page/page0page.c:
2237+ Fix Bug#13523839 ASSERTION FAILURES ON COMPRESSED INNODB TABLES
2238+
2239+2012-08-07 The InnoDB Team
2240+
2241+ * btr/btr0pcur.c, row/row0merge.c:
2242+ Fix Bug#14399148 INNODB TABLES UNDER LOAD PRODUCE DUPLICATE COPIES
2243+ OF ROWS IN QUERIES
2244+
2245 2012-03-15 The InnoDB Team
2246
2247 * fil/fil0fil.c, ibuf/ibuf0ibuf.c, include/fil0fil.h,
2248
2249=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0btr.c'
2250--- Percona-Server/storage/innodb_plugin/btr/btr0btr.c 2012-09-14 12:19:29 +0000
2251+++ Percona-Server/storage/innodb_plugin/btr/btr0btr.c 2012-11-08 17:45:27 +0000
2252@@ -1869,6 +1869,7 @@
2253 root = btr_cur_get_page(cursor);
2254 root_block = btr_cur_get_block(cursor);
2255 root_page_zip = buf_block_get_page_zip(root_block);
2256+ ut_ad(page_get_n_recs(root) > 0);
2257 #ifdef UNIV_ZIP_DEBUG
2258 ut_a(!root_page_zip || page_zip_validate(root_page_zip, root));
2259 #endif /* UNIV_ZIP_DEBUG */
2260@@ -2349,12 +2350,20 @@
2261 BTR_CONT_MODIFY_TREE,
2262 &cursor, 0, file, line, mtr);
2263
2264- err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
2265- | BTR_KEEP_SYS_FLAG
2266- | BTR_NO_UNDO_LOG_FLAG,
2267- &cursor, tuple, &rec,
2268- &dummy_big_rec, 0, NULL, mtr);
2269- ut_a(err == DB_SUCCESS);
2270+ ut_ad(cursor.flag == BTR_CUR_BINARY);
2271+
2272+ err = btr_cur_optimistic_insert(
2273+ BTR_NO_LOCKING_FLAG | BTR_KEEP_SYS_FLAG
2274+ | BTR_NO_UNDO_LOG_FLAG, &cursor, tuple, &rec,
2275+ &dummy_big_rec, 0, NULL, mtr);
2276+
2277+ if (err == DB_FAIL) {
2278+ err = btr_cur_pessimistic_insert(
2279+ BTR_NO_LOCKING_FLAG | BTR_KEEP_SYS_FLAG
2280+ | BTR_NO_UNDO_LOG_FLAG,
2281+ &cursor, tuple, &rec, &dummy_big_rec, 0, NULL, mtr);
2282+ ut_a(err == DB_SUCCESS);
2283+ }
2284 }
2285
2286 /**************************************************************//**
2287@@ -3279,6 +3288,7 @@
2288
2289 if (adjust) {
2290 nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor));
2291+ ut_ad(nth_rec > 0);
2292 }
2293
2294 /* Decide the page to which we try to merge and which will inherit
2295@@ -3514,6 +3524,7 @@
2296 mem_heap_free(heap);
2297
2298 if (adjust) {
2299+ ut_ad(nth_rec > 0);
2300 btr_cur_position(
2301 index,
2302 page_rec_get_nth(merge_block->frame, nth_rec),
2303@@ -4026,8 +4037,22 @@
2304 {
2305 page_cur_t cur;
2306 ibool ret = TRUE;
2307+#ifndef DBUG_OFF
2308+ ulint nth = 1;
2309+#endif /* !DBUG_OFF */
2310
2311 page_cur_set_before_first(block, &cur);
2312+
2313+ /* Directory slot 0 should only contain the infimum record. */
2314+ DBUG_EXECUTE_IF("check_table_rec_next",
2315+ ut_a(page_rec_get_nth_const(
2316+ page_cur_get_page(&cur), 0)
2317+ == cur.rec);
2318+ ut_a(page_dir_slot_get_n_owned(
2319+ page_dir_get_nth_slot(
2320+ page_cur_get_page(&cur), 0))
2321+ == 1););
2322+
2323 page_cur_move_to_next(&cur);
2324
2325 for (;;) {
2326@@ -4041,6 +4066,16 @@
2327 return(FALSE);
2328 }
2329
2330+ /* Verify that page_rec_get_nth_const() is correctly
2331+ retrieving each record. */
2332+ DBUG_EXECUTE_IF("check_table_rec_next",
2333+ ut_a(cur.rec == page_rec_get_nth_const(
2334+ page_cur_get_page(&cur),
2335+ page_rec_get_n_recs_before(
2336+ cur.rec)));
2337+ ut_a(nth++ == page_rec_get_n_recs_before(
2338+ cur.rec)););
2339+
2340 page_cur_move_to_next(&cur);
2341 }
2342
2343
2344=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0cur.c'
2345--- Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2012-08-20 03:14:02 +0000
2346+++ Percona-Server/storage/innodb_plugin/btr/btr0cur.c 2012-11-08 17:45:27 +0000
2347@@ -1307,7 +1307,12 @@
2348
2349 if (UNIV_UNLIKELY(reorg)) {
2350 ut_a(zip_size);
2351- ut_a(*rec);
2352+ /* It's possible for rec to be NULL if the
2353+ page is compressed. This is because a
2354+ reorganized page may become incompressible. */
2355+ if (!*rec) {
2356+ goto fail;
2357+ }
2358 }
2359 }
2360
2361@@ -1443,20 +1448,9 @@
2362 ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, btr_cur_get_block(cursor),
2363 MTR_MEMO_PAGE_X_FIX));
2364
2365- /* Try first an optimistic insert; reset the cursor flag: we do not
2366- assume anything of how it was positioned */
2367-
2368 cursor->flag = BTR_CUR_BINARY;
2369
2370- err = btr_cur_optimistic_insert(flags, cursor, entry, rec,
2371- big_rec, n_ext, thr, mtr);
2372- if (err != DB_FAIL) {
2373-
2374- return(err);
2375- }
2376-
2377- /* Retry with a pessimistic insert. Check locks and write to undo log,
2378- if specified */
2379+ /* Check locks and write to undo log, if specified */
2380
2381 err = btr_cur_ins_lock_and_undo(flags, cursor, entry,
2382 thr, mtr, &dummy_inh);
2383@@ -2083,8 +2077,12 @@
2384 goto err_exit;
2385 }
2386
2387- max_size = old_rec_size
2388- + page_get_max_insert_size_after_reorganize(page, 1);
2389+ /* We do not attempt to reorganize if the page is compressed.
2390+ This is because the page may fail to compress after reorganization. */
2391+ max_size = page_zip
2392+ ? page_get_max_insert_size(page, 1)
2393+ : (old_rec_size
2394+ + page_get_max_insert_size_after_reorganize(page, 1));
2395
2396 if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
2397 && (max_size >= new_rec_size))
2398@@ -2452,7 +2450,12 @@
2399 err = DB_SUCCESS;
2400 goto return_after_reservations;
2401 } else {
2402- ut_a(optim_err != DB_UNDERFLOW);
2403+ /* If the page is compressed and it initially
2404+ compresses very well, and there is a subsequent insert
2405+ of a badly-compressing record, it is possible for
2406+ btr_cur_optimistic_update() to return DB_UNDERFLOW and
2407+ btr_cur_insert_if_possible() to return FALSE. */
2408+ ut_a(page_zip || optim_err != DB_UNDERFLOW);
2409
2410 /* Out of space: reset the free bits. */
2411 if (!dict_index_is_clust(index)
2412@@ -2480,8 +2483,10 @@
2413 record on its page? */
2414 was_first = page_cur_is_before_first(page_cursor);
2415
2416- /* The first parameter means that no lock checking and undo logging
2417- is made in the insert */
2418+ /* Lock checks and undo logging were already performed by
2419+ btr_cur_upd_lock_and_undo(). We do not try
2420+ btr_cur_optimistic_insert() because
2421+ btr_cur_insert_if_possible() already failed above. */
2422
2423 err = btr_cur_pessimistic_insert(BTR_NO_UNDO_LOG_FLAG
2424 | BTR_NO_LOCKING_FLAG
2425
2426=== modified file 'Percona-Server/storage/innodb_plugin/btr/btr0pcur.c'
2427--- Percona-Server/storage/innodb_plugin/btr/btr0pcur.c 2012-05-09 04:14:12 +0000
2428+++ Percona-Server/storage/innodb_plugin/btr/btr0pcur.c 2012-11-08 17:45:27 +0000
2429@@ -342,44 +342,39 @@
2430 /* Restore the old search mode */
2431 cursor->search_mode = old_mode;
2432
2433- if (btr_pcur_is_on_user_rec(cursor)) {
2434- switch (cursor->rel_pos) {
2435- case BTR_PCUR_ON:
2436- if (!cmp_dtuple_rec(
2437- tuple, btr_pcur_get_rec(cursor),
2438- rec_get_offsets(btr_pcur_get_rec(cursor),
2439- index, NULL,
2440- ULINT_UNDEFINED, &heap))) {
2441-
2442- /* We have to store the NEW value for
2443- the modify clock, since the cursor can
2444- now be on a different page! But we can
2445- retain the value of old_rec */
2446-
2447- cursor->block_when_stored =
2448- btr_pcur_get_block(cursor);
2449- cursor->modify_clock =
2450- buf_block_get_modify_clock(
2451- cursor->block_when_stored);
2452- cursor->old_stored = BTR_PCUR_OLD_STORED;
2453-
2454- mem_heap_free(heap);
2455-
2456- return(TRUE);
2457- }
2458-
2459- break;
2460- case BTR_PCUR_BEFORE:
2461- page_cur_move_to_next(btr_pcur_get_page_cur(cursor));
2462- break;
2463- case BTR_PCUR_AFTER:
2464- page_cur_move_to_prev(btr_pcur_get_page_cur(cursor));
2465- break;
2466+ switch (cursor->rel_pos) {
2467+ case BTR_PCUR_ON:
2468+ if (btr_pcur_is_on_user_rec(cursor)
2469+ && !cmp_dtuple_rec(
2470+ tuple, btr_pcur_get_rec(cursor),
2471+ rec_get_offsets(btr_pcur_get_rec(cursor),
2472+ index, NULL,
2473+ ULINT_UNDEFINED, &heap))) {
2474+
2475+ /* We have to store the NEW value for
2476+ the modify clock, since the cursor can
2477+ now be on a different page! But we can
2478+ retain the value of old_rec */
2479+
2480+ cursor->block_when_stored =
2481+ btr_pcur_get_block(cursor);
2482+ cursor->modify_clock =
2483+ buf_block_get_modify_clock(
2484+ cursor->block_when_stored);
2485+ cursor->old_stored = BTR_PCUR_OLD_STORED;
2486+
2487+ mem_heap_free(heap);
2488+
2489+ return(TRUE);
2490+ }
2491 #ifdef UNIV_DEBUG
2492- default:
2493- ut_error;
2494+ /* fall through */
2495+ case BTR_PCUR_BEFORE:
2496+ case BTR_PCUR_AFTER:
2497+ break;
2498+ default:
2499+ ut_error;
2500 #endif /* UNIV_DEBUG */
2501- }
2502 }
2503
2504 mem_heap_free(heap);
2505
2506=== modified file 'Percona-Server/storage/innodb_plugin/buf/buf0buf.c'
2507--- Percona-Server/storage/innodb_plugin/buf/buf0buf.c 2012-10-12 01:13:44 +0000
2508+++ Percona-Server/storage/innodb_plugin/buf/buf0buf.c 2012-11-08 17:45:27 +0000
2509@@ -4092,6 +4092,133 @@
2510
2511 return(len);
2512 }
2513+
2514+/*******************************************************************//**
2515+Collect buffer pool stats information for a buffer pool. Also
2516+record aggregated stats if there are more than one buffer pool
2517+in the server */
2518+UNIV_INTERN
2519+void
2520+buf_stats_get_pool_info(
2521+/*====================*/
2522+ buf_pool_info_t* pool_info) /*!< in/out: buffer pool info
2523+ to fill */
2524+{
2525+ time_t current_time;
2526+ double time_elapsed;
2527+
2528+ buf_pool_mutex_enter();
2529+
2530+ pool_info->pool_size = buf_pool->curr_size;
2531+
2532+ pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
2533+
2534+ pool_info->old_lru_len = buf_pool->LRU_old_len;
2535+
2536+ pool_info->free_list_len = UT_LIST_GET_LEN(buf_pool->free);
2537+
2538+ pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool->flush_list);
2539+
2540+ pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
2541+
2542+ pool_info->n_pend_reads = buf_pool->n_pend_reads;
2543+
2544+ pool_info->n_pending_flush_lru =
2545+ (buf_pool->n_flush[BUF_FLUSH_LRU]
2546+ + buf_pool->init_flush[BUF_FLUSH_LRU]);
2547+
2548+ pool_info->n_pending_flush_list =
2549+ (buf_pool->n_flush[BUF_FLUSH_LIST]
2550+ + buf_pool->init_flush[BUF_FLUSH_LIST]);
2551+
2552+ pool_info->n_pending_flush_single_page =
2553+ (buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]
2554+ + buf_pool->init_flush[BUF_FLUSH_SINGLE_PAGE]);
2555+
2556+ current_time = time(NULL);
2557+ time_elapsed = 0.001 + difftime(current_time,
2558+ buf_pool->last_printout_time);
2559+
2560+ pool_info->n_pages_made_young = buf_pool->stat.n_pages_made_young;
2561+
2562+ pool_info->n_pages_not_made_young =
2563+ buf_pool->stat.n_pages_not_made_young;
2564+
2565+ pool_info->n_pages_read = buf_pool->stat.n_pages_read;
2566+
2567+ pool_info->n_pages_created = buf_pool->stat.n_pages_created;
2568+
2569+ pool_info->n_pages_written = buf_pool->stat.n_pages_written;
2570+
2571+ pool_info->n_page_gets = buf_pool->stat.n_page_gets;
2572+
2573+ pool_info->n_ra_pages_read_rnd = buf_pool->stat.n_ra_pages_read_rnd;
2574+ pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read;
2575+
2576+ pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted;
2577+
2578+ pool_info->page_made_young_rate =
2579+ (buf_pool->stat.n_pages_made_young
2580+ - buf_pool->old_stat.n_pages_made_young) / time_elapsed;
2581+
2582+ pool_info->page_not_made_young_rate =
2583+ (buf_pool->stat.n_pages_not_made_young
2584+ - buf_pool->old_stat.n_pages_not_made_young) / time_elapsed;
2585+
2586+ pool_info->pages_read_rate =
2587+ (buf_pool->stat.n_pages_read
2588+ - buf_pool->old_stat.n_pages_read) / time_elapsed;
2589+
2590+ pool_info->pages_created_rate =
2591+ (buf_pool->stat.n_pages_created
2592+ - buf_pool->old_stat.n_pages_created) / time_elapsed;
2593+
2594+ pool_info->pages_written_rate =
2595+ (buf_pool->stat.n_pages_written
2596+ - buf_pool->old_stat.n_pages_written) / time_elapsed;
2597+
2598+ pool_info->n_page_get_delta = buf_pool->stat.n_page_gets
2599+ - buf_pool->old_stat.n_page_gets;
2600+
2601+ if (pool_info->n_page_get_delta) {
2602+ pool_info->page_read_delta = buf_pool->stat.n_pages_read
2603+ - buf_pool->old_stat.n_pages_read;
2604+
2605+ pool_info->young_making_delta =
2606+ buf_pool->stat.n_pages_made_young
2607+ - buf_pool->old_stat.n_pages_made_young;
2608+
2609+ pool_info->not_young_making_delta =
2610+ buf_pool->stat.n_pages_not_made_young
2611+ - buf_pool->old_stat.n_pages_not_made_young;
2612+ }
2613+ pool_info->pages_readahead_rnd_rate =
2614+ (buf_pool->stat.n_ra_pages_read_rnd
2615+ - buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed;
2616+
2617+
2618+ pool_info->pages_readahead_rate =
2619+ (buf_pool->stat.n_ra_pages_read
2620+ - buf_pool->old_stat.n_ra_pages_read) / time_elapsed;
2621+
2622+ pool_info->pages_evicted_rate =
2623+ (buf_pool->stat.n_ra_pages_evicted
2624+ - buf_pool->old_stat.n_ra_pages_evicted) / time_elapsed;
2625+
2626+ pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
2627+
2628+ pool_info->io_sum = buf_LRU_stat_sum.io;
2629+
2630+ pool_info->io_cur = buf_LRU_stat_cur.io;
2631+
2632+ pool_info->unzip_sum = buf_LRU_stat_sum.unzip;
2633+
2634+ pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
2635+
2636+ buf_refresh_io_stats();
2637+ buf_pool_mutex_exit();
2638+}
2639+
2640 #else /* !UNIV_HOTBACKUP */
2641 /********************************************************************//**
2642 Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
2643@@ -4122,3 +4249,5 @@
2644 }
2645 }
2646 #endif /* !UNIV_HOTBACKUP */
2647+
2648+
2649
2650=== modified file 'Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc'
2651--- Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2012-09-14 12:19:29 +0000
2652+++ Percona-Server/storage/innodb_plugin/handler/ha_innodb.cc 2012-11-08 17:45:27 +0000
2653@@ -959,11 +959,23 @@
2654 case DB_TABLE_NOT_FOUND:
2655 return(HA_ERR_NO_SUCH_TABLE);
2656
2657- case DB_TOO_BIG_RECORD:
2658- my_error(ER_TOO_BIG_ROWSIZE, MYF(0),
2659- page_get_free_space_of_empty(flags
2660- & DICT_TF_COMPACT) / 2);
2661+ case DB_TOO_BIG_RECORD: {
2662+ /* If prefix is true then a 768-byte prefix is stored
2663+ locally for BLOB fields. Refer to dict_table_get_format() */
2664+ bool prefix = ((flags & DICT_TF_FORMAT_MASK)
2665+ >> DICT_TF_FORMAT_SHIFT) < UNIV_FORMAT_B;
2666+ my_printf_error(ER_TOO_BIG_ROWSIZE,
2667+ "Row size too large (> %lu). Changing some columns "
2668+ "to TEXT or BLOB %smay help. In current row "
2669+ "format, BLOB prefix of %d bytes is stored inline.",
2670+ MYF(0),
2671+ page_get_free_space_of_empty(flags &
2672+ DICT_TF_COMPACT) / 2,
2673+ prefix ? "or using ROW_FORMAT=DYNAMIC "
2674+ "or ROW_FORMAT=COMPRESSED ": "",
2675+ prefix ? DICT_MAX_INDEX_COL_LEN : 0);
2676 return(HA_ERR_TO_BIG_ROW);
2677+ }
2678
2679 case DB_NO_SAVEPOINT:
2680 return(HA_ERR_NO_SAVEPOINT);
2681@@ -7943,7 +7955,6 @@
2682 mem_heap_t* heap;
2683
2684 DBUG_ENTER("records_in_range");
2685- DBUG_ASSERT(min_key || max_key);
2686
2687 ut_a(prebuilt->trx == thd_to_trx(ha_thd()));
2688
2689@@ -12277,7 +12288,10 @@
2690 i_s_innodb_sys_tables,
2691 i_s_innodb_sys_indexes,
2692 i_s_innodb_sys_stats,
2693-i_s_innodb_changed_pages
2694+i_s_innodb_changed_pages,
2695+i_s_innodb_buffer_page,
2696+i_s_innodb_buffer_page_lru,
2697+i_s_innodb_buffer_stats
2698 mysql_declare_plugin_end;
2699
2700 /** @brief Initialize the default value of innodb_commit_concurrency.
2701
2702=== modified file 'Percona-Server/storage/innodb_plugin/handler/i_s.cc'
2703--- Percona-Server/storage/innodb_plugin/handler/i_s.cc 2012-08-23 08:19:20 +0000
2704+++ Percona-Server/storage/innodb_plugin/handler/i_s.cc 2012-11-08 17:45:27 +0000
2705@@ -56,10 +56,90 @@
2706 #include "btr0pcur.h"
2707 #include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */
2708 #include "log0online.h"
2709+#include "btr0btr.h"
2710+#include "log0log.h"
2711 }
2712
2713 static const char plugin_author[] = "Innobase Oy";
2714
2715+/** structure associates a name string with a file page type and/or buffer
2716+page state. */
2717+struct buffer_page_desc_str_struct{
2718+ const char* type_str; /*!< String explain the page
2719+ type/state */
2720+ ulint type_value; /*!< Page type or page state */
2721+};
2722+
2723+typedef struct buffer_page_desc_str_struct buf_page_desc_str_t;
2724+
2725+/** Any states greater than FIL_PAGE_TYPE_LAST would be treated as unknown. */
2726+#define I_S_PAGE_TYPE_UNKNOWN (FIL_PAGE_TYPE_LAST + 1)
2727+
2728+/** We also define I_S_PAGE_TYPE_INDEX as the Index Page's position
2729+in i_s_page_type[] array */
2730+#define I_S_PAGE_TYPE_INDEX 1
2731+
2732+/** Name string for File Page Types */
2733+static buf_page_desc_str_t i_s_page_type[] = {
2734+ {"ALLOCATED", FIL_PAGE_TYPE_ALLOCATED},
2735+ {"INDEX", FIL_PAGE_INDEX},
2736+ {"UNDO_LOG", FIL_PAGE_UNDO_LOG},
2737+ {"INODE", FIL_PAGE_INODE},
2738+ {"IBUF_FREE_LIST", FIL_PAGE_IBUF_FREE_LIST},
2739+ {"IBUF_BITMAP", FIL_PAGE_IBUF_BITMAP},
2740+ {"SYSTEM", FIL_PAGE_TYPE_SYS},
2741+ {"TRX_SYSTEM", FIL_PAGE_TYPE_TRX_SYS},
2742+ {"FILE_SPACE_HEADER", FIL_PAGE_TYPE_FSP_HDR},
2743+ {"EXTENT_DESCRIPTOR", FIL_PAGE_TYPE_XDES},
2744+ {"BLOB", FIL_PAGE_TYPE_BLOB},
2745+ {"COMPRESSED_BLOB", FIL_PAGE_TYPE_ZBLOB},
2746+ {"COMPRESSED_BLOB2", FIL_PAGE_TYPE_ZBLOB2},
2747+ {"UNKNOWN", I_S_PAGE_TYPE_UNKNOWN}
2748+};
2749+
2750+/* Check if we can hold all page type in a 4 bit value */
2751+#if I_S_PAGE_TYPE_UNKNOWN > 1<<4
2752+# error "i_s_page_type[] is too large"
2753+#endif
2754+
2755+/** This structure defines information we will fetch from pages
2756+currently cached in the buffer pool. It will be used to populate
2757+table INFORMATION_SCHEMA.INNODB_BUFFER_PAGE */
2758+struct buffer_page_info_struct{
2759+ ulint block_id; /*!< Buffer Pool block ID */
2760+ unsigned space_id:32; /*!< Tablespace ID */
2761+ unsigned page_num:32; /*!< Page number/offset */
2762+ unsigned access_time:32; /*!< Time of first access */
2763+ unsigned flush_type:2; /*!< Flush type */
2764+ unsigned io_fix:2; /*!< type of pending I/O operation */
2765+ unsigned fix_count:19; /*!< Count of how manyfold this block
2766+ is bufferfixed */
2767+ unsigned hashed:1; /*!< Whether hash index has been
2768+ built on this page */
2769+ unsigned is_old:1; /*!< TRUE if the block is in the old
2770+ blocks in buf_pool->LRU_old */
2771+ unsigned freed_page_clock:31; /*!< the value of
2772+ buf_pool->freed_page_clock */
2773+ unsigned zip_ssize:PAGE_ZIP_SSIZE_BITS;
2774+ /*!< Compressed page size */
2775+ unsigned page_state:BUF_PAGE_STATE_BITS; /*!< Page state */
2776+ unsigned page_type:4; /*!< Page type */
2777+ unsigned num_recs;
2778+ /*!< Number of records on Page */
2779+ unsigned data_size;
2780+ /*!< Sum of the sizes of the records */
2781+ lsn_t newest_mod; /*!< Log sequence number of
2782+ the youngest modification */
2783+ lsn_t oldest_mod; /*!< Log sequence number of
2784+ the oldest modification */
2785+ dulint index_id; /*!< Index ID if a index page */
2786+};
2787+
2788+typedef struct buffer_page_info_struct buf_page_info_t;
2789+
2790+/** maximum number of buffer page info we would cache. */
2791+#define MAX_BUF_INFO_CACHED 10000
2792+
2793 #define OK(expr) \
2794 if ((expr) != 0) { \
2795 DBUG_RETURN(1); \
2796@@ -3933,3 +4013,1680 @@
2797 STRUCT_FLD(system_vars, NULL),
2798 STRUCT_FLD(__reserved1, NULL)
2799 };
2800+
2801+/* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */
2802+static ST_FIELD_INFO i_s_innodb_buffer_stats_fields_info[] =
2803+{
2804+#define IDX_BUF_STATS_POOL_SIZE 0
2805+ {STRUCT_FLD(field_name, "POOL_SIZE"),
2806+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2807+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2808+ STRUCT_FLD(value, 0),
2809+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2810+ STRUCT_FLD(old_name, ""),
2811+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2812+
2813+#define IDX_BUF_STATS_FREE_BUFFERS 1
2814+ {STRUCT_FLD(field_name, "FREE_BUFFERS"),
2815+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2816+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2817+ STRUCT_FLD(value, 0),
2818+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2819+ STRUCT_FLD(old_name, ""),
2820+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2821+
2822+#define IDX_BUF_STATS_LRU_LEN 2
2823+ {STRUCT_FLD(field_name, "DATABASE_PAGES"),
2824+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2825+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2826+ STRUCT_FLD(value, 0),
2827+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2828+ STRUCT_FLD(old_name, ""),
2829+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2830+
2831+#define IDX_BUF_STATS_OLD_LRU_LEN 3
2832+ {STRUCT_FLD(field_name, "OLD_DATABASE_PAGES"),
2833+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2834+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2835+ STRUCT_FLD(value, 0),
2836+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2837+ STRUCT_FLD(old_name, ""),
2838+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2839+
2840+#define IDX_BUF_STATS_FLUSH_LIST_LEN 4
2841+ {STRUCT_FLD(field_name, "MODIFIED_DATABASE_PAGES"),
2842+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2843+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2844+ STRUCT_FLD(value, 0),
2845+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2846+ STRUCT_FLD(old_name, ""),
2847+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2848+
2849+#define IDX_BUF_STATS_PENDING_ZIP 5
2850+ {STRUCT_FLD(field_name, "PENDING_DECOMPRESS"),
2851+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2852+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2853+ STRUCT_FLD(value, 0),
2854+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2855+ STRUCT_FLD(old_name, ""),
2856+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2857+
2858+#define IDX_BUF_STATS_PENDING_READ 6
2859+ {STRUCT_FLD(field_name, "PENDING_READS"),
2860+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2861+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2862+ STRUCT_FLD(value, 0),
2863+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2864+ STRUCT_FLD(old_name, ""),
2865+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2866+
2867+#define IDX_BUF_STATS_FLUSH_LRU 7
2868+ {STRUCT_FLD(field_name, "PENDING_FLUSH_LRU"),
2869+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2870+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2871+ STRUCT_FLD(value, 0),
2872+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2873+ STRUCT_FLD(old_name, ""),
2874+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2875+
2876+#define IDX_BUF_STATS_FLUSH_LIST 8
2877+ {STRUCT_FLD(field_name, "PENDING_FLUSH_LIST"),
2878+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2879+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2880+ STRUCT_FLD(value, 0),
2881+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2882+ STRUCT_FLD(old_name, ""),
2883+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2884+
2885+#define IDX_BUF_STATS_PAGE_YOUNG 9
2886+ {STRUCT_FLD(field_name, "PAGES_MADE_YOUNG"),
2887+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2888+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2889+ STRUCT_FLD(value, 0),
2890+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2891+ STRUCT_FLD(old_name, ""),
2892+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2893+
2894+#define IDX_BUF_STATS_PAGE_NOT_YOUNG 10
2895+ {STRUCT_FLD(field_name, "PAGES_NOT_MADE_YOUNG"),
2896+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2897+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2898+ STRUCT_FLD(value, 0),
2899+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2900+ STRUCT_FLD(old_name, ""),
2901+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2902+
2903+#define IDX_BUF_STATS_PAGE_YOUNG_RATE 11
2904+ {STRUCT_FLD(field_name, "PAGES_MADE_YOUNG_RATE"),
2905+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2906+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2907+ STRUCT_FLD(value, 0),
2908+ STRUCT_FLD(field_flags, 0),
2909+ STRUCT_FLD(old_name, ""),
2910+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2911+
2912+#define IDX_BUF_STATS_PAGE_NOT_YOUNG_RATE 12
2913+ {STRUCT_FLD(field_name, "PAGES_MADE_NOT_YOUNG_RATE"),
2914+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2915+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2916+ STRUCT_FLD(value, 0),
2917+ STRUCT_FLD(field_flags, 0),
2918+ STRUCT_FLD(old_name, ""),
2919+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2920+
2921+#define IDX_BUF_STATS_PAGE_READ 13
2922+ {STRUCT_FLD(field_name, "NUMBER_PAGES_READ"),
2923+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2924+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2925+ STRUCT_FLD(value, 0),
2926+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2927+ STRUCT_FLD(old_name, ""),
2928+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2929+
2930+#define IDX_BUF_STATS_PAGE_CREATED 14
2931+ {STRUCT_FLD(field_name, "NUMBER_PAGES_CREATED"),
2932+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2933+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2934+ STRUCT_FLD(value, 0),
2935+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2936+ STRUCT_FLD(old_name, ""),
2937+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2938+
2939+#define IDX_BUF_STATS_PAGE_WRITTEN 15
2940+ {STRUCT_FLD(field_name, "NUMBER_PAGES_WRITTEN"),
2941+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2942+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2943+ STRUCT_FLD(value, 0),
2944+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2945+ STRUCT_FLD(old_name, ""),
2946+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2947+
2948+#define IDX_BUF_STATS_PAGE_READ_RATE 16
2949+ {STRUCT_FLD(field_name, "PAGES_READ_RATE"),
2950+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2951+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2952+ STRUCT_FLD(value, 0),
2953+ STRUCT_FLD(field_flags, 0),
2954+ STRUCT_FLD(old_name, ""),
2955+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2956+
2957+#define IDX_BUF_STATS_PAGE_CREATE_RATE 17
2958+ {STRUCT_FLD(field_name, "PAGES_CREATE_RATE"),
2959+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2960+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2961+ STRUCT_FLD(value, 0),
2962+ STRUCT_FLD(field_flags, 0),
2963+ STRUCT_FLD(old_name, ""),
2964+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2965+
2966+#define IDX_BUF_STATS_PAGE_WRITTEN_RATE 18
2967+ {STRUCT_FLD(field_name, "PAGES_WRITTEN_RATE"),
2968+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2969+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2970+ STRUCT_FLD(value, 0),
2971+ STRUCT_FLD(field_flags, 0),
2972+ STRUCT_FLD(old_name, ""),
2973+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2974+
2975+#define IDX_BUF_STATS_GET 19
2976+ {STRUCT_FLD(field_name, "NUMBER_PAGES_GET"),
2977+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2978+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2979+ STRUCT_FLD(value, 0),
2980+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2981+ STRUCT_FLD(old_name, ""),
2982+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2983+
2984+#define IDX_BUF_STATS_HIT_RATE 20
2985+ {STRUCT_FLD(field_name, "HIT_RATE"),
2986+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2987+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2988+ STRUCT_FLD(value, 0),
2989+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2990+ STRUCT_FLD(old_name, ""),
2991+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2992+
2993+#define IDX_BUF_STATS_MADE_YOUNG_PCT 21
2994+ {STRUCT_FLD(field_name, "YOUNG_MAKE_PER_THOUSAND_GETS"),
2995+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2996+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2997+ STRUCT_FLD(value, 0),
2998+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2999+ STRUCT_FLD(old_name, ""),
3000+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3001+
3002+#define IDX_BUF_STATS_NOT_MADE_YOUNG_PCT 22
3003+ {STRUCT_FLD(field_name, "NOT_YOUNG_MAKE_PER_THOUSAND_GETS"),
3004+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3005+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3006+ STRUCT_FLD(value, 0),
3007+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3008+ STRUCT_FLD(old_name, ""),
3009+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3010+
3011+#define IDX_BUF_STATS_READ_AHREAD 23
3012+ {STRUCT_FLD(field_name, "NUMBER_PAGES_READ_AHEAD"),
3013+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3014+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3015+ STRUCT_FLD(value, 0),
3016+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3017+ STRUCT_FLD(old_name, ""),
3018+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3019+
3020+#define IDX_BUF_STATS_READ_AHEAD_EVICTED 24
3021+ {STRUCT_FLD(field_name, "NUMBER_READ_AHEAD_EVICTED"),
3022+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3023+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3024+ STRUCT_FLD(value, 0),
3025+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3026+ STRUCT_FLD(old_name, ""),
3027+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3028+
3029+#define IDX_BUF_STATS_READ_AHEAD_RATE 25
3030+ {STRUCT_FLD(field_name, "READ_AHEAD_RATE"),
3031+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
3032+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
3033+ STRUCT_FLD(value, 0),
3034+ STRUCT_FLD(field_flags, 0),
3035+ STRUCT_FLD(old_name, ""),
3036+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3037+
3038+#define IDX_BUF_STATS_READ_AHEAD_EVICT_RATE 26
3039+ {STRUCT_FLD(field_name, "READ_AHEAD_EVICTED_RATE"),
3040+ STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
3041+ STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
3042+ STRUCT_FLD(value, 0),
3043+ STRUCT_FLD(field_flags, 0),
3044+ STRUCT_FLD(old_name, ""),
3045+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3046+
3047+#define IDX_BUF_STATS_LRU_IO_SUM 27
3048+ {STRUCT_FLD(field_name, "LRU_IO_TOTAL"),
3049+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3050+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3051+ STRUCT_FLD(value, 0),
3052+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3053+ STRUCT_FLD(old_name, ""),
3054+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3055+
3056+#define IDX_BUF_STATS_LRU_IO_CUR 28
3057+ {STRUCT_FLD(field_name, "LRU_IO_CURRENT"),
3058+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3059+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3060+ STRUCT_FLD(value, 0),
3061+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3062+ STRUCT_FLD(old_name, ""),
3063+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3064+
3065+#define IDX_BUF_STATS_UNZIP_SUM 29
3066+ {STRUCT_FLD(field_name, "UNCOMPRESS_TOTAL"),
3067+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3068+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3069+ STRUCT_FLD(value, 0),
3070+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3071+ STRUCT_FLD(old_name, ""),
3072+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3073+
3074+#define IDX_BUF_STATS_UNZIP_CUR 30
3075+ {STRUCT_FLD(field_name, "UNCOMPRESS_CURRENT"),
3076+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3077+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3078+ STRUCT_FLD(value, 0),
3079+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3080+ STRUCT_FLD(old_name, ""),
3081+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3082+
3083+ END_OF_ST_FIELD_INFO
3084+};
3085+
3086+/*******************************************************************//**
3087+Fill Information Schema table INNODB_BUFFER_POOL_STATS for a particular
3088+buffer pool
3089+@return 0 on success, 1 on failure */
3090+static
3091+int
3092+i_s_innodb_stats_fill(
3093+/*==================*/
3094+ THD* thd, /*!< in: thread */
3095+ TABLE_LIST* tables, /*!< in/out: tables to fill */
3096+ const buf_pool_info_t* info) /*!< in: buffer pool
3097+ information */
3098+{
3099+ TABLE* table;
3100+ Field** fields;
3101+
3102+ DBUG_ENTER("i_s_innodb_stats_fill");
3103+
3104+ table = tables->table;
3105+
3106+ fields = table->field;
3107+
3108+ OK(fields[IDX_BUF_STATS_POOL_SIZE]->store(info->pool_size));
3109+
3110+ OK(fields[IDX_BUF_STATS_LRU_LEN]->store(info->lru_len));
3111+
3112+ OK(fields[IDX_BUF_STATS_OLD_LRU_LEN]->store(info->old_lru_len));
3113+
3114+ OK(fields[IDX_BUF_STATS_FREE_BUFFERS]->store(info->free_list_len));
3115+
3116+ OK(fields[IDX_BUF_STATS_FLUSH_LIST_LEN]->store(
3117+ info->flush_list_len));
3118+
3119+ OK(fields[IDX_BUF_STATS_PENDING_ZIP]->store(info->n_pend_unzip));
3120+
3121+ OK(fields[IDX_BUF_STATS_PENDING_READ]->store(info->n_pend_reads));
3122+
3123+ OK(fields[IDX_BUF_STATS_FLUSH_LRU]->store(info->n_pending_flush_lru));
3124+
3125+ OK(fields[IDX_BUF_STATS_FLUSH_LIST]->store(info->n_pending_flush_list));
3126+
3127+ OK(fields[IDX_BUF_STATS_PAGE_YOUNG]->store(info->n_pages_made_young));
3128+
3129+ OK(fields[IDX_BUF_STATS_PAGE_NOT_YOUNG]->store(
3130+ info->n_pages_not_made_young));
3131+
3132+ OK(fields[IDX_BUF_STATS_PAGE_YOUNG_RATE]->store(
3133+ info->page_made_young_rate));
3134+
3135+ OK(fields[IDX_BUF_STATS_PAGE_NOT_YOUNG_RATE]->store(
3136+ info->page_not_made_young_rate));
3137+
3138+ OK(fields[IDX_BUF_STATS_PAGE_READ]->store(info->n_pages_read));
3139+
3140+ OK(fields[IDX_BUF_STATS_PAGE_CREATED]->store(info->n_pages_created));
3141+
3142+ OK(fields[IDX_BUF_STATS_PAGE_WRITTEN]->store(info->n_pages_written));
3143+
3144+ OK(fields[IDX_BUF_STATS_GET]->store(info->n_page_gets));
3145+
3146+ OK(fields[IDX_BUF_STATS_PAGE_READ_RATE]->store(info->pages_read_rate));
3147+
3148+ OK(fields[IDX_BUF_STATS_PAGE_CREATE_RATE]->store(info->pages_created_rate));
3149+
3150+ OK(fields[IDX_BUF_STATS_PAGE_WRITTEN_RATE]->store(info->pages_written_rate));
3151+
3152+ if (info->n_page_get_delta) {
3153+ OK(fields[IDX_BUF_STATS_HIT_RATE]->store(
3154+ 1000 - (1000 * info->page_read_delta
3155+ / info->n_page_get_delta)));
3156+
3157+ OK(fields[IDX_BUF_STATS_MADE_YOUNG_PCT]->store(
3158+ 1000 * info->young_making_delta
3159+ / info->n_page_get_delta));
3160+
3161+ OK(fields[IDX_BUF_STATS_NOT_MADE_YOUNG_PCT]->store(
3162+ 1000 * info->not_young_making_delta
3163+ / info->n_page_get_delta));
3164+ } else {
3165+ OK(fields[IDX_BUF_STATS_HIT_RATE]->store(0));
3166+ OK(fields[IDX_BUF_STATS_MADE_YOUNG_PCT]->store(0));
3167+ OK(fields[IDX_BUF_STATS_NOT_MADE_YOUNG_PCT]->store(0));
3168+ }
3169+
3170+ OK(fields[IDX_BUF_STATS_READ_AHREAD]->store(info->n_ra_pages_read));
3171+
3172+ OK(fields[IDX_BUF_STATS_READ_AHEAD_EVICTED]->store(
3173+ info->n_ra_pages_evicted));
3174+
3175+ OK(fields[IDX_BUF_STATS_READ_AHEAD_RATE]->store(
3176+ info->pages_readahead_rate));
3177+
3178+ OK(fields[IDX_BUF_STATS_READ_AHEAD_EVICT_RATE]->store(
3179+ info->pages_evicted_rate));
3180+
3181+ OK(fields[IDX_BUF_STATS_LRU_IO_SUM]->store(info->io_sum));
3182+
3183+ OK(fields[IDX_BUF_STATS_LRU_IO_CUR]->store(info->io_cur));
3184+
3185+ OK(fields[IDX_BUF_STATS_UNZIP_SUM]->store(info->unzip_sum));
3186+
3187+ OK(fields[IDX_BUF_STATS_UNZIP_CUR]->store( info->unzip_cur));
3188+
3189+ DBUG_RETURN(schema_table_store_record(thd, table));
3190+}
3191+
3192+/*******************************************************************//**
3193+This is the function that loops through each buffer pool and fetch buffer
3194+pool stats to information schema table: I_S_INNODB_BUFFER_POOL_STATS
3195+@return 0 on success, 1 on failure */
3196+static
3197+int
3198+i_s_innodb_buffer_stats_fill_table(
3199+/*===============================*/
3200+ THD* thd, /*!< in: thread */
3201+ TABLE_LIST* tables, /*!< in/out: tables to fill */
3202+ Item* ) /*!< in: condition (ignored) */
3203+{
3204+ int status = 0;
3205+ buf_pool_info_t* pool_info;
3206+
3207+ DBUG_ENTER("i_s_innodb_buffer_fill_general");
3208+
3209+ /* Only allow the PROCESS privilege holder to access the stats */
3210+ if (check_global_access(thd, PROCESS_ACL)) {
3211+ DBUG_RETURN(0);
3212+ }
3213+
3214+ pool_info = (buf_pool_info_t*) mem_zalloc(sizeof *pool_info);
3215+
3216+ /* Fetch individual buffer pool info */
3217+ buf_stats_get_pool_info(pool_info);
3218+ status = i_s_innodb_stats_fill(thd, tables, pool_info);
3219+
3220+ mem_free(pool_info);
3221+
3222+ DBUG_RETURN(status);
3223+}
3224+
3225+/*******************************************************************//**
3226+Bind the dynamic table INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS.
3227+@return 0 on success, 1 on failure */
3228+static
3229+int
3230+i_s_innodb_buffer_pool_stats_init(
3231+/*==============================*/
3232+ void* p) /*!< in/out: table schema object */
3233+{
3234+ ST_SCHEMA_TABLE* schema;
3235+
3236+ DBUG_ENTER("i_s_innodb_buffer_pool_stats_init");
3237+
3238+ schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p);
3239+
3240+ schema->fields_info = i_s_innodb_buffer_stats_fields_info;
3241+ schema->fill_table = i_s_innodb_buffer_stats_fill_table;
3242+
3243+ DBUG_RETURN(0);
3244+}
3245+
3246+UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_stats =
3247+{
3248+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
3249+ /* int */
3250+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3251+
3252+ /* pointer to type-specific plugin descriptor */
3253+ /* void* */
3254+ STRUCT_FLD(info, &i_s_info),
3255+
3256+ /* plugin name */
3257+ /* const char* */
3258+ STRUCT_FLD(name, "INNODB_BUFFER_POOL_STATS"),
3259+
3260+ /* plugin author (for SHOW PLUGINS) */
3261+ /* const char* */
3262+ STRUCT_FLD(author, plugin_author),
3263+
3264+ /* general descriptive text (for SHOW PLUGINS) */
3265+ /* const char* */
3266+ STRUCT_FLD(descr, "InnoDB Buffer Pool Statistics Information "),
3267+
3268+ /* the plugin license (PLUGIN_LICENSE_XXX) */
3269+ /* int */
3270+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3271+
3272+ /* the function to invoke when plugin is loaded */
3273+ /* int (*)(void*); */
3274+ STRUCT_FLD(init, i_s_innodb_buffer_pool_stats_init),
3275+
3276+ /* the function to invoke when plugin is unloaded */
3277+ /* int (*)(void*); */
3278+ STRUCT_FLD(deinit, i_s_common_deinit),
3279+
3280+ /* plugin version (for SHOW PLUGINS) */
3281+ /* unsigned int */
3282+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
3283+
3284+ /* struct st_mysql_show_var* */
3285+ STRUCT_FLD(status_vars, NULL),
3286+
3287+ /* struct st_mysql_sys_var** */
3288+ STRUCT_FLD(system_vars, NULL),
3289+
3290+ /* reserved for dependency checking */
3291+ /* void* */
3292+ STRUCT_FLD(__reserved1, NULL),
3293+};
3294+
3295+/* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */
3296+static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] =
3297+{
3298+#define IDX_BUFFER_BLOCK_ID 0
3299+ {STRUCT_FLD(field_name, "BLOCK_ID"),
3300+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3301+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3302+ STRUCT_FLD(value, 0),
3303+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3304+ STRUCT_FLD(old_name, ""),
3305+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3306+
3307+#define IDX_BUFFER_PAGE_SPACE 1
3308+ {STRUCT_FLD(field_name, "SPACE"),
3309+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3310+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3311+ STRUCT_FLD(value, 0),
3312+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3313+ STRUCT_FLD(old_name, ""),
3314+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3315+
3316+#define IDX_BUFFER_PAGE_NUM 2
3317+ {STRUCT_FLD(field_name, "PAGE_NUMBER"),
3318+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3319+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3320+ STRUCT_FLD(value, 0),
3321+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3322+ STRUCT_FLD(old_name, ""),
3323+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3324+
3325+#define IDX_BUFFER_PAGE_TYPE 3
3326+ {STRUCT_FLD(field_name, "PAGE_TYPE"),
3327+ STRUCT_FLD(field_length, 64),
3328+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3329+ STRUCT_FLD(value, 0),
3330+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3331+ STRUCT_FLD(old_name, ""),
3332+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3333+
3334+#define IDX_BUFFER_PAGE_FLUSH_TYPE 4
3335+ {STRUCT_FLD(field_name, "FLUSH_TYPE"),
3336+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3337+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3338+ STRUCT_FLD(value, 0),
3339+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3340+ STRUCT_FLD(old_name, ""),
3341+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3342+
3343+#define IDX_BUFFER_PAGE_FIX_COUNT 5
3344+ {STRUCT_FLD(field_name, "FIX_COUNT"),
3345+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3346+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3347+ STRUCT_FLD(value, 0),
3348+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3349+ STRUCT_FLD(old_name, ""),
3350+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3351+
3352+#define IDX_BUFFER_PAGE_HASHED 6
3353+ {STRUCT_FLD(field_name, "IS_HASHED"),
3354+ STRUCT_FLD(field_length, 3),
3355+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3356+ STRUCT_FLD(value, 0),
3357+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3358+ STRUCT_FLD(old_name, ""),
3359+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3360+
3361+#define IDX_BUFFER_PAGE_NEWEST_MOD 7
3362+ {STRUCT_FLD(field_name, "NEWEST_MODIFICATION"),
3363+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3364+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3365+ STRUCT_FLD(value, 0),
3366+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3367+ STRUCT_FLD(old_name, ""),
3368+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3369+
3370+#define IDX_BUFFER_PAGE_OLDEST_MOD 8
3371+ {STRUCT_FLD(field_name, "OLDEST_MODIFICATION"),
3372+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3373+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3374+ STRUCT_FLD(value, 0),
3375+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3376+ STRUCT_FLD(old_name, ""),
3377+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3378+
3379+#define IDX_BUFFER_PAGE_ACCESS_TIME 9
3380+ {STRUCT_FLD(field_name, "ACCESS_TIME"),
3381+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3382+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3383+ STRUCT_FLD(value, 0),
3384+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3385+ STRUCT_FLD(old_name, ""),
3386+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3387+
3388+#define IDX_BUFFER_PAGE_TABLE_NAME 10
3389+ {STRUCT_FLD(field_name, "TABLE_NAME"),
3390+ STRUCT_FLD(field_length, 1024),
3391+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3392+ STRUCT_FLD(value, 0),
3393+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3394+ STRUCT_FLD(old_name, ""),
3395+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3396+
3397+#define IDX_BUFFER_PAGE_INDEX_NAME 11
3398+ {STRUCT_FLD(field_name, "INDEX_NAME"),
3399+ STRUCT_FLD(field_length, 1024),
3400+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3401+ STRUCT_FLD(value, 0),
3402+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3403+ STRUCT_FLD(old_name, ""),
3404+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3405+
3406+#define IDX_BUFFER_PAGE_NUM_RECS 12
3407+ {STRUCT_FLD(field_name, "NUMBER_RECORDS"),
3408+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3409+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3410+ STRUCT_FLD(value, 0),
3411+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3412+ STRUCT_FLD(old_name, ""),
3413+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3414+
3415+#define IDX_BUFFER_PAGE_DATA_SIZE 13
3416+ {STRUCT_FLD(field_name, "DATA_SIZE"),
3417+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3418+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3419+ STRUCT_FLD(value, 0),
3420+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3421+ STRUCT_FLD(old_name, ""),
3422+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3423+
3424+#define IDX_BUFFER_PAGE_ZIP_SIZE 14
3425+ {STRUCT_FLD(field_name, "COMPRESSED_SIZE"),
3426+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3427+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3428+ STRUCT_FLD(value, 0),
3429+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3430+ STRUCT_FLD(old_name, ""),
3431+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3432+
3433+#define IDX_BUFFER_PAGE_STATE 15
3434+ {STRUCT_FLD(field_name, "PAGE_STATE"),
3435+ STRUCT_FLD(field_length, 64),
3436+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3437+ STRUCT_FLD(value, 0),
3438+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3439+ STRUCT_FLD(old_name, ""),
3440+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3441+
3442+#define IDX_BUFFER_PAGE_IO_FIX 16
3443+ {STRUCT_FLD(field_name, "IO_FIX"),
3444+ STRUCT_FLD(field_length, 64),
3445+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3446+ STRUCT_FLD(value, 0),
3447+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3448+ STRUCT_FLD(old_name, ""),
3449+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3450+
3451+#define IDX_BUFFER_PAGE_IS_OLD 17
3452+ {STRUCT_FLD(field_name, "IS_OLD"),
3453+ STRUCT_FLD(field_length, 3),
3454+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3455+ STRUCT_FLD(value, 0),
3456+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3457+ STRUCT_FLD(old_name, ""),
3458+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3459+
3460+#define IDX_BUFFER_PAGE_FREE_CLOCK 18
3461+ {STRUCT_FLD(field_name, "FREE_PAGE_CLOCK"),
3462+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3463+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3464+ STRUCT_FLD(value, 0),
3465+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3466+ STRUCT_FLD(old_name, ""),
3467+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3468+
3469+ END_OF_ST_FIELD_INFO
3470+};
3471+
3472+/*******************************************************************//**
3473+Fill Information Schema table INNODB_BUFFER_PAGE with information
3474+cached in the buf_page_info_t array
3475+@return 0 on success, 1 on failure */
3476+static
3477+int
3478+i_s_innodb_buffer_page_fill(
3479+/*========================*/
3480+ THD* thd, /*!< in: thread */
3481+ TABLE_LIST* tables, /*!< in/out: tables to fill */
3482+ const buf_page_info_t* info_array, /*!< in: array cached page
3483+ info */
3484+ ulint num_page, /*!< in: number of page info
3485+ cached */
3486+ mem_heap_t* heap) /*!< in: temp heap memory */
3487+{
3488+ TABLE* table;
3489+ Field** fields;
3490+
3491+ DBUG_ENTER("i_s_innodb_buffer_page_fill");
3492+
3493+ table = tables->table;
3494+
3495+ fields = table->field;
3496+
3497+ /* Iterate through the cached array and fill the I_S table rows */
3498+ for (ulint i = 0; i < num_page; i++) {
3499+ const buf_page_info_t* page_info;
3500+ const char* table_name;
3501+ const char* index_name;
3502+ const char* state_str;
3503+ enum buf_page_state state;
3504+
3505+ page_info = info_array + i;
3506+
3507+ table_name = NULL;
3508+ index_name = NULL;
3509+ state_str = NULL;
3510+
3511+ OK(fields[IDX_BUFFER_BLOCK_ID]->store(page_info->block_id));
3512+
3513+ OK(fields[IDX_BUFFER_PAGE_SPACE]->store(page_info->space_id));
3514+
3515+ OK(fields[IDX_BUFFER_PAGE_NUM]->store(page_info->page_num));
3516+
3517+ OK(field_store_string(
3518+ fields[IDX_BUFFER_PAGE_TYPE],
3519+ i_s_page_type[page_info->page_type].type_str));
3520+
3521+ OK(fields[IDX_BUFFER_PAGE_FLUSH_TYPE]->store(
3522+ page_info->flush_type));
3523+
3524+ OK(fields[IDX_BUFFER_PAGE_FIX_COUNT]->store(
3525+ page_info->fix_count));
3526+
3527+ if (page_info->hashed) {
3528+ OK(field_store_string(
3529+ fields[IDX_BUFFER_PAGE_HASHED], "YES"));
3530+ } else {
3531+ OK(field_store_string(
3532+ fields[IDX_BUFFER_PAGE_HASHED], "NO"));
3533+ }
3534+
3535+ OK(fields[IDX_BUFFER_PAGE_NEWEST_MOD]->store(
3536+ (longlong) page_info->newest_mod, true));
3537+
3538+ OK(fields[IDX_BUFFER_PAGE_OLDEST_MOD]->store(
3539+ (longlong) page_info->oldest_mod, true));
3540+
3541+ OK(fields[IDX_BUFFER_PAGE_ACCESS_TIME]->store(
3542+ page_info->access_time));
3543+
3544+ /* If this is an index page, fetch the index name
3545+ and table name */
3546+ if (page_info->page_type == I_S_PAGE_TYPE_INDEX) {
3547+ const dict_index_t* index;
3548+
3549+ mutex_enter(&dict_sys->mutex);
3550+ index = dict_index_get_if_in_cache_low(
3551+ page_info->index_id);
3552+
3553+ /* Copy the index/table name under mutex. We
3554+ do not want to hold the InnoDB mutex while
3555+ filling the IS table */
3556+ if (index) {
3557+ const char* name_ptr = index->name;
3558+
3559+ if (name_ptr[0] == TEMP_INDEX_PREFIX) {
3560+ name_ptr++;
3561+ }
3562+
3563+ index_name = mem_heap_strdup(heap, name_ptr);
3564+
3565+ table_name = mem_heap_strdup(heap,
3566+ index->table_name);
3567+
3568+ }
3569+
3570+ mutex_exit(&dict_sys->mutex);
3571+ }
3572+
3573+ OK(field_store_string(
3574+ fields[IDX_BUFFER_PAGE_TABLE_NAME], table_name));
3575+
3576+ OK(field_store_string(
3577+ fields[IDX_BUFFER_PAGE_INDEX_NAME], index_name));
3578+
3579+ OK(fields[IDX_BUFFER_PAGE_NUM_RECS]->store(
3580+ page_info->num_recs));
3581+
3582+ OK(fields[IDX_BUFFER_PAGE_DATA_SIZE]->store(
3583+ page_info->data_size));
3584+
3585+ OK(fields[IDX_BUFFER_PAGE_ZIP_SIZE]->store(
3586+ page_info->zip_ssize
3587+ ? (PAGE_ZIP_MIN_SIZE >> 1) << page_info->zip_ssize
3588+ : 0));
3589+
3590+#if BUF_PAGE_STATE_BITS > 3
3591+# error "BUF_PAGE_STATE_BITS > 3, please ensure that all 1<<BUF_PAGE_STATE_BITS values are checked for"
3592+#endif
3593+ state = static_cast<enum buf_page_state>(page_info->page_state);
3594+
3595+ switch (state) {
3596+ /* First three states are for compression pages and
3597+ are not states we would get as we scan pages through
3598+ buffer blocks */
3599+ case BUF_BLOCK_ZIP_FREE:
3600+ case BUF_BLOCK_ZIP_PAGE:
3601+ case BUF_BLOCK_ZIP_DIRTY:
3602+ state_str = NULL;
3603+ break;
3604+ case BUF_BLOCK_NOT_USED:
3605+ state_str = "NOT_USED";
3606+ break;
3607+ case BUF_BLOCK_READY_FOR_USE:
3608+ state_str = "READY_FOR_USE";
3609+ break;
3610+ case BUF_BLOCK_FILE_PAGE:
3611+ state_str = "FILE_PAGE";
3612+ break;
3613+ case BUF_BLOCK_MEMORY:
3614+ state_str = "MEMORY";
3615+ break;
3616+ case BUF_BLOCK_REMOVE_HASH:
3617+ state_str = "REMOVE_HASH";
3618+ break;
3619+ };
3620+
3621+ OK(field_store_string(fields[IDX_BUFFER_PAGE_STATE],
3622+ state_str));
3623+
3624+ switch (page_info->io_fix) {
3625+ case BUF_IO_NONE:
3626+ OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
3627+ "IO_NONE"));
3628+ break;
3629+ case BUF_IO_READ:
3630+ OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
3631+ "IO_READ"));
3632+ break;
3633+ case BUF_IO_WRITE:
3634+ OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
3635+ "IO_WRITE"));
3636+ break;
3637+ }
3638+
3639+ OK(field_store_string(fields[IDX_BUFFER_PAGE_IS_OLD],
3640+ (page_info->is_old) ? "YES" : "NO"));
3641+
3642+ OK(fields[IDX_BUFFER_PAGE_FREE_CLOCK]->store(
3643+ page_info->freed_page_clock));
3644+
3645+ if (schema_table_store_record(thd, table)) {
3646+ DBUG_RETURN(1);
3647+ }
3648+ }
3649+
3650+ DBUG_RETURN(0);
3651+}
3652+
3653+/*******************************************************************//**
3654+Set appropriate page type to a buf_page_info_t structure */
3655+static
3656+void
3657+i_s_innodb_set_page_type(
3658+/*=====================*/
3659+ buf_page_info_t*page_info, /*!< in/out: structure to fill with
3660+ scanned info */
3661+ ulint page_type, /*!< in: page type */
3662+ const byte* frame) /*!< in: buffer frame */
3663+{
3664+ if (page_type == FIL_PAGE_INDEX) {
3665+ const page_t* page = (const page_t*) frame;
3666+
3667+ /* FIL_PAGE_INDEX is a bit special, its value
3668+ is defined as 17855, so we cannot use FIL_PAGE_INDEX
3669+ to index into i_s_page_type[] array, its array index
3670+ in the i_s_page_type[] array is I_S_PAGE_TYPE_INDEX
3671+ (1) */
3672+ page_info->page_type = I_S_PAGE_TYPE_INDEX;
3673+
3674+ page_info->index_id = btr_page_get_index_id(page);
3675+
3676+ page_info->data_size = (ulint)(page_header_get_field(
3677+ page, PAGE_HEAP_TOP) - (page_is_comp(page)
3678+ ? PAGE_NEW_SUPREMUM_END
3679+ : PAGE_OLD_SUPREMUM_END)
3680+ - page_header_get_field(page, PAGE_GARBAGE));
3681+
3682+ page_info->num_recs = page_get_n_recs(page);
3683+ } else if (page_type >= I_S_PAGE_TYPE_UNKNOWN) {
3684+ /* Encountered an unknown page type */
3685+ page_info->page_type = I_S_PAGE_TYPE_UNKNOWN;
3686+ } else {
3687+ /* Make sure we get the right index into the
3688+ i_s_page_type[] array */
3689+ ut_a(page_type == i_s_page_type[page_type].type_value);
3690+
3691+ page_info->page_type = page_type;
3692+ }
3693+
3694+ if (page_info->page_type == FIL_PAGE_TYPE_ZBLOB
3695+ || page_info->page_type == FIL_PAGE_TYPE_ZBLOB2) {
3696+ page_info->page_num = mach_read_from_4(
3697+ frame + FIL_PAGE_OFFSET);
3698+ page_info->space_id = mach_read_from_4(
3699+ frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
3700+ }
3701+}
3702+
3703+/*******************************************************************//**
3704+Scans pages in the buffer cache, and collect their general information
3705+into the buf_page_info_t array which is zero-filled. So any fields
3706+that are not initialized in the function will default to 0 */
3707+static
3708+void
3709+i_s_innodb_buffer_page_get_info(
3710+/*============================*/
3711+ const buf_page_t*bpage, /*!< in: buffer pool page to scan */
3712+ ulint pos, /*!< in: buffer block position in
3713+ buffer pool or in the LRU list */
3714+ buf_page_info_t*page_info) /*!< in: zero filled info structure;
3715+ out: structure filled with scanned
3716+ info */
3717+{
3718+ page_info->block_id = pos;
3719+
3720+ page_info->page_state = buf_page_get_state(bpage);
3721+
3722+ /* Only fetch information for buffers that map to a tablespace,
3723+ that is, buffer page with state BUF_BLOCK_ZIP_PAGE,
3724+ BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_FILE_PAGE */
3725+ if (buf_page_in_file(bpage)) {
3726+ const byte* frame;
3727+ ulint page_type;
3728+
3729+ page_info->space_id = buf_page_get_space(bpage);
3730+
3731+ page_info->page_num = buf_page_get_page_no(bpage);
3732+
3733+ page_info->flush_type = bpage->flush_type;
3734+
3735+ page_info->fix_count = bpage->buf_fix_count;
3736+
3737+ page_info->newest_mod = bpage->newest_modification;
3738+
3739+ page_info->oldest_mod = bpage->oldest_modification;
3740+
3741+ page_info->access_time = bpage->access_time;
3742+
3743+ page_info->zip_ssize = bpage->zip.ssize;
3744+
3745+ page_info->io_fix = bpage->io_fix;
3746+
3747+ page_info->is_old = bpage->old;
3748+
3749+ page_info->freed_page_clock = bpage->freed_page_clock;
3750+
3751+ if (page_info->page_state == BUF_BLOCK_FILE_PAGE) {
3752+ const buf_block_t*block;
3753+
3754+ block = reinterpret_cast<const buf_block_t*>(bpage);
3755+ frame = block->frame;
3756+ page_info->hashed = (block->index != NULL);
3757+ } else {
3758+ ut_ad(page_info->zip_ssize);
3759+ frame = bpage->zip.data;
3760+ }
3761+
3762+ page_type = fil_page_get_type(frame);
3763+
3764+ i_s_innodb_set_page_type(page_info, page_type, frame);
3765+ } else {
3766+ page_info->page_type = I_S_PAGE_TYPE_UNKNOWN;
3767+ }
3768+}
3769+
3770+/*******************************************************************//**
3771+This is the function that goes through each block of the buffer pool
3772+and fetch information to information schema tables: INNODB_BUFFER_PAGE.
3773+@return 0 on success, 1 on failure */
3774+static
3775+int
3776+i_s_innodb_fill_buffer_pool(
3777+/*========================*/
3778+ THD* thd, /*!< in: thread */
3779+ TABLE_LIST* tables) /*!< in/out: tables to fill */
3780+{
3781+ int status = 0;
3782+ mem_heap_t* heap;
3783+
3784+ DBUG_ENTER("i_s_innodb_fill_buffer_pool");
3785+
3786+ heap = mem_heap_create(10000);
3787+
3788+ /* Go through each chunk of buffer pool. Currently, we only
3789+ have one single chunk for each buffer pool */
3790+ for (ulint n = 0; n < buf_pool->n_chunks; n++) {
3791+ const buf_block_t* block;
3792+ ulint n_blocks;
3793+ buf_page_info_t* info_buffer;
3794+ ulint num_page;
3795+ ulint mem_size;
3796+ ulint chunk_size;
3797+ ulint num_to_process = 0;
3798+ ulint block_id = 0;
3799+ mutex_t* block_mutex;
3800+
3801+ /* Get buffer block of the nth chunk */
3802+ block = buf_get_nth_chunk_block(buf_pool, n, &chunk_size);
3803+ num_page = 0;
3804+
3805+ while (chunk_size > 0) {
3806+ /* we cache maximum MAX_BUF_INFO_CACHED number of
3807+ buffer page info */
3808+ num_to_process = ut_min(chunk_size,
3809+ MAX_BUF_INFO_CACHED);
3810+
3811+ mem_size = num_to_process * sizeof(buf_page_info_t);
3812+
3813+ /* For each chunk, we'll pre-allocate information
3814+ structures to cache the page information read from
3815+ the buffer pool. Doing so before obtain any mutex */
3816+ info_buffer = (buf_page_info_t*) mem_heap_zalloc(
3817+ heap, mem_size);
3818+
3819+ /* Obtain appropriate mutexes. Since this is diagnostic
3820+ buffer pool info printout, we are not required to
3821+ preserve the overall consistency, so we can
3822+ release mutex periodically */
3823+ buf_pool_mutex_enter();
3824+
3825+ /* GO through each block in the chunk */
3826+ for (n_blocks = num_to_process; n_blocks--; block++) {
3827+ block_mutex = buf_page_get_mutex_enter(&block->page);
3828+ i_s_innodb_buffer_page_get_info(
3829+ &block->page, block_id,
3830+ info_buffer + num_page);
3831+ mutex_exit(block_mutex);
3832+ block_id++;
3833+ num_page++;
3834+ }
3835+
3836+ buf_pool_mutex_exit();
3837+
3838+ /* Fill in information schema table with information
3839+ just collected from the buffer chunk scan */
3840+ status = i_s_innodb_buffer_page_fill(
3841+ thd, tables, info_buffer,
3842+ num_page, heap);
3843+
3844+ /* If something goes wrong, break and return */
3845+ if (status) {
3846+ break;
3847+ }
3848+
3849+ mem_heap_empty(heap);
3850+ chunk_size -= num_to_process;
3851+ num_page = 0;
3852+ }
3853+ }
3854+
3855+ mem_heap_free(heap);
3856+
3857+ DBUG_RETURN(status);
3858+}
3859+
3860+/*******************************************************************//**
3861+Fill page information for pages in InnoDB buffer pool to the
3862+dynamic table INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
3863+@return 0 on success, 1 on failure */
3864+static
3865+int
3866+i_s_innodb_buffer_page_fill_table(
3867+/*==============================*/
3868+ THD* thd, /*!< in: thread */
3869+ TABLE_LIST* tables, /*!< in/out: tables to fill */
3870+ Item* ) /*!< in: condition (ignored) */
3871+{
3872+ int status = 0;
3873+
3874+ DBUG_ENTER("i_s_innodb_buffer_page_fill_table");
3875+
3876+ /* deny access to user without PROCESS privilege */
3877+ if (check_global_access(thd, PROCESS_ACL)) {
3878+ DBUG_RETURN(0);
3879+ }
3880+
3881+ /* Fetch information from pages in this buffer pool,
3882+ and fill the corresponding I_S table */
3883+ status = i_s_innodb_fill_buffer_pool(thd, tables);
3884+
3885+ DBUG_RETURN(status);
3886+}
3887+
3888+/*******************************************************************//**
3889+Bind the dynamic table INFORMATION_SCHEMA.INNODB_BUFFER_PAGE.
3890+@return 0 on success, 1 on failure */
3891+static
3892+int
3893+i_s_innodb_buffer_page_init(
3894+/*========================*/
3895+ void* p) /*!< in/out: table schema object */
3896+{
3897+ ST_SCHEMA_TABLE* schema;
3898+
3899+ DBUG_ENTER("i_s_innodb_buffer_page_init");
3900+
3901+ schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p);
3902+
3903+ schema->fields_info = i_s_innodb_buffer_page_fields_info;
3904+ schema->fill_table = i_s_innodb_buffer_page_fill_table;
3905+
3906+ DBUG_RETURN(0);
3907+}
3908+
3909+UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_page =
3910+{
3911+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
3912+ /* int */
3913+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3914+
3915+ /* pointer to type-specific plugin descriptor */
3916+ /* void* */
3917+ STRUCT_FLD(info, &i_s_info),
3918+
3919+ /* plugin name */
3920+ /* const char* */
3921+ STRUCT_FLD(name, "INNODB_BUFFER_PAGE"),
3922+
3923+ /* plugin author (for SHOW PLUGINS) */
3924+ /* const char* */
3925+ STRUCT_FLD(author, plugin_author),
3926+
3927+ /* general descriptive text (for SHOW PLUGINS) */
3928+ /* const char* */
3929+ STRUCT_FLD(descr, "InnoDB Buffer Page Information"),
3930+
3931+ /* the plugin license (PLUGIN_LICENSE_XXX) */
3932+ /* int */
3933+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3934+
3935+ /* the function to invoke when plugin is loaded */
3936+ /* int (*)(void*); */
3937+ STRUCT_FLD(init, i_s_innodb_buffer_page_init),
3938+
3939+ /* the function to invoke when plugin is unloaded */
3940+ /* int (*)(void*); */
3941+ STRUCT_FLD(deinit, i_s_common_deinit),
3942+
3943+ /* plugin version (for SHOW PLUGINS) */
3944+ /* unsigned int */
3945+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
3946+
3947+ /* struct st_mysql_show_var* */
3948+ STRUCT_FLD(status_vars, NULL),
3949+
3950+ /* struct st_mysql_sys_var** */
3951+ STRUCT_FLD(system_vars, NULL),
3952+
3953+ /* reserved for dependency checking */
3954+ /* void* */
3955+ STRUCT_FLD(__reserved1, NULL),
3956+};
3957+
3958+static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] =
3959+{
3960+#define IDX_BUF_LRU_POS 0
3961+ {STRUCT_FLD(field_name, "LRU_POSITION"),
3962+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3963+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3964+ STRUCT_FLD(value, 0),
3965+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3966+ STRUCT_FLD(old_name, ""),
3967+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3968+
3969+#define IDX_BUF_LRU_PAGE_SPACE 1
3970+ {STRUCT_FLD(field_name, "SPACE"),
3971+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3972+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3973+ STRUCT_FLD(value, 0),
3974+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3975+ STRUCT_FLD(old_name, ""),
3976+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3977+
3978+#define IDX_BUF_LRU_PAGE_NUM 2
3979+ {STRUCT_FLD(field_name, "PAGE_NUMBER"),
3980+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3981+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3982+ STRUCT_FLD(value, 0),
3983+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3984+ STRUCT_FLD(old_name, ""),
3985+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3986+
3987+#define IDX_BUF_LRU_PAGE_TYPE 3
3988+ {STRUCT_FLD(field_name, "PAGE_TYPE"),
3989+ STRUCT_FLD(field_length, 64),
3990+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3991+ STRUCT_FLD(value, 0),
3992+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
3993+ STRUCT_FLD(old_name, ""),
3994+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3995+
3996+#define IDX_BUF_LRU_PAGE_FLUSH_TYPE 4
3997+ {STRUCT_FLD(field_name, "FLUSH_TYPE"),
3998+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3999+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4000+ STRUCT_FLD(value, 0),
4001+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4002+ STRUCT_FLD(old_name, ""),
4003+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4004+
4005+#define IDX_BUF_LRU_PAGE_FIX_COUNT 5
4006+ {STRUCT_FLD(field_name, "FIX_COUNT"),
4007+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4008+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4009+ STRUCT_FLD(value, 0),
4010+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4011+ STRUCT_FLD(old_name, ""),
4012+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4013+
4014+#define IDX_BUF_LRU_PAGE_HASHED 6
4015+ {STRUCT_FLD(field_name, "IS_HASHED"),
4016+ STRUCT_FLD(field_length, 3),
4017+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4018+ STRUCT_FLD(value, 0),
4019+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4020+ STRUCT_FLD(old_name, ""),
4021+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4022+
4023+#define IDX_BUF_LRU_PAGE_NEWEST_MOD 7
4024+ {STRUCT_FLD(field_name, "NEWEST_MODIFICATION"),
4025+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4026+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4027+ STRUCT_FLD(value, 0),
4028+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4029+ STRUCT_FLD(old_name, ""),
4030+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4031+
4032+#define IDX_BUF_LRU_PAGE_OLDEST_MOD 8
4033+ {STRUCT_FLD(field_name, "OLDEST_MODIFICATION"),
4034+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4035+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4036+ STRUCT_FLD(value, 0),
4037+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4038+ STRUCT_FLD(old_name, ""),
4039+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4040+
4041+#define IDX_BUF_LRU_PAGE_ACCESS_TIME 9
4042+ {STRUCT_FLD(field_name, "ACCESS_TIME"),
4043+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4044+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4045+ STRUCT_FLD(value, 0),
4046+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4047+ STRUCT_FLD(old_name, ""),
4048+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4049+
4050+#define IDX_BUF_LRU_PAGE_TABLE_NAME 10
4051+ {STRUCT_FLD(field_name, "TABLE_NAME"),
4052+ STRUCT_FLD(field_length, 1024),
4053+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4054+ STRUCT_FLD(value, 0),
4055+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4056+ STRUCT_FLD(old_name, ""),
4057+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4058+
4059+#define IDX_BUF_LRU_PAGE_INDEX_NAME 11
4060+ {STRUCT_FLD(field_name, "INDEX_NAME"),
4061+ STRUCT_FLD(field_length, 1024),
4062+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4063+ STRUCT_FLD(value, 0),
4064+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4065+ STRUCT_FLD(old_name, ""),
4066+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4067+
4068+#define IDX_BUF_LRU_PAGE_NUM_RECS 12
4069+ {STRUCT_FLD(field_name, "NUMBER_RECORDS"),
4070+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4071+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4072+ STRUCT_FLD(value, 0),
4073+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4074+ STRUCT_FLD(old_name, ""),
4075+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4076+
4077+#define IDX_BUF_LRU_PAGE_DATA_SIZE 13
4078+ {STRUCT_FLD(field_name, "DATA_SIZE"),
4079+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4080+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4081+ STRUCT_FLD(value, 0),
4082+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4083+ STRUCT_FLD(old_name, ""),
4084+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4085+
4086+#define IDX_BUF_LRU_PAGE_ZIP_SIZE 14
4087+ {STRUCT_FLD(field_name, "COMPRESSED_SIZE"),
4088+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4089+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4090+ STRUCT_FLD(value, 0),
4091+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4092+ STRUCT_FLD(old_name, ""),
4093+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4094+
4095+#define IDX_BUF_LRU_PAGE_STATE 15
4096+ {STRUCT_FLD(field_name, "COMPRESSED"),
4097+ STRUCT_FLD(field_length, 3),
4098+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4099+ STRUCT_FLD(value, 0),
4100+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4101+ STRUCT_FLD(old_name, ""),
4102+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4103+
4104+#define IDX_BUF_LRU_PAGE_IO_FIX 16
4105+ {STRUCT_FLD(field_name, "IO_FIX"),
4106+ STRUCT_FLD(field_length, 64),
4107+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4108+ STRUCT_FLD(value, 0),
4109+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4110+ STRUCT_FLD(old_name, ""),
4111+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4112+
4113+#define IDX_BUF_LRU_PAGE_IS_OLD 17
4114+ {STRUCT_FLD(field_name, "IS_OLD"),
4115+ STRUCT_FLD(field_length, 3),
4116+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4117+ STRUCT_FLD(value, 0),
4118+ STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4119+ STRUCT_FLD(old_name, ""),
4120+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4121+
4122+#define IDX_BUF_LRU_PAGE_FREE_CLOCK 18
4123+ {STRUCT_FLD(field_name, "FREE_PAGE_CLOCK"),
4124+ STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4125+ STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4126+ STRUCT_FLD(value, 0),
4127+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4128+ STRUCT_FLD(old_name, ""),
4129+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4130+
4131+ END_OF_ST_FIELD_INFO
4132+};
4133+
4134+/*******************************************************************//**
4135+Fill Information Schema table INNODB_BUFFER_PAGE_LRU with information
4136+cached in the buf_page_info_t array
4137+@return 0 on success, 1 on failure */
4138+static
4139+int
4140+i_s_innodb_buf_page_lru_fill(
4141+/*=========================*/
4142+ THD* thd, /*!< in: thread */
4143+ TABLE_LIST* tables, /*!< in/out: tables to fill */
4144+ const buf_page_info_t* info_array, /*!< in: array cached page
4145+ info */
4146+ ulint num_page) /*!< in: number of page info
4147+ cached */
4148+{
4149+ TABLE* table;
4150+ Field** fields;
4151+ mem_heap_t* heap;
4152+
4153+ DBUG_ENTER("i_s_innodb_buf_page_lru_fill");
4154+
4155+ table = tables->table;
4156+
4157+ fields = table->field;
4158+
4159+ heap = mem_heap_create(1000);
4160+
4161+ /* Iterate through the cached array and fill the I_S table rows */
4162+ for (ulint i = 0; i < num_page; i++) {
4163+ const buf_page_info_t* page_info;
4164+ const char* table_name;
4165+ const char* index_name;
4166+ const char* state_str;
4167+ enum buf_page_state state;
4168+
4169+ table_name = NULL;
4170+ index_name = NULL;
4171+ state_str = NULL;
4172+
4173+ page_info = info_array + i;
4174+
4175+ OK(fields[IDX_BUF_LRU_POS]->store(page_info->block_id));
4176+
4177+ OK(fields[IDX_BUF_LRU_PAGE_SPACE]->store(page_info->space_id));
4178+
4179+ OK(fields[IDX_BUF_LRU_PAGE_NUM]->store(page_info->page_num));
4180+
4181+ OK(field_store_string(
4182+ fields[IDX_BUF_LRU_PAGE_TYPE],
4183+ i_s_page_type[page_info->page_type].type_str));
4184+
4185+ OK(fields[IDX_BUF_LRU_PAGE_FLUSH_TYPE]->store(
4186+ page_info->flush_type));
4187+
4188+ OK(fields[IDX_BUF_LRU_PAGE_FIX_COUNT]->store(
4189+ page_info->fix_count));
4190+
4191+ if (page_info->hashed) {
4192+ OK(field_store_string(
4193+ fields[IDX_BUF_LRU_PAGE_HASHED], "YES"));
4194+ } else {
4195+ OK(field_store_string(
4196+ fields[IDX_BUF_LRU_PAGE_HASHED], "NO"));
4197+ }
4198+
4199+ OK(fields[IDX_BUF_LRU_PAGE_NEWEST_MOD]->store(
4200+ page_info->newest_mod, true));
4201+
4202+ OK(fields[IDX_BUF_LRU_PAGE_OLDEST_MOD]->store(
4203+ page_info->oldest_mod, true));
4204+
4205+ OK(fields[IDX_BUF_LRU_PAGE_ACCESS_TIME]->store(
4206+ page_info->access_time));
4207+
4208+ /* If this is an index page, fetch the index name
4209+ and table name */
4210+ if (page_info->page_type == I_S_PAGE_TYPE_INDEX) {
4211+ const dict_index_t* index;
4212+
4213+ mutex_enter(&dict_sys->mutex);
4214+ index = dict_index_get_if_in_cache_low(
4215+ page_info->index_id);
4216+
4217+ /* Copy the index/table name under mutex. We
4218+ do not want to hold the InnoDB mutex while
4219+ filling the IS table */
4220+ if (index) {
4221+ const char* name_ptr = index->name;
4222+
4223+ if (name_ptr[0] == TEMP_INDEX_PREFIX) {
4224+ name_ptr++;
4225+ }
4226+
4227+ index_name = mem_heap_strdup(heap, name_ptr);
4228+
4229+ table_name = mem_heap_strdup(heap,
4230+ index->table_name);
4231+ }
4232+
4233+ mutex_exit(&dict_sys->mutex);
4234+ }
4235+
4236+ OK(field_store_string(
4237+ fields[IDX_BUF_LRU_PAGE_TABLE_NAME], table_name));
4238+
4239+ OK(field_store_string(
4240+ fields[IDX_BUF_LRU_PAGE_INDEX_NAME], index_name));
4241+ OK(fields[IDX_BUF_LRU_PAGE_NUM_RECS]->store(
4242+ page_info->num_recs));
4243+
4244+ OK(fields[IDX_BUF_LRU_PAGE_DATA_SIZE]->store(
4245+ page_info->data_size));
4246+
4247+ OK(fields[IDX_BUF_LRU_PAGE_ZIP_SIZE]->store(
4248+ page_info->zip_ssize ?
4249+ 512 << page_info->zip_ssize : 0));
4250+
4251+ state = static_cast<enum buf_page_state>(page_info->page_state);
4252+
4253+ switch (state) {
4254+ /* Compressed page */
4255+ case BUF_BLOCK_ZIP_PAGE:
4256+ case BUF_BLOCK_ZIP_DIRTY:
4257+ state_str = "YES";
4258+ break;
4259+ /* Uncompressed page */
4260+ case BUF_BLOCK_FILE_PAGE:
4261+ state_str = "NO";
4262+ break;
4263+ /* We should not see following states */
4264+ case BUF_BLOCK_ZIP_FREE:
4265+ case BUF_BLOCK_READY_FOR_USE:
4266+ case BUF_BLOCK_NOT_USED:
4267+ case BUF_BLOCK_MEMORY:
4268+ case BUF_BLOCK_REMOVE_HASH:
4269+ state_str = NULL;
4270+ break;
4271+ };
4272+
4273+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_STATE],
4274+ state_str));
4275+
4276+ switch (page_info->io_fix) {
4277+ case BUF_IO_NONE:
4278+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
4279+ "IO_NONE"));
4280+ break;
4281+ case BUF_IO_READ:
4282+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
4283+ "IO_READ"));
4284+ break;
4285+ case BUF_IO_WRITE:
4286+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
4287+ "IO_WRITE"));
4288+ break;
4289+ }
4290+
4291+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IS_OLD],
4292+ (page_info->is_old) ? "YES" : "NO"));
4293+
4294+ OK(fields[IDX_BUF_LRU_PAGE_FREE_CLOCK]->store(
4295+ page_info->freed_page_clock));
4296+
4297+ if (schema_table_store_record(thd, table)) {
4298+ mem_heap_free(heap);
4299+ DBUG_RETURN(1);
4300+ }
4301+
4302+ mem_heap_empty(heap);
4303+ }
4304+
4305+ mem_heap_free(heap);
4306+
4307+ DBUG_RETURN(0);
4308+}
4309+
4310+/*******************************************************************//**
4311+This is the function that goes through buffer pool's LRU list
4312+and fetch information to INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU.
4313+@return 0 on success, 1 on failure */
4314+static
4315+int
4316+i_s_innodb_fill_buffer_lru(
4317+/*=======================*/
4318+ THD* thd, /*!< in: thread */
4319+ TABLE_LIST* tables) /*!< in/out: tables to fill */
4320+{
4321+ int status = 0;
4322+ buf_page_info_t* info_buffer;
4323+ ulint lru_pos = 0;
4324+ const buf_page_t* bpage;
4325+ ulint lru_len;
4326+ mutex_t* block_mutex;
4327+
4328+ DBUG_ENTER("i_s_innodb_fill_buffer_lru");
4329+
4330+ /* Obtain buf_pool mutex before allocate info_buffer, since
4331+ UT_LIST_GET_LEN(buf_pool->LRU) could change */
4332+ mutex_enter(&LRU_list_mutex);
4333+
4334+ lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
4335+
4336+ /* Print error message if malloc fail */
4337+ info_buffer = (buf_page_info_t*) my_malloc(
4338+ lru_len * sizeof *info_buffer, MYF(MY_WME));
4339+
4340+ if (!info_buffer) {
4341+ status = 1;
4342+ goto exit;
4343+ }
4344+
4345+ memset(info_buffer, 0, lru_len * sizeof *info_buffer);
4346+
4347+ /* Walk through Pool's LRU list and print the buffer page
4348+ information */
4349+ bpage = UT_LIST_GET_LAST(buf_pool->LRU);
4350+
4351+ while (bpage != NULL) {
4352+ block_mutex = buf_page_get_mutex_enter(bpage);
4353+ /* Use the same function that collect buffer info for
4354+ INNODB_BUFFER_PAGE to get buffer page info */
4355+ i_s_innodb_buffer_page_get_info(bpage, lru_pos,
4356+ (info_buffer + lru_pos));
4357+
4358+ bpage = UT_LIST_GET_PREV(LRU, bpage);
4359+ mutex_exit(block_mutex);
4360+
4361+ lru_pos++;
4362+ }
4363+
4364+ ut_ad(lru_pos == lru_len);
4365+ ut_ad(lru_pos == UT_LIST_GET_LEN(buf_pool->LRU));
4366+
4367+exit:
4368+ mutex_exit(&LRU_list_mutex);
4369+
4370+ if (info_buffer) {
4371+ status = i_s_innodb_buf_page_lru_fill(
4372+ thd, tables, info_buffer, lru_len);
4373+
4374+ my_free(info_buffer, MYF(MY_ALLOW_ZERO_PTR));
4375+ }
4376+
4377+ DBUG_RETURN(status);
4378+}
4379+
4380+/*******************************************************************//**
4381+Fill page information for pages in InnoDB buffer pool to the
4382+dynamic table INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU
4383+@return 0 on success, 1 on failure */
4384+static
4385+int
4386+i_s_innodb_buf_page_lru_fill_table(
4387+/*===============================*/
4388+ THD* thd, /*!< in: thread */
4389+ TABLE_LIST* tables, /*!< in/out: tables to fill */
4390+ Item* ) /*!< in: condition (ignored) */
4391+{
4392+ int status = 0;
4393+
4394+ DBUG_ENTER("i_s_innodb_buf_page_lru_fill_table");
4395+
4396+ /* deny access to any users that do not hold PROCESS_ACL */
4397+ if (check_global_access(thd, PROCESS_ACL)) {
4398+ DBUG_RETURN(0);
4399+ }
4400+
4401+ /* Fetch information from pages in this buffer pool's LRU list,
4402+ and fill the corresponding I_S table */
4403+ status = i_s_innodb_fill_buffer_lru(thd, tables);
4404+
4405+ DBUG_RETURN(status);
4406+}
4407+
4408+/*******************************************************************//**
4409+Bind the dynamic table INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU.
4410+@return 0 on success, 1 on failure */
4411+static
4412+int
4413+i_s_innodb_buffer_page_lru_init(
4414+/*============================*/
4415+ void* p) /*!< in/out: table schema object */
4416+{
4417+ ST_SCHEMA_TABLE* schema;
4418+
4419+ DBUG_ENTER("i_s_innodb_buffer_page_lru_init");
4420+
4421+ schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p);
4422+
4423+ schema->fields_info = i_s_innodb_buf_page_lru_fields_info;
4424+ schema->fill_table = i_s_innodb_buf_page_lru_fill_table;
4425+
4426+ DBUG_RETURN(0);
4427+}
4428+
4429+UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_page_lru =
4430+{
4431+ /* the plugin type (a MYSQL_XXX_PLUGIN value) */
4432+ /* int */
4433+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
4434+
4435+ /* pointer to type-specific plugin descriptor */
4436+ /* void* */
4437+ STRUCT_FLD(info, &i_s_info),
4438+
4439+ /* plugin name */
4440+ /* const char* */
4441+ STRUCT_FLD(name, "INNODB_BUFFER_PAGE_LRU"),
4442+
4443+ /* plugin author (for SHOW PLUGINS) */
4444+ /* const char* */
4445+ STRUCT_FLD(author, plugin_author),
4446+
4447+ /* general descriptive text (for SHOW PLUGINS) */
4448+ /* const char* */
4449+ STRUCT_FLD(descr, "InnoDB Buffer Page in LRU"),
4450+
4451+ /* the plugin license (PLUGIN_LICENSE_XXX) */
4452+ /* int */
4453+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
4454+
4455+ /* the function to invoke when plugin is loaded */
4456+ /* int (*)(void*); */
4457+ STRUCT_FLD(init, i_s_innodb_buffer_page_lru_init),
4458+
4459+ /* the function to invoke when plugin is unloaded */
4460+ /* int (*)(void*); */
4461+ STRUCT_FLD(deinit, i_s_common_deinit),
4462+
4463+ /* plugin version (for SHOW PLUGINS) */
4464+ /* unsigned int */
4465+ STRUCT_FLD(version, INNODB_VERSION_SHORT),
4466+
4467+ /* struct st_mysql_show_var* */
4468+ STRUCT_FLD(status_vars, NULL),
4469+
4470+ /* struct st_mysql_sys_var** */
4471+ STRUCT_FLD(system_vars, NULL),
4472+
4473+ /* reserved for dependency checking */
4474+ /* void* */
4475+ STRUCT_FLD(__reserved1, NULL),
4476+};
4477
4478=== modified file 'Percona-Server/storage/innodb_plugin/handler/i_s.h'
4479--- Percona-Server/storage/innodb_plugin/handler/i_s.h 2012-08-15 14:05:13 +0000
4480+++ Percona-Server/storage/innodb_plugin/handler/i_s.h 2012-11-08 17:45:27 +0000
4481@@ -44,5 +44,8 @@
4482 extern struct st_mysql_plugin i_s_innodb_sys_indexes;
4483 extern struct st_mysql_plugin i_s_innodb_sys_stats;
4484 extern struct st_mysql_plugin i_s_innodb_changed_pages;
4485+extern struct st_mysql_plugin i_s_innodb_buffer_page;
4486+extern struct st_mysql_plugin i_s_innodb_buffer_page_lru;
4487+extern struct st_mysql_plugin i_s_innodb_buffer_stats;
4488
4489 #endif /* i_s_h */
4490
4491=== modified file 'Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c'
4492--- Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2012-05-09 04:14:12 +0000
4493+++ Percona-Server/storage/innodb_plugin/ibuf/ibuf0ibuf.c 2012-11-08 17:45:27 +0000
4494@@ -2759,11 +2759,19 @@
4495
4496 root = ibuf_tree_root_get(&mtr);
4497
4498- err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
4499- | BTR_NO_UNDO_LOG_FLAG,
4500- cursor,
4501- ibuf_entry, &ins_rec,
4502- &dummy_big_rec, 0, thr, &mtr);
4503+ err = btr_cur_optimistic_insert(
4504+ BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG,
4505+ cursor, ibuf_entry, &ins_rec,
4506+ &dummy_big_rec, 0, thr, &mtr);
4507+
4508+ if (err == DB_FAIL) {
4509+ err = btr_cur_pessimistic_insert(
4510+ BTR_NO_LOCKING_FLAG
4511+ | BTR_NO_UNDO_LOG_FLAG,
4512+ cursor, ibuf_entry, &ins_rec,
4513+ &dummy_big_rec, 0, thr, &mtr);
4514+ }
4515+
4516 if (err == DB_SUCCESS) {
4517 /* Update the page max trx id field */
4518 page_update_max_trx_id(btr_cur_get_block(cursor), NULL,
4519
4520=== modified file 'Percona-Server/storage/innodb_plugin/include/buf0buf.h'
4521--- Percona-Server/storage/innodb_plugin/include/buf0buf.h 2012-04-02 02:09:15 +0000
4522+++ Percona-Server/storage/innodb_plugin/include/buf0buf.h 2012-11-08 17:45:27 +0000
4523@@ -103,6 +103,81 @@
4524 before putting to the free list */
4525 };
4526
4527+/** This structure defines information we will fetch from each buffer pool. It
4528+will be used to print table IO stats */
4529+struct buf_pool_info_struct{
4530+ /* General buffer pool info */
4531+ ulint pool_size; /*!< Buffer Pool size in pages */
4532+ ulint lru_len; /*!< Length of buf_pool->LRU */
4533+ ulint old_lru_len; /*!< buf_pool->LRU_old_len */
4534+ ulint free_list_len; /*!< Length of buf_pool->free list */
4535+ ulint flush_list_len; /*!< Length of buf_pool->flush_list */
4536+ ulint n_pend_unzip; /*!< buf_pool->n_pend_unzip, pages
4537+ pending decompress */
4538+ ulint n_pend_reads; /*!< buf_pool->n_pend_reads, pages
4539+ pending read */
4540+ ulint n_pending_flush_lru; /*!< Pages pending flush in LRU */
4541+ ulint n_pending_flush_single_page;/*!< Pages pending to be
4542+ flushed as part of single page
4543+ flushes issued by various user
4544+ threads */
4545+ ulint n_pending_flush_list; /*!< Pages pending flush in FLUSH
4546+ LIST */
4547+ ulint n_pages_made_young; /*!< number of pages made young */
4548+ ulint n_pages_not_made_young; /*!< number of pages not made young */
4549+ ulint n_pages_read; /*!< buf_pool->n_pages_read */
4550+ ulint n_pages_created; /*!< buf_pool->n_pages_created */
4551+ ulint n_pages_written; /*!< buf_pool->n_pages_written */
4552+ ulint n_page_gets; /*!< buf_pool->n_page_gets */
4553+ ulint n_ra_pages_read_rnd; /*!< buf_pool->n_ra_pages_read_rnd,
4554+ number of pages readahead */
4555+ ulint n_ra_pages_read; /*!< buf_pool->n_ra_pages_read, number
4556+ of pages readahead */
4557+ ulint n_ra_pages_evicted; /*!< buf_pool->n_ra_pages_evicted,
4558+ number of readahead pages evicted
4559+ without access */
4560+ ulint n_page_get_delta; /*!< num of buffer pool page gets since
4561+ last printout */
4562+
4563+ /* Buffer pool access stats */
4564+ double page_made_young_rate; /*!< page made young rate in pages
4565+ per second */
4566+ double page_not_made_young_rate;/*!< page not made young rate
4567+ in pages per second */
4568+ double pages_read_rate; /*!< num of pages read per second */
4569+ double pages_created_rate; /*!< num of pages create per second */
4570+ double pages_written_rate; /*!< num of pages written per second */
4571+ ulint page_read_delta; /*!< num of pages read since last
4572+ printout */
4573+ ulint young_making_delta; /*!< num of pages made young since
4574+ last printout */
4575+ ulint not_young_making_delta; /*!< num of pages not make young since
4576+ last printout */
4577+
4578+ /* Statistics about read ahead algorithm. */
4579+ double pages_readahead_rnd_rate;/*!< random readahead rate in pages per
4580+ second */
4581+ double pages_readahead_rate; /*!< readahead rate in pages per
4582+ second */
4583+ double pages_evicted_rate; /*!< rate of readahead page evicted
4584+ without access, in pages per second */
4585+
4586+ /* Stats about LRU eviction */
4587+ ulint unzip_lru_len; /*!< length of buf_pool->unzip_LRU
4588+ list */
4589+ /* Counters for LRU policy */
4590+ ulint io_sum; /*!< buf_LRU_stat_sum.io */
4591+ ulint io_cur; /*!< buf_LRU_stat_cur.io, num of IO
4592+ for current interval */
4593+ ulint unzip_sum; /*!< buf_LRU_stat_sum.unzip */
4594+ ulint unzip_cur; /*!< buf_LRU_stat_cur.unzip, num
4595+ pages decompressed in current
4596+ interval */
4597+};
4598+
4599+typedef struct buf_pool_info_struct buf_pool_info_t;
4600+
4601+
4602 #ifndef UNIV_HOTBACKUP
4603 /********************************************************************//**
4604 Creates the buffer pool.
4605@@ -623,6 +698,16 @@
4606 buf_print_io(
4607 /*=========*/
4608 FILE* file); /*!< in: file where to print */
4609+/*******************************************************************//**
4610+Collect buffer pool stats information for a buffer pool. Also
4611+record aggregated stats if there are more than one buffer pool
4612+in the server */
4613+UNIV_INTERN
4614+void
4615+buf_stats_get_pool_info(
4616+/*====================*/
4617+ buf_pool_info_t* pool_info); /*!< in/out: buffer pool info
4618+ to fill */
4619 /*********************************************************************//**
4620 Returns the ratio in percents of modified pages in the buffer pool /
4621 database pages in the buffer pool.
4622@@ -1051,12 +1136,27 @@
4623 ulint
4624 buf_get_free_list_len(void);
4625 /*=======================*/
4626+
4627+/*********************************************************************//**
4628+Get the nth chunk's buffer block in the specified buffer pool.
4629+@return the nth chunk's buffer block. */
4630+UNIV_INLINE
4631+buf_block_t*
4632+buf_get_nth_chunk_block(
4633+/*====================*/
4634+ const buf_pool_t* buf_pool, /*!< in: buffer pool instance */
4635+ ulint n, /*!< in: nth chunk in the buffer pool */
4636+ ulint* chunk_size); /*!< in: chunk size */
4637+
4638 #endif /* !UNIV_HOTBACKUP */
4639
4640
4641 /** The common buffer control block structure
4642 for compressed and uncompressed frames */
4643
4644+/** Number of bits used for buffer page states. */
4645+#define BUF_PAGE_STATE_BITS 3
4646+
4647 struct buf_page_struct{
4648 /** @name General fields
4649 None of these bit-fields must be modified without holding
4650@@ -1071,7 +1171,8 @@
4651 unsigned offset:32; /*!< page number; also protected
4652 by buf_pool_mutex. */
4653
4654- unsigned state:3; /*!< state of the control block; also
4655+ unsigned state:BUF_PAGE_STATE_BITS;
4656+ /*!< state of the control block; also
4657 protected by buf_pool_mutex.
4658 State transitions from
4659 BUF_BLOCK_READY_FOR_USE to
4660
4661=== modified file 'Percona-Server/storage/innodb_plugin/include/buf0buf.ic'
4662--- Percona-Server/storage/innodb_plugin/include/buf0buf.ic 2012-04-02 02:09:15 +0000
4663+++ Percona-Server/storage/innodb_plugin/include/buf0buf.ic 2012-11-08 17:45:27 +0000
4664@@ -36,6 +36,7 @@
4665 #include "buf0lru.h"
4666 #include "buf0rea.h"
4667 #include "srv0srv.h"
4668+
4669 /********************************************************************//**
4670 Reads the freed_page_clock of a buffer block.
4671 @return freed_page_clock */
4672@@ -1154,4 +1155,23 @@
4673 sync_thread_add_level(&block->lock, level, FALSE);
4674 }
4675 #endif /* UNIV_SYNC_DEBUG */
4676+
4677+/*********************************************************************//**
4678+Get the nth chunk's buffer block in the specified buffer pool.
4679+@return the nth chunk's buffer block. */
4680+UNIV_INLINE
4681+buf_block_t*
4682+buf_get_nth_chunk_block(
4683+/*====================*/
4684+ const buf_pool_t* buf_pool, /*!< in: buffer pool instance */
4685+ ulint n, /*!< in: nth chunk in the buffer pool */
4686+ ulint* chunk_size) /*!< in: chunk size */
4687+{
4688+ const buf_chunk_t* chunk;
4689+
4690+ chunk = buf_pool->chunks + n;
4691+ *chunk_size = chunk->size;
4692+ return(chunk->blocks);
4693+}
4694 #endif /* !UNIV_HOTBACKUP */
4695+
4696
4697=== modified file 'Percona-Server/storage/innodb_plugin/include/fil0fil.h'
4698--- Percona-Server/storage/innodb_plugin/include/fil0fil.h 2012-05-09 04:14:12 +0000
4699+++ Percona-Server/storage/innodb_plugin/include/fil0fil.h 2012-11-08 17:45:27 +0000
4700@@ -142,6 +142,8 @@
4701 #define FIL_PAGE_TYPE_BLOB 10 /*!< Uncompressed BLOB page */
4702 #define FIL_PAGE_TYPE_ZBLOB 11 /*!< First compressed BLOB page */
4703 #define FIL_PAGE_TYPE_ZBLOB2 12 /*!< Subsequent compressed BLOB page */
4704+#define FIL_PAGE_TYPE_LAST FIL_PAGE_TYPE_ZBLOB2
4705+ /*!< Last page type */
4706 /* @} */
4707
4708 /** Space types @{ */
4709
4710=== modified file 'Percona-Server/storage/innodb_plugin/include/log0log.h'
4711--- Percona-Server/storage/innodb_plugin/include/log0log.h 2012-06-14 09:16:03 +0000
4712+++ Percona-Server/storage/innodb_plugin/include/log0log.h 2012-11-08 17:45:27 +0000
4713@@ -41,6 +41,9 @@
4714 #include "sync0rw.h"
4715 #endif /* !UNIV_HOTBACKUP */
4716
4717+/* Type used for all log sequence number storage and arithmetics */
4718+typedef ib_uint64_t lsn_t;
4719+
4720 /** Redo log buffer */
4721 typedef struct log_struct log_t;
4722 /** Redo log group */
4723
4724=== modified file 'Percona-Server/storage/innodb_plugin/include/univ.i'
4725--- Percona-Server/storage/innodb_plugin/include/univ.i 2012-08-20 03:14:02 +0000
4726+++ Percona-Server/storage/innodb_plugin/include/univ.i 2012-11-08 17:45:27 +0000
4727@@ -274,6 +274,24 @@
4728 ========================
4729 */
4730
4731+/** There are currently two InnoDB file formats which are used to group
4732+features with similar restrictions and dependencies. Using an enum allows
4733+switch statements to give a compiler warning when a new one is introduced. */
4734+enum innodb_file_formats_enum {
4735+ /** Antelope File Format: InnoDB/MySQL up to 5.1.
4736+ This format includes REDUNDANT and COMPACT row formats */
4737+ UNIV_FORMAT_A = 0,
4738+
4739+ /** Barracuda File Format: Introduced in InnoDB plugin for 5.1:
4740+ This format includes COMPRESSED and DYNAMIC row formats. It
4741+ includes the ability to create secondary indexes from data that
4742+ is not on the clustered index page and the ability to store more
4743+ data off the clustered index page. */
4744+ UNIV_FORMAT_B = 1
4745+};
4746+
4747+typedef enum innodb_file_formats_enum innodb_file_formats_t;
4748+
4749 /* The 2-logarithm of UNIV_PAGE_SIZE: */
4750 /* #define UNIV_PAGE_SIZE_SHIFT 14 */
4751 #define UNIV_PAGE_SIZE_SHIFT_MAX 14
4752
4753=== modified file 'Percona-Server/storage/innodb_plugin/page/page0cur.c'
4754--- Percona-Server/storage/innodb_plugin/page/page0cur.c 2012-02-17 09:42:04 +0000
4755+++ Percona-Server/storage/innodb_plugin/page/page0cur.c 2012-11-08 17:45:27 +0000
4756@@ -1902,6 +1902,7 @@
4757
4758 /* Save to local variables some data associated with current_rec */
4759 cur_slot_no = page_dir_find_owner_slot(current_rec);
4760+ ut_ad(cur_slot_no > 0);
4761 cur_dir_slot = page_dir_get_nth_slot(page, cur_slot_no);
4762 cur_n_owned = page_dir_slot_get_n_owned(cur_dir_slot);
4763
4764
4765=== modified file 'Percona-Server/storage/innodb_plugin/page/page0page.c'
4766--- Percona-Server/storage/innodb_plugin/page/page0page.c 2012-10-12 01:13:44 +0000
4767+++ Percona-Server/storage/innodb_plugin/page/page0page.c 2012-11-08 17:45:27 +0000
4768@@ -780,17 +780,23 @@
4769 if (UNIV_LIKELY_NULL(new_page_zip)) {
4770 mtr_set_log_mode(mtr, log_mode);
4771
4772+ DBUG_EXECUTE_IF("page_copy_rec_list_start_compress_fail",
4773+ goto zip_reorganize;);
4774+
4775 if (UNIV_UNLIKELY
4776 (!page_zip_compress(new_page_zip, new_page, index, mtr))) {
4777+ ulint ret_pos;
4778+#ifndef DBUG_OFF
4779+zip_reorganize:
4780+#endif /* DBUG_OFF */
4781 /* Before trying to reorganize the page,
4782 store the number of preceding records on the page. */
4783- ulint ret_pos
4784- = page_rec_get_n_recs_before(ret);
4785+ ret_pos = page_rec_get_n_recs_before(ret);
4786 /* Before copying, "ret" was the predecessor
4787 of the predefined supremum record. If it was
4788 the predefined infimum record, then it would
4789- still be the infimum. Thus, the assertion
4790- ut_a(ret_pos > 0) would fail here. */
4791+ still be the infimum, and we would have
4792+ ret_pos == 0. */
4793
4794 if (UNIV_UNLIKELY
4795 (!page_zip_reorganize(new_block, index, mtr))) {
4796@@ -806,15 +812,10 @@
4797 btr_blob_dbg_add(new_page, index,
4798 "copy_start_reorg_fail");
4799 return(NULL);
4800- } else {
4801- /* The page was reorganized:
4802- Seek to ret_pos. */
4803- ret = new_page + PAGE_NEW_INFIMUM;
4804-
4805- do {
4806- ret = rec_get_next_ptr(ret, TRUE);
4807- } while (--ret_pos);
4808 }
4809+
4810+ /* The page was reorganized: Seek to ret_pos. */
4811+ ret = page_rec_get_nth(new_page, ret_pos);
4812 }
4813 }
4814
4815@@ -1050,6 +1051,7 @@
4816
4817 n_owned = rec_get_n_owned_new(rec2) - count;
4818 slot_index = page_dir_find_owner_slot(rec2);
4819+ ut_ad(slot_index > 0);
4820 slot = page_dir_get_nth_slot(page, slot_index);
4821 } else {
4822 rec_t* rec2 = rec;
4823@@ -1065,6 +1067,7 @@
4824
4825 n_owned = rec_get_n_owned_old(rec2) - count;
4826 slot_index = page_dir_find_owner_slot(rec2);
4827+ ut_ad(slot_index > 0);
4828 slot = page_dir_get_nth_slot(page, slot_index);
4829 }
4830
4831@@ -1491,6 +1494,10 @@
4832 ulint n_owned;
4833 const rec_t* rec;
4834
4835+ if (nth == 0) {
4836+ return(page_get_infimum_rec(page));
4837+ }
4838+
4839 ut_ad(nth < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
4840
4841 for (i = 0;; i++) {
4842
4843=== modified file 'Percona-Server/storage/innodb_plugin/row/row0ins.c'
4844--- Percona-Server/storage/innodb_plugin/row/row0ins.c 2012-08-20 03:14:02 +0000
4845+++ Percona-Server/storage/innodb_plugin/row/row0ins.c 2012-11-08 17:45:27 +0000
4846@@ -2192,9 +2192,16 @@
4847
4848 goto function_exit;
4849 }
4850- err = btr_cur_pessimistic_insert(
4851+
4852+ err = btr_cur_optimistic_insert(
4853 0, &cursor, entry, &insert_rec, &big_rec,
4854 n_ext, thr, &mtr);
4855+
4856+ if (err == DB_FAIL) {
4857+ err = btr_cur_pessimistic_insert(
4858+ 0, &cursor, entry, &insert_rec,
4859+ &big_rec, n_ext, thr, &mtr);
4860+ }
4861 }
4862 }
4863
4864
4865=== modified file 'Percona-Server/storage/innodb_plugin/row/row0merge.c'
4866--- Percona-Server/storage/innodb_plugin/row/row0merge.c 2012-04-02 02:09:15 +0000
4867+++ Percona-Server/storage/innodb_plugin/row/row0merge.c 2012-11-08 17:45:27 +0000
4868@@ -1215,11 +1215,25 @@
4869 goto err_exit;
4870 }
4871
4872+ /* Store the cursor position on the last user
4873+ record on the page. */
4874+ btr_pcur_move_to_prev_on_page(&pcur);
4875+ /* Leaf pages must never be empty, unless
4876+ this is the only page in the index tree. */
4877+ ut_ad(btr_pcur_is_on_user_rec(&pcur)
4878+ || buf_block_get_page_no(
4879+ btr_pcur_get_block(&pcur))
4880+ == clust_index->page);
4881+
4882 btr_pcur_store_position(&pcur, &mtr);
4883 mtr_commit(&mtr);
4884 mtr_start(&mtr);
4885+ /* Restore position on the record, or its
4886+ predecessor if the record was purged
4887+ meanwhile. */
4888 btr_pcur_restore_position(BTR_SEARCH_LEAF,
4889 &pcur, &mtr);
4890+ /* Move to the successor of the original record. */
4891 has_next = btr_pcur_move_to_next_user_rec(&pcur, &mtr);
4892 }
4893
4894
4895=== modified file 'Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins.sql'
4896--- Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins.sql 2008-10-30 10:38:18 +0000
4897+++ Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins.sql 2012-11-08 17:45:27 +0000
4898@@ -7,3 +7,6 @@
4899 INSTALL PLUGIN innodb_cmp_reset SONAME 'ha_innodb.so';
4900 INSTALL PLUGIN innodb_cmpmem SONAME 'ha_innodb.so';
4901 INSTALL PLUGIN innodb_cmpmem_reset SONAME 'ha_innodb.so';
4902+INSTALL PLUGIN innodb_buffer_pool_stats SONAME 'ha_innodb.so';
4903+INSTALL PLUGIN innodb_buffer_page SONAME 'ha_innodb.so';
4904+INSTALL PLUGIN innodb_buffer_page_lru SONAME 'ha_innodb.so';
4905
4906=== modified file 'Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins_win.sql'
4907--- Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins_win.sql 2008-10-31 12:21:43 +0000
4908+++ Percona-Server/storage/innodb_plugin/scripts/install_innodb_plugins_win.sql 2012-11-08 17:45:27 +0000
4909@@ -7,3 +7,6 @@
4910 INSTALL PLUGIN innodb_cmp_reset SONAME 'ha_innodb.dll';
4911 INSTALL PLUGIN innodb_cmpmem SONAME 'ha_innodb.dll';
4912 INSTALL PLUGIN innodb_cmpmem_reset SONAME 'ha_innodb.dll';
4913+INSTALL PLUGIN innodb_buffer_pool_stats SONAME 'ha_innodb.dll';
4914+INSTALL PLUGIN innodb_buffer_page SONAME 'ha_innodb.dll';
4915+INSTALL PLUGIN innodb_buffer_page_lru SONAME 'ha_innodb.dll';
4916
4917=== modified file 'Percona-Server/support-files/mysql.spec.sh'
4918--- Percona-Server/support-files/mysql.spec.sh 2011-10-04 13:58:19 +0000
4919+++ Percona-Server/support-files/mysql.spec.sh 2012-11-08 17:45:27 +0000
4920@@ -374,7 +374,7 @@
4921 # Evaluate current setting of $DEBUG
4922 if [ $DEBUG -gt 0 ] ; then
4923 OPT_COMMENT='--with-comment="%{debug_comment}"'
4924- OPT_DEBUG='--with-debug'
4925+ OPT_DEBUG='--with-debug --enable-mysql-maintainer-mode=no'
4926 CFLAGS=`echo " $CFLAGS " | \
4927 sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
4928 -e 's/^ //' -e 's/ $//'`
4929@@ -1191,6 +1191,11 @@
4930 # merging BK trees)
4931 ##############################################################################
4932 %changelog
4933+* Tue Sep 11 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
4934+
4935+- Disable "maintainer mode" in debug builds, there is a cast ulonglong -> int
4936+ in the sources (since 2007) that would cause builds to fail.
4937+
4938 * Wed Sep 14 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
4939
4940 - Let the RPM capabilities ("obsoletes" etc) ensure that an upgrade may replace
4941
4942=== modified file 'Percona-Server/vio/viosslfactories.c'
4943--- Percona-Server/vio/viosslfactories.c 2012-08-20 00:29:22 +0000
4944+++ Percona-Server/vio/viosslfactories.c 2012-11-08 17:45:27 +0000
4945@@ -101,47 +101,51 @@
4946 DBUG_ENTER("vio_set_cert_stuff");
4947 DBUG_PRINT("enter", ("ctx: 0x%lx cert_file: %s key_file: %s",
4948 (long) ctx, cert_file, key_file));
4949- if (cert_file)
4950- {
4951- if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0)
4952- {
4953- *error= SSL_INITERR_CERT;
4954- DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file));
4955- DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE););
4956- fprintf(stderr, "SSL error: %s from '%s'\n", sslGetErrString(*error),
4957- cert_file);
4958- fflush(stderr);
4959- DBUG_RETURN(1);
4960- }
4961-
4962- if (!key_file)
4963- key_file= cert_file;
4964-
4965- if (SSL_CTX_use_PrivateKey_file(ctx, key_file, SSL_FILETYPE_PEM) <= 0)
4966- {
4967- *error= SSL_INITERR_KEY;
4968- DBUG_PRINT("error", ("%s from file '%s'", sslGetErrString(*error), key_file));
4969- DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE););
4970- fprintf(stderr, "SSL error: %s from '%s'\n", sslGetErrString(*error),
4971- key_file);
4972- fflush(stderr);
4973- DBUG_RETURN(1);
4974- }
4975-
4976- /*
4977- If we are using DSA, we can copy the parameters from the private key
4978- Now we know that a key and cert have been set against the SSL context
4979- */
4980- if (!SSL_CTX_check_private_key(ctx))
4981- {
4982- *error= SSL_INITERR_NOMATCH;
4983- DBUG_PRINT("error", ("%s",sslGetErrString(*error)));
4984- DBUG_EXECUTE("error", ERR_print_errors_fp(DBUG_FILE););
4985- fprintf(stderr, "SSL error: %s\n", sslGetErrString(*error));
4986- fflush(stderr);
4987- DBUG_RETURN(1);
4988- }
4989- }
4990+
4991+ if (!cert_file && key_file)
4992+ cert_file= key_file;
4993+
4994+ if (!key_file && cert_file)
4995+ key_file= cert_file;
4996+
4997+ if (cert_file &&
4998+ SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0)
4999+ {
5000+ *error= SSL_INITERR_CERT;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches