diff options
author | unknown <sanja@montyprogram.com> | 2013-08-20 14:48:29 +0300 |
---|---|---|
committer | unknown <sanja@montyprogram.com> | 2013-08-20 14:48:29 +0300 |
commit | 35b2883643e337a8ec9c3cf7494363ae9889119c (patch) | |
tree | eb2e7d833ed965b30f8b8485cfdac31abfea6c97 /storage | |
parent | dafa458262fb47a2c9534bcc36088b15e26307c2 (diff) | |
parent | b59738a598569ace75be5e63b7ed6ca69afe6ebc (diff) | |
download | mariadb-git-35b2883643e337a8ec9c3cf7494363ae9889119c.tar.gz |
merge 5.5 -> 10.0-base
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff | 12 | ||||
-rw-r--r-- | storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff | 80 | ||||
-rw-r--r-- | storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff | 28 | ||||
-rw-r--r-- | storage/maria/ma_range.c | 4 | ||||
-rw-r--r-- | storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff | 28 | ||||
-rw-r--r-- | storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff | 52 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0buf.c | 6 | ||||
-rw-r--r-- | storage/xtradb/fil/fil0fil.c | 103 | ||||
-rw-r--r-- | storage/xtradb/include/buf0buf.h | 7 | ||||
-rw-r--r-- | storage/xtradb/include/fil0fil.h | 13 | ||||
-rw-r--r-- | storage/xtradb/os/os0file.c | 4 | ||||
-rw-r--r-- | storage/xtradb/srv/srv0start.c | 23 | ||||
-rw-r--r-- | storage/xtradb/trx/trx0sys.c | 8 |
13 files changed, 209 insertions, 159 deletions
diff --git a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff index 77ee7e2eb31..a35ba5167d9 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff @@ -1,25 +1,25 @@ ---- suite/storage_engine/parts/optimize_table.result 2012-07-12 22:16:39.343572304 +0400 -+++ suite/storage_engine/parts/optimize_table.reject 2012-07-15 20:07:01.632130348 +0400 +--- suite/storage_engine/parts/optimize_table.result 2013-07-18 22:55:38.000000000 +0400 ++++ suite/storage_engine/parts/optimize_table.reject 2013-08-05 19:45:19.000000000 +0400 @@ -9,18 +9,22 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); ALTER TABLE t1 OPTIMIZE PARTITION p1; Table Op Msg_type Msg_text -+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead ++test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t2 (a,b) VALUES (4,'d'); ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG; Table Op Msg_type Msg_text -+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead ++test.t2 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t2 optimize status OK INSERT INTO t1 (a,b) VALUES (6,'f'); ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL; Table Op Msg_type Msg_text -+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead ++test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t1 optimize status OK INSERT INTO t2 (a,b) VALUES (5,'e'); ALTER TABLE t2 OPTIMIZE PARTITION p1,p0; Table Op Msg_type Msg_text -+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead ++test.t2 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed. test.t2 optimize status OK DROP TABLE t1, t2; DROP TABLE IF EXISTS t1,t2; diff --git a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff index 7ddc57e0ead..35b150e82d1 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,26 +1,6 @@ ---- suite/storage_engine/parts/repair_table.result 2013-01-23 01:35:44.388267080 +0400 -+++ suite/storage_engine/parts/repair_table.reject 2013-01-23 01:44:40.337529283 +0400 -@@ -9,27 +9,27 @@ - INSERT INTO t2 (a,b) SELECT a, b FROM t1; - ALTER TABLE t1 REPAIR PARTITION p0; - Table Op Msg_type Msg_text --test.t1 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 (a,b) VALUES (3,'c'); - ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1; - Table Op Msg_type Msg_text --test.t1 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); - ALTER TABLE t2 REPAIR PARTITION LOCAL p1; - Table Op Msg_type Msg_text --test.t2 repair status OK -+test.t2 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); - ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED; - Table Op Msg_type Msg_text --test.t1 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair +--- suite/storage_engine/parts/repair_table.result 2013-07-18 22:55:38.000000000 +0400 ++++ suite/storage_engine/parts/repair_table.reject 2013-08-05 19:54:09.000000000 +0400 +@@ -25,7 +25,7 @@ INSERT INTO t1 (a,b) VALUES (10,'j'); ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; Table Op Msg_type Msg_text @@ -29,39 +9,7 @@ INSERT INTO t2 (a,b) VALUES (12,'l'); ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM; Table Op Msg_type Msg_text --test.t2 repair status OK -+test.t2 repair note The storage engine for the table doesn't support repair - DROP TABLE t1, t2; - DROP TABLE IF EXISTS t1,t2; - CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; -@@ -37,35 +37,35 @@ - CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; - REPAIR TABLE t1; - Table Op Msg_type Msg_text --test.t1 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 (a,b) VALUES (3,'c'); - INSERT INTO t2 (a,b) VALUES (4,'d'); - REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2; - Table Op Msg_type Msg_text --test.t1 repair status OK --test.t2 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair -+test.t2 repair note The storage engine for the table doesn't support repair - INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f'); - REPAIR LOCAL TABLE t2; - Table Op Msg_type Msg_text --test.t2 repair status OK -+test.t2 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); - INSERT INTO t2 (a,b) VALUES (9,'i'); - REPAIR LOCAL TABLE t2, t1 EXTENDED; - Table Op Msg_type Msg_text --test.t2 repair status OK --test.t1 repair status OK -+test.t2 repair note The storage engine for the table doesn't support repair -+test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 (a,b) VALUES (10,'j'); +@@ -58,8 +58,8 @@ INSERT INTO t2 (a,b) VALUES (11,'k'); REPAIR TABLE t1, t2 QUICK USE_FRM; Table Op Msg_type Msg_text @@ -72,25 +20,7 @@ INSERT INTO t1 (a,b) VALUES (12,'l'); INSERT INTO t2 (a,b) VALUES (13,'m'); REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM; - Table Op Msg_type Msg_text --test.t1 repair status OK --test.t2 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair -+test.t2 repair note The storage engine for the table doesn't support repair - FLUSH TABLE t1; - INSERT INTO t1 (a,b) VALUES (14,'n'); - ERROR HY000: Failed to read from the .par file -@@ -93,127 +93,21 @@ - CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2; - REPAIR TABLE t1; - Table Op Msg_type Msg_text --test.t1 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair - INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h'); - REPAIR TABLE t1 EXTENDED; - Table Op Msg_type Msg_text --test.t1 repair status OK -+test.t1 repair note The storage engine for the table doesn't support repair +@@ -101,119 +101,13 @@ INSERT INTO t1 (a,b) VALUES (10,'j'); REPAIR TABLE t1 USE_FRM; Table Op Msg_type Msg_text diff --git a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff index 9061900182e..04572ee03be 100644 --- a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_spatial_indexes.result 2013-01-23 01:25:45.367797786 +0400 -+++ suite/storage_engine/type_spatial_indexes.reject 2013-01-23 01:46:17.560307029 +0400 +--- suite/storage_engine/type_spatial_indexes.result 2013-08-05 18:08:49.000000000 +0400 ++++ suite/storage_engine/type_spatial_indexes.reject 2013-08-05 18:25:24.000000000 +0400 @@ -702,699 +702,15 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; @@ -416,20 +416,20 @@ -first second w c o e d t i r -120 120 1 1 0 1 0 1 1 0 -120 121 0 0 1 0 0 0 1 0 --120 122 0 1 NULL 0 NULL 0 NULL 0 --120 123 0 1 NULL 0 NULL 0 NULL 0 +-120 122 NULL NULL NULL NULL NULL NULL NULL NULL +-120 123 NULL NULL NULL NULL NULL NULL NULL NULL -121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 --121 122 0 1 NULL 0 NULL 0 NULL 0 --121 123 0 1 NULL 0 NULL 0 NULL 0 --122 120 1 0 NULL 0 NULL 0 NULL 0 --122 121 1 0 NULL 0 NULL 0 NULL 0 --122 122 1 1 NULL 1 NULL 0 NULL 0 --122 123 1 1 NULL 1 NULL 0 NULL 0 --123 120 1 0 NULL 0 NULL 0 NULL 0 --123 121 1 0 NULL 0 NULL 0 NULL 0 --123 122 1 1 NULL 1 NULL 0 NULL 0 --123 123 1 1 NULL 1 NULL 0 NULL 0 +-121 122 NULL NULL NULL NULL NULL NULL NULL NULL +-121 123 NULL NULL NULL NULL NULL NULL NULL NULL +-122 120 NULL NULL NULL NULL NULL NULL NULL NULL +-122 121 NULL NULL NULL NULL NULL NULL NULL NULL +-122 122 NULL NULL NULL NULL NULL NULL NULL NULL +-122 123 NULL NULL NULL NULL NULL NULL NULL NULL +-123 120 NULL NULL NULL NULL NULL NULL NULL NULL +-123 121 NULL NULL NULL NULL NULL NULL NULL NULL +-123 122 NULL NULL NULL NULL NULL NULL NULL NULL +-123 123 NULL NULL NULL NULL NULL NULL NULL NULL -DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -USE gis_ogs; -# Lakes diff --git a/storage/maria/ma_range.c b/storage/maria/ma_range.c index bb72c10bba7..2a01359f1a1 100644 --- a/storage/maria/ma_range.c +++ b/storage/maria/ma_range.c @@ -144,6 +144,10 @@ static ha_rows _ma_record_pos(MARIA_HA *info, const uchar *key_data, (HA_KEYSEG**) 0); DBUG_EXECUTE("key", _ma_print_key(DBUG_FILE, &key);); nextflag=maria_read_vec[search_flag]; + + /* Indicate if we're doing a search on a key prefix */ + if (((((key_part_map)1) << key.keyinfo->keysegs) - 1) != keypart_map) + nextflag |= SEARCH_PART_KEY; /* my_handler.c:ha_compare_text() has a flag 'skip_end_space'. diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff index dbf29fb8d00..52e9d9fdbe4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff @@ -1,5 +1,5 @@ ---- type_spatial.result 2013-01-23 01:25:39.143876032 +0400 -+++ type_spatial.reject 2013-01-23 02:51:14.535315418 +0400 +--- suite/storage_engine/type_spatial.result 2013-08-05 17:52:53.000000000 +0400 ++++ suite/storage_engine/type_spatial.reject 2013-08-05 17:56:37.000000000 +0400 @@ -2,699 +2,15 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; @@ -416,20 +416,20 @@ -first second w c o e d t i r -120 120 1 1 0 1 0 1 1 0 -120 121 0 0 1 0 0 0 1 0 --120 122 0 1 NULL 0 NULL 0 NULL 0 --120 123 0 1 NULL 0 NULL 0 NULL 0 +-120 122 NULL NULL NULL NULL NULL NULL NULL NULL +-120 123 NULL NULL NULL NULL NULL NULL NULL NULL -121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 --121 122 0 1 NULL 0 NULL 0 NULL 0 --121 123 0 1 NULL 0 NULL 0 NULL 0 --122 120 1 0 NULL 0 NULL 0 NULL 0 --122 121 1 0 NULL 0 NULL 0 NULL 0 --122 122 1 1 NULL 1 NULL 0 NULL 0 --122 123 1 1 NULL 1 NULL 0 NULL 0 --123 120 1 0 NULL 0 NULL 0 NULL 0 --123 121 1 0 NULL 0 NULL 0 NULL 0 --123 122 1 1 NULL 1 NULL 0 NULL 0 --123 123 1 1 NULL 1 NULL 0 NULL 0 +-121 122 NULL NULL NULL NULL NULL NULL NULL NULL +-121 123 NULL NULL NULL NULL NULL NULL NULL NULL +-122 120 NULL NULL NULL NULL NULL NULL NULL NULL +-122 121 NULL NULL NULL NULL NULL NULL NULL NULL +-122 122 NULL NULL NULL NULL NULL NULL NULL NULL +-122 123 NULL NULL NULL NULL NULL NULL NULL NULL +-123 120 NULL NULL NULL NULL NULL NULL NULL NULL +-123 121 NULL NULL NULL NULL NULL NULL NULL NULL +-123 122 NULL NULL NULL NULL NULL NULL NULL NULL +-123 123 NULL NULL NULL NULL NULL NULL NULL NULL -DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -USE gis_ogs; -# Lakes diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff index 20d98db1ff2..ecd0025c9d9 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff @@ -1,5 +1,5 @@ ---- type_spatial_indexes.result 2013-01-23 01:25:45.367797786 +0400 -+++ type_spatial_indexes.reject 2013-01-23 02:51:15.247306467 +0400 +--- suite/storage_engine/type_spatial_indexes.result 2013-08-05 18:08:49.000000000 +0400 ++++ suite/storage_engine/type_spatial_indexes.reject 2013-08-05 18:27:47.000000000 +0400 @@ -2,1399 +2,31 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; @@ -416,20 +416,20 @@ -first second w c o e d t i r -120 120 1 1 0 1 0 1 1 0 -120 121 0 0 1 0 0 0 1 0 --120 122 0 1 NULL 0 NULL 0 NULL 0 --120 123 0 1 NULL 0 NULL 0 NULL 0 +-120 122 NULL NULL NULL NULL NULL NULL NULL NULL +-120 123 NULL NULL NULL NULL NULL NULL NULL NULL -121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 --121 122 0 1 NULL 0 NULL 0 NULL 0 --121 123 0 1 NULL 0 NULL 0 NULL 0 --122 120 1 0 NULL 0 NULL 0 NULL 0 --122 121 1 0 NULL 0 NULL 0 NULL 0 --122 122 1 1 NULL 1 NULL 0 NULL 0 --122 123 1 1 NULL 1 NULL 0 NULL 0 --123 120 1 0 NULL 0 NULL 0 NULL 0 --123 121 1 0 NULL 0 NULL 0 NULL 0 --123 122 1 1 NULL 1 NULL 0 NULL 0 --123 123 1 1 NULL 1 NULL 0 NULL 0 +-121 122 NULL NULL NULL NULL NULL NULL NULL NULL +-121 123 NULL NULL NULL NULL NULL NULL NULL NULL +-122 120 NULL NULL NULL NULL NULL NULL NULL NULL +-122 121 NULL NULL NULL NULL NULL NULL NULL NULL +-122 122 NULL NULL NULL NULL NULL NULL NULL NULL +-122 123 NULL NULL NULL NULL NULL NULL NULL NULL +-123 120 NULL NULL NULL NULL NULL NULL NULL NULL +-123 121 NULL NULL NULL NULL NULL NULL NULL NULL +-123 122 NULL NULL NULL NULL NULL NULL NULL NULL +-123 123 NULL NULL NULL NULL NULL NULL NULL NULL -DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -USE gis_ogs; -# Lakes @@ -1126,20 +1126,20 @@ -first second w c o e d t i r -120 120 1 1 0 1 0 1 1 0 -120 121 0 0 1 0 0 0 1 0 --120 122 0 1 NULL 0 NULL 0 NULL 0 --120 123 0 1 NULL 0 NULL 0 NULL 0 +-120 122 NULL NULL NULL NULL NULL NULL NULL NULL +-120 123 NULL NULL NULL NULL NULL NULL NULL NULL -121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 --121 122 0 1 NULL 0 NULL 0 NULL 0 --121 123 0 1 NULL 0 NULL 0 NULL 0 --122 120 1 0 NULL 0 NULL 0 NULL 0 --122 121 1 0 NULL 0 NULL 0 NULL 0 --122 122 1 1 NULL 1 NULL 0 NULL 0 --122 123 1 1 NULL 1 NULL 0 NULL 0 --123 120 1 0 NULL 0 NULL 0 NULL 0 --123 121 1 0 NULL 0 NULL 0 NULL 0 --123 122 1 1 NULL 1 NULL 0 NULL 0 --123 123 1 1 NULL 1 NULL 0 NULL 0 +-121 122 NULL NULL NULL NULL NULL NULL NULL NULL +-121 123 NULL NULL NULL NULL NULL NULL NULL NULL +-122 120 NULL NULL NULL NULL NULL NULL NULL NULL +-122 121 NULL NULL NULL NULL NULL NULL NULL NULL +-122 122 NULL NULL NULL NULL NULL NULL NULL NULL +-122 123 NULL NULL NULL NULL NULL NULL NULL NULL +-123 120 NULL NULL NULL NULL NULL NULL NULL NULL +-123 121 NULL NULL NULL NULL NULL NULL NULL NULL +-123 122 NULL NULL NULL NULL NULL NULL NULL NULL +-123 123 NULL NULL NULL NULL NULL NULL NULL NULL -DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry; -USE gis_ogs; -# Lakes diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c index b294c88497e..1084dcdf344 100644 --- a/storage/xtradb/buf/buf0buf.c +++ b/storage/xtradb/buf/buf0buf.c @@ -581,6 +581,8 @@ UNIV_INTERN ibool buf_page_is_corrupted( /*==================*/ + ibool check_lsn, /*!< in: TRUE if we need to check + and complain about the LSN */ const byte* read_buf, /*!< in: a database page */ ulint zip_size) /*!< in: size of compressed page; 0 for uncompressed pages */ @@ -600,7 +602,7 @@ buf_page_is_corrupted( } #ifndef UNIV_HOTBACKUP - if (recv_lsn_checks_on) { + if (check_lsn && recv_lsn_checks_on) { ib_uint64_t current_lsn; if (log_peek_lsn(¤t_lsn) @@ -3945,7 +3947,7 @@ buf_page_io_complete( /* From version 3.23.38 up we store the page checksum to the 4 first bytes of the page end lsn field */ - if (buf_page_is_corrupted(frame, + if (buf_page_is_corrupted(TRUE, frame, buf_page_get_zip_size(bpage))) { corrupt: fprintf(stderr, diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c index 48f3c43cdc0..929e24d20ce 100644 --- a/storage/xtradb/fil/fil0fil.c +++ b/storage/xtradb/fil/fil0fil.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1884,10 +1884,62 @@ fil_write_flushed_lsn_to_data_files( } /*******************************************************************//** +Checks the consistency of the first data page of a data file +at database startup. +@retval NULL on success, or if innodb_force_recovery is set +@return pointer to an error message string */ +static __attribute__((warn_unused_result)) +const char* +fil_check_first_page( +/*=================*/ + const page_t* page, /*!< in: data page */ + ibool first_page) /*!< in: TRUE if this is the + first page of the tablespace */ +{ + ulint space_id; + ulint flags; + + if (srv_force_recovery >= SRV_FORCE_IGNORE_CORRUPT) { + return(NULL); + } + + space_id = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page); + flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); + + if (first_page && !space_id && !flags) { + ulint nonzero_bytes = UNIV_PAGE_SIZE; + const byte* b = page; + + while (!*b && --nonzero_bytes) { + b++; + } + + if (!nonzero_bytes) { + return("space header page consists of zero bytes"); + } + } + + if (buf_page_is_corrupted( + FALSE, page, dict_table_flags_to_zip_size(flags))) { + return("checksum mismatch"); + } + + if (!first_page + || (page_get_space_id(page) == space_id + && page_get_page_no(page) == 0)) { + return(NULL); + } + + return("inconsistent data in space header"); +} + +/*******************************************************************//** Reads the flushed lsn, arch no, and tablespace flag fields from a data -file at database startup. */ +file at database startup. +@retval NULL on success, or if innodb_force_recovery is set +@return pointer to an error message string */ UNIV_INTERN -void +const char* fil_read_first_page( /*================*/ os_file_t data_file, /*!< in: open data file */ @@ -1909,6 +1961,7 @@ fil_read_first_page( byte* buf; page_t* page; ib_uint64_t flushed_lsn; + const char* check_msg; buf = ut_malloc(2 * UNIV_PAGE_SIZE); /* Align the memory for a possible read from a raw device */ @@ -1916,13 +1969,18 @@ fil_read_first_page( os_file_read(data_file, page, 0, 0, UNIV_PAGE_SIZE); - *flags = mach_read_from_4(page + - FSP_HEADER_OFFSET + FSP_SPACE_FLAGS); + *flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); flushed_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN); + check_msg = fil_check_first_page(page, !one_read_already); + ut_free(buf); + if (check_msg) { + return(check_msg); + } + if (!one_read_already) { *min_flushed_lsn = flushed_lsn; *max_flushed_lsn = flushed_lsn; @@ -1930,7 +1988,7 @@ fil_read_first_page( *min_arch_log_no = arch_log_no; *max_arch_log_no = arch_log_no; #endif /* UNIV_LOG_ARCHIVE */ - return; + return(NULL); } if (*min_flushed_lsn > flushed_lsn) { @@ -1947,6 +2005,8 @@ fil_read_first_page( *max_arch_log_no = arch_log_no; } #endif /* UNIV_LOG_ARCHIVE */ + + return(NULL); } /*================ SINGLE-TABLE TABLESPACES ==========================*/ @@ -3271,6 +3331,7 @@ fil_open_single_table_tablespace( os_file_t file; char* filepath; ibool success; + const char* check_msg; byte* buf2; byte* page; ulint space_id; @@ -3331,6 +3392,8 @@ fil_open_single_table_tablespace( success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE); + check_msg = fil_check_first_page(page, TRUE); + /* We have to read the tablespace id and flags from the file. */ space_id = fsp_header_get_space_id(page); @@ -3366,7 +3429,7 @@ fil_open_single_table_tablespace( current_lsn = log_get_lsn(); /* check the header page's consistency */ - if (buf_page_is_corrupted(page, + if (buf_page_is_corrupted(TRUE, page, dict_table_flags_to_zip_size(space_flags))) { fprintf(stderr, "InnoDB: page 0 of %s seems corrupt.\n", filepath); file_is_corrupt = TRUE; @@ -3788,8 +3851,20 @@ skip_write: ut_free(buf2); - if (UNIV_UNLIKELY(space_id != id - || space_flags != (flags & ~(~0 << DICT_TF_BITS)))) { + if (check_msg) { + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: %s in file ", check_msg); + ut_print_filename(stderr, filepath); + fprintf(stderr, " (tablespace id=%lu, flags=%lu)\n" + "InnoDB: Please refer to " REFMAN + "innodb-troubleshooting-datadict.html\n", + (ulong) id, (ulong) flags); + success = FALSE; + goto func_exit; + } + + if (space_id != id + || space_flags != (flags & ~(~0 << DICT_TF_BITS))) { ut_print_timestamp(stderr); fputs(" InnoDB: Error: tablespace id and flags in file ", @@ -4280,11 +4355,21 @@ fil_load_single_table_tablespace( page = ut_align(buf2, UNIV_PAGE_SIZE); if (size >= FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { + const char* check_msg; success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE); /* We have to read the tablespace id from the file */ + check_msg = fil_check_first_page(page, TRUE); + + if (check_msg) { + fprintf(stderr, + "InnoDB: Error: %s in file %s", + check_msg, filepath); + goto func_exit; + } + space_id = fsp_header_get_space_id(page); flags = fsp_header_get_flags(page); } else { diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index f00a06c8805..233231e4cab 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -684,9 +684,12 @@ UNIV_INTERN ibool buf_page_is_corrupted( /*==================*/ + ibool check_lsn, /*!< in: TRUE if we need to check + and complain about the LSN */ const byte* read_buf, /*!< in: a database page */ - ulint zip_size); /*!< in: size of compressed page; + ulint zip_size) /*!< in: size of compressed page; 0 for uncompressed pages */ + __attribute__((warn_unused_result)); #ifndef UNIV_HOTBACKUP /**********************************************************************//** Gets the space id, page offset, and byte offset within page of a diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 2149d0aadca..881623b30cf 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -328,10 +328,12 @@ fil_write_flushed_lsn_to_data_files( ulint arch_log_no); /*!< in: latest archived log file number */ /*******************************************************************//** -Reads the flushed lsn and arch no fields from a data file at database -startup. */ +Reads the flushed lsn, arch no, and tablespace flag fields from a data +file at database startup. +@retval NULL on success, or if innodb_force_recovery is set +@return pointer to an error message string */ UNIV_INTERN -void +const char* fil_read_first_page( /*================*/ os_file_t data_file, /*!< in: open data file */ @@ -347,8 +349,9 @@ fil_read_first_page( #endif /* UNIV_LOG_ARCHIVE */ ib_uint64_t* min_flushed_lsn, /*!< out: min of flushed lsn values in data files */ - ib_uint64_t* max_flushed_lsn); /*!< out: max of flushed + ib_uint64_t* max_flushed_lsn) /*!< out: max of flushed lsn values in data files */ + __attribute__((warn_unused_result)); /*******************************************************************//** Increments the count of pending operation, if space is not being deleted. @return TRUE if being deleted, and operation should be skipped */ diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c index ae6ba05c9f6..5beed447c91 100644 --- a/storage/xtradb/os/os0file.c +++ b/storage/xtradb/os/os0file.c @@ -3773,6 +3773,10 @@ os_aio_free(void) ut_free(os_aio_segment_wait_events); os_aio_segment_wait_events = 0; os_aio_n_segments = 0; +#ifdef _WIN32 + completion_port = 0; + read_completion_port = 0; +#endif } #ifdef WIN_ASYNC_IO diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c index 6e6c5ff4e41..93416088f17 100644 --- a/storage/xtradb/srv/srv0start.c +++ b/storage/xtradb/srv/srv0start.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2009, Percona Inc. @@ -817,6 +817,7 @@ open_or_create_data_files( } if (ret == FALSE) { + const char* check_msg; /* We open the data file */ if (one_created) { @@ -914,13 +915,20 @@ open_or_create_data_files( return(DB_ERROR); } skip_size_check: - fil_read_first_page( + check_msg = fil_read_first_page( files[i], one_opened, &flags, #ifdef UNIV_LOG_ARCHIVE min_arch_log_no, max_arch_log_no, #endif /* UNIV_LOG_ARCHIVE */ min_flushed_lsn, max_flushed_lsn); + if (check_msg) { + fprintf(stderr, + "InnoDB: Error: %s in data file %s\n", + check_msg, name); + return(DB_ERROR); + } + if (!one_opened && UNIV_PAGE_SIZE != fsp_flags_get_page_size(flags)) { @@ -1042,6 +1050,8 @@ skip_size_check: if (ret == FALSE) { + const char* check_msg; + /* We open the data file */ files[i] = os_file_create(innodb_file_data_key, @@ -1078,13 +1088,20 @@ skip_size_check: (ulong) TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9); } - fil_read_first_page( + check_msg = fil_read_first_page( files[i], one_opened, &flags, #ifdef UNIV_LOG_ARCHIVE min_arch_log_no, max_arch_log_no, #endif /* UNIV_LOG_ARCHIVE */ min_flushed_lsn, max_flushed_lsn); + if (check_msg) { + fprintf(stderr, + "InnoDB: Error: %s in doublewrite " + "buffer file %s\n", check_msg, name); + return(DB_ERROR); + } + one_opened = TRUE; } else { /* We created the data file and now write it full of diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c index ef00bc0a1f0..a56e55c0e19 100644 --- a/storage/xtradb/trx/trx0sys.c +++ b/storage/xtradb/trx/trx0sys.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -726,7 +726,8 @@ trx_sys_doublewrite_init_or_restore_pages( /* Check if the page is corrupt */ if (UNIV_UNLIKELY - (buf_page_is_corrupted(read_buf, zip_size))) { + (buf_page_is_corrupted( + TRUE, read_buf, zip_size))) { fprintf(stderr, "InnoDB: Warning: database page" @@ -737,7 +738,8 @@ trx_sys_doublewrite_init_or_restore_pages( " the doublewrite buffer.\n", (ulong) space_id, (ulong) page_no); - if (buf_page_is_corrupted(page, zip_size)) { + if (buf_page_is_corrupted( + TRUE, page, zip_size)) { fprintf(stderr, "InnoDB: Dump of the page:\n"); buf_page_print( |