summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-26 14:17:19 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-26 14:17:19 +0200
commit226ca250ed841fa57c8b15e3a5174cec5bd961e6 (patch)
tree5227221d70a69208effd1a652783100605b8442f
parentb30bbb7d9a1c3855c901b74735660e49ab64a2a8 (diff)
parent42fd53724420627da65c3862f0fef0acffca3241 (diff)
downloadmariadb-git-226ca250ed841fa57c8b15e3a5174cec5bd961e6.tar.gz
Merge 10.1 into 10.2
-rw-r--r--extra/mariabackup/backup_copy.cc1
-rw-r--r--extra/mariabackup/changed_page_bitmap.cc1
-rw-r--r--extra/mariabackup/ds_compress.cc1
-rw-r--r--extra/mariabackup/xtrabackup.cc1
-rw-r--r--mysql-test/r/func_group.result8
-rw-r--r--mysql-test/r/log_slow_debug.result13
-rw-r--r--mysql-test/r/ps_error.result12
-rw-r--r--mysql-test/r/type_decimal.result20
-rw-r--r--mysql-test/suite/mariabackup/absolute_ibdata_paths.opt3
-rw-r--r--mysql-test/suite/mariabackup/absolute_ibdata_paths.test26
-rw-r--r--mysql-test/t/log_slow_debug.test13
-rw-r--r--mysql-test/t/type_decimal.test21
-rw-r--r--sql/item.h7
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/sql_select.cc4
-rw-r--r--storage/innobase/buf/buf0buf.cc42
-rw-r--r--storage/xtradb/buf/buf0buf.cc31
-rw-r--r--tests/mysql_client_test.c2
21 files changed, 141 insertions, 82 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 7543ed89b1f..30ec5539c2d 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1213,6 +1213,7 @@ copy_or_move_file(const char *src_file_path,
if (!directory_exists(dst_dir, true)) {
ret = false;
+ free(link_filepath);
goto cleanup;
}
diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc
index c336aa1229d..f6e9812b0c5 100644
--- a/extra/mariabackup/changed_page_bitmap.cc
+++ b/extra/mariabackup/changed_page_bitmap.cc
@@ -380,6 +380,7 @@ log_online_setup_bitmap_file_range(
msg("InnoDB: Error: inconsistent bitmap file "
"directory");
+ os_file_closedir(bitmap_dir);
free(bitmap_files->files);
return FALSE;
}
diff --git a/extra/mariabackup/ds_compress.cc b/extra/mariabackup/ds_compress.cc
index 16dbe4ffb34..e356ff6ac97 100644
--- a/extra/mariabackup/ds_compress.cc
+++ b/extra/mariabackup/ds_compress.cc
@@ -384,6 +384,7 @@ create_worker_threads(uint n)
return threads;
err:
+ my_free(threads);
return NULL;
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index d03f657d487..94409c846a5 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -5278,6 +5278,7 @@ next_file_item_1:
fileinfo.name, NULL))
{
os_file_closedir(dbdir);
+ os_file_closedir(dir);
return(FALSE);
}
}
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c4e991e8cbe..44bff4bb03e 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1979,8 +1979,8 @@ FROM t2);
MIN(t2.pk)
NULL
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'j'
-Warning 1292 Truncated incorrect INTEGER value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
EXPLAIN
SELECT MIN(t2.pk)
@@ -1993,8 +1993,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'j'
-Warning 1292 Truncated incorrect INTEGER value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
+Warning 1292 Truncated incorrect DOUBLE value: 'j'
#
# 2) Test that subquery materialization is setup for query with
diff --git a/mysql-test/r/log_slow_debug.result b/mysql-test/r/log_slow_debug.result
index bf803ad0530..a823f4c2b98 100644
--- a/mysql-test/r/log_slow_debug.result
+++ b/mysql-test/r/log_slow_debug.result
@@ -14,14 +14,6 @@ FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%';
END
$$
-CREATE PROCEDURE show_slow_log_exclude_ps()
-BEGIN
-SELECT CONCAT('[slow] ', sql_text) AS sql_text
-FROM mysql.slow_log
-WHERE sql_text NOT LIKE '%debug_dbug%'
- AND sql_text NOT IN ('Prepare','Close stmt');
-END
-$$
#
# Expect all admin statements in the slow log (ON,DEFAULT)
#
@@ -41,7 +33,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
-CALL show_slow_log_exclude_ps();
+CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
@@ -123,7 +115,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
-CALL show_slow_log_exclude_ps();
+CALL show_slow_log();
sql_text
[slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT)
@@ -143,4 +135,3 @@ SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;
-DROP PROCEDURE show_slow_log_exclude_ps;
diff --git a/mysql-test/r/ps_error.result b/mysql-test/r/ps_error.result
index c3c312e82f5..e8a9f45494c 100644
--- a/mysql-test/r/ps_error.result
+++ b/mysql-test/r/ps_error.result
@@ -5,7 +5,7 @@ SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT a FROM t1 GROUP BY NULL WITH ROLLUP;
@@ -16,7 +16,7 @@ SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ;
@@ -28,7 +28,7 @@ SET sql_mode=DEFAULT;
SET SQL_MODE='STRICT_ALL_TABLES';
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT 'All done';
@@ -38,7 +38,7 @@ SET SQL_MODE=DEFAULT;
SET SQL_MODE='STRICT_ALL_TABLES';
PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0";
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
DEALLOCATE PREPARE stmt;
@@ -50,7 +50,7 @@ SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT a FROM t1 GROUP BY a;
@@ -63,7 +63,7 @@ SET SQL_MODE= 'STRICT_ALL_TABLES';
CREATE TABLE t1 (a INT);
PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0";
Warnings:
-Warning 1292 Truncated incorrect INTEGER value: 'foo'
+Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect INTEGER value: 'foo'
SELECT a FROM t1 GROUP BY a;
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 174cbaebb81..2a410d2ce97 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -1020,6 +1020,26 @@ cast('-0.0' as decimal(5,1)) < 0
# End of 5.5 tests
#
#
+# Start of 10.1 tests
+#
+#
+# MDEV-18968 Both (WHERE 0.1) and (WHERE NOT 0.1) return empty set
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10);
+SELECT CASE WHEN 0.1 THEN 'TRUE' ELSE 'FALSE' END FROM t1;
+CASE WHEN 0.1 THEN 'TRUE' ELSE 'FALSE' END
+TRUE
+SELECT * FROM t1 WHERE 0.1;
+a
+10
+SELECT * FROM t1 WHERE NOT 0.1;
+a
+DROP TABLE t1;
+#
+# End of 10.1 tests
+#
+#
# Start of 10.2 tests
#
#
diff --git a/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt b/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt
index 71996e09b18..6c6a45cb572 100644
--- a/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt
+++ b/mysql-test/suite/mariabackup/absolute_ibdata_paths.opt
@@ -1 +1,2 @@
---innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:3M;ibdata_second:1M:autoextend --innodb-undo-tablespaces=2 \ No newline at end of file
+--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:6M;ibdata_second:1M:autoextend
+--innodb-undo-tablespaces=2
diff --git a/mysql-test/suite/mariabackup/absolute_ibdata_paths.test b/mysql-test/suite/mariabackup/absolute_ibdata_paths.test
index 6717f16d199..fa304f0bc55 100644
--- a/mysql-test/suite/mariabackup/absolute_ibdata_paths.test
+++ b/mysql-test/suite/mariabackup/absolute_ibdata_paths.test
@@ -2,12 +2,32 @@
# Innodb system tablespace is specified with absolute path in the .opt file
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR= `SELECT @@datadir`;
+--source include/shutdown_mysqld.inc
+perl;
+my $file= "$ENV{MYSQLD_DATADIR}/ibdata_second";
+open(FILE, "+<", $file) or die "Unable to open $file\n";
+binmode FILE;
+my $ps= $ENV{INNODB_PAGE_SIZE};
+my $page;
+my $pos = $ps * 0;
+sysseek(FILE, $pos, 0) || die "Unable to seek $file\n";
+die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
+substr($page,26,8) = pack("NN", 1, 1);
+sysseek(FILE, $pos, 0) || die "Unable to rewind $file\n";
+syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
+close(FILE) || die "Unable to close $file\n";
+EOF
+
+--source include/start_mysqld.inc
+
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $_innodb_data_file_path=`select @@innodb_data_file_path`;
let $_innodb_data_home_dir=`select @@innodb_data_home_dir`;
-let $_datadir= `SELECT @@datadir`;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
@@ -16,11 +36,11 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
--source include/shutdown_mysqld.inc
echo # remove datadir;
-rmdir $_datadir;
+rmdir $MYSQLD_DATADIR;
#remove out-of-datadir ibdata1
remove_file $MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1;
echo # xtrabackup copy back;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir "--innodb_data_file_path=$_innodb_data_file_path" --innodb_data_home_dir=$_innodb_data_home_dir;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$MYSQLD_DATADIR --target-dir=$targetdir "--innodb_data_file_path=$_innodb_data_file_path" --innodb_data_home_dir=$_innodb_data_home_dir;
echo # restart server;
--source include/start_mysqld.inc
--enable_result_log
diff --git a/mysql-test/t/log_slow_debug.test b/mysql-test/t/log_slow_debug.test
index 7945328fee3..35b5b93423d 100644
--- a/mysql-test/t/log_slow_debug.test
+++ b/mysql-test/t/log_slow_debug.test
@@ -19,14 +19,6 @@ BEGIN
WHERE sql_text NOT LIKE '%debug_dbug%';
END
$$
-CREATE PROCEDURE show_slow_log_exclude_ps()
-BEGIN
- SELECT CONCAT('[slow] ', sql_text) AS sql_text
- FROM mysql.slow_log
- WHERE sql_text NOT LIKE '%debug_dbug%'
- AND sql_text NOT IN ('Prepare','Close stmt');
-END
-$$
DELIMITER ;$$
@@ -50,7 +42,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
-CALL show_slow_log_exclude_ps();
+CALL show_slow_log();
--echo #
@@ -119,7 +111,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t4;
-CALL show_slow_log_exclude_ps();
+CALL show_slow_log();
--echo #
@@ -132,4 +124,3 @@ SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log;
-DROP PROCEDURE show_slow_log_exclude_ps;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index c5b64846f65..77c9c2875e2 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -613,6 +613,27 @@ select cast('-0.0' as decimal(5,1)) < 0;
--echo # End of 5.5 tests
--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-18968 Both (WHERE 0.1) and (WHERE NOT 0.1) return empty set
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10);
+SELECT CASE WHEN 0.1 THEN 'TRUE' ELSE 'FALSE' END FROM t1;
+SELECT * FROM t1 WHERE 0.1;
+SELECT * FROM t1 WHERE NOT 0.1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
--echo #
--echo # Start of 10.2 tests
--echo #
diff --git a/sql/item.h b/sql/item.h
index ac79e3437fb..466f8d15df8 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1140,6 +1140,13 @@ public:
virtual bool val_bool();
virtual String *val_nodeset(String*) { return 0; }
+ bool eval_const_cond()
+ {
+ DBUG_ASSERT(const_item());
+ DBUG_ASSERT(!is_expensive());
+ return val_bool();
+ }
+
/*
save_val() is method of val_* family which stores value in the given
field.
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index badb0191471..8e237ef1d65 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4616,7 +4616,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
if (item->const_item() && !item->with_param &&
!item->is_expensive() && !cond_has_datetime_is_null(item))
{
- if (item->val_int() == is_and_cond && top_level())
+ if (item->eval_const_cond() == is_and_cond && top_level())
{
/*
a. This is "... AND true_cond AND ..."
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 28933aba7af..039b4f42f98 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -70,18 +70,6 @@ bool check_reserved_words(LEX_STRING *name)
/**
- @return
- TRUE if item is a constant
-*/
-
-bool
-eval_const_cond(COND *cond)
-{
- return ((Item_func*) cond)->val_int() ? TRUE : FALSE;
-}
-
-
-/**
Test if the sum of arguments overflows the ulonglong range.
*/
static inline bool test_if_sum_overflows_ull(ulonglong arg1, ulonglong arg2)
diff --git a/sql/item_func.h b/sql/item_func.h
index 7565a8d5a08..487993b581f 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -2556,7 +2556,6 @@ extern enum_field_types agg_field_type(Item **items, uint nitems,
bool treat_bit_as_number);
double my_double_round(double value, longlong dec, bool dec_unsigned,
bool truncate);
-bool eval_const_cond(COND *cond);
extern bool volatile mqh_used;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a0107347fde..a0029b5440d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -6597,7 +6597,7 @@ static bool check_rename_table(THD *thd, TABLE_LIST *first_table,
0, 0))
return 1;
- /* check if these are refering to temporary tables */
+ /* check if these are referring to temporary tables */
table->table= find_temporary_table_for_rename(thd, first_table, table);
table->next_local->table= table->table;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6253c39b777..c3acdf7415b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -15833,7 +15833,7 @@ Item::remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level_ar
{
if (const_item() && !is_expensive())
{
- *cond_value= eval_const_cond(this) ? Item::COND_TRUE : Item::COND_FALSE;
+ *cond_value= eval_const_cond() ? Item::COND_TRUE : Item::COND_FALSE;
return (COND*) 0;
}
*cond_value= Item::COND_OK;
@@ -15847,7 +15847,7 @@ Item_bool_func2::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
{
if (const_item() && !is_expensive())
{
- *cond_value= eval_const_cond(this) ? Item::COND_TRUE : Item::COND_FALSE;
+ *cond_value= eval_const_cond() ? Item::COND_TRUE : Item::COND_FALSE;
return (COND*) 0;
}
if ((*cond_value= eq_cmp_result()) != Item::COND_OK)
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index df607a6fc7a..ca0a52a3e90 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -940,6 +940,7 @@ buf_page_is_corrupted(
const void* space)
#endif
{
+ ut_ad(page_size.logical() == srv_page_size);
#ifndef UNIV_INNOCHECKSUM
DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); );
#endif
@@ -1035,26 +1036,31 @@ buf_page_is_corrupted(
#error "FIL_PAGE_LSN must be 64 bit aligned"
#endif
- /* declare empty pages non-corrupted */
- if (checksum_field1 == 0
- && checksum_field2 == 0
- && *reinterpret_cast<const ib_uint64_t*>(
- read_buf + FIL_PAGE_LSN) == 0) {
-
- /* make sure that the page is really empty */
- for (ulint i = 0; i < page_size.logical(); i++) {
- if (read_buf[i] != 0) {
- return(true);
+ /* A page filled with NUL bytes is considered not corrupted.
+ The FIL_PAGE_FILE_FLUSH_LSN field may be written nonzero for
+ the first page of each file of the system tablespace.
+ Ignore it for the system tablespace. */
+ if (!checksum_field1 && !checksum_field2) {
+ ulint i = 0;
+ do {
+ if (read_buf[i]) {
+ return true;
}
+ } while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+
+#ifndef UNIV_INNOCHECKSUM
+ if (!space || !space->id) {
+ /* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ in the system tablespace. */
+ i += 8;
}
-#ifdef UNIV_INNOCHECKSUM
- if (log_file) {
- fprintf(log_file, "Page::%llu"
- " is empty and uncorrupted\n",
- cur_page_num);
- }
-#endif /* UNIV_INNOCHECKSUM */
- return(false);
+#endif
+ do {
+ if (read_buf[i]) {
+ return true;
+ }
+ } while (++i < srv_page_size);
+ return false;
}
switch (curr_algo) {
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index b03aafb6fc7..993f321c345 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -945,18 +945,29 @@ buf_page_is_corrupted(
#error "FIL_PAGE_LSN must be 64 bit aligned"
#endif
- /* declare empty pages non-corrupted */
- if (checksum_field1 == 0 && checksum_field2 == 0
- && *reinterpret_cast<const ib_uint64_t*>(read_buf +
- FIL_PAGE_LSN) == 0) {
- /* make sure that the page is really empty */
- for (ulint i = 0; i < UNIV_PAGE_SIZE; i++) {
- if (read_buf[i] != 0) {
- return(true);
+ /* A page filled with NUL bytes is considered not corrupted.
+ The FIL_PAGE_FILE_FLUSH_LSN field may be written nonzero for
+ the first page of each file of the system tablespace.
+ Ignore it for the system tablespace. */
+ if (!checksum_field1 && !checksum_field2) {
+ ulint i = 0;
+ do {
+ if (read_buf[i]) {
+ return true;
}
- }
+ } while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
- return(false);
+ if (!space || !space->id) {
+ /* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ in the system tablespace. */
+ i += 8;
+ }
+ do {
+ if (read_buf[i]) {
+ return true;
+ }
+ } while (++i < srv_page_size);
+ return false;
}
switch (curr_algo) {
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 9c64342954a..be16db0fc9e 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -19594,8 +19594,8 @@ static void test_big_packet()
opt_password, current_db, opt_port,
opt_unix_socket, 0)))
{
- mysql_close(mysql_local);
fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local));
+ mysql_close(mysql_local);
exit(1);
}