Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9e13011e
Commit
9e13011e
authored
Jul 19, 2013
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert reverted patch (as workaround) to have no problem with ongoing fix.
parent
07099b70
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
136 additions
and
24 deletions
+136
-24
storage/xtradb/buf/buf0buf.c
storage/xtradb/buf/buf0buf.c
+4
-2
storage/xtradb/fil/fil0fil.c
storage/xtradb/fil/fil0fil.c
+94
-9
storage/xtradb/include/buf0buf.h
storage/xtradb/include/buf0buf.h
+5
-2
storage/xtradb/include/fil0fil.h
storage/xtradb/include/fil0fil.h
+8
-5
storage/xtradb/srv/srv0start.c
storage/xtradb/srv/srv0start.c
+20
-3
storage/xtradb/trx/trx0sys.c
storage/xtradb/trx/trx0sys.c
+5
-3
No files found.
storage/xtradb/buf/buf0buf.c
View file @
9e13011e
...
@@ -581,6 +581,8 @@ UNIV_INTERN
...
@@ -581,6 +581,8 @@ UNIV_INTERN
ibool
ibool
buf_page_is_corrupted
(
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 */
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 */
0 for uncompressed pages */
...
@@ -600,7 +602,7 @@ buf_page_is_corrupted(
...
@@ -600,7 +602,7 @@ buf_page_is_corrupted(
}
}
#ifndef UNIV_HOTBACKUP
#ifndef UNIV_HOTBACKUP
if
(
recv_lsn_checks_on
)
{
if
(
check_lsn
&&
recv_lsn_checks_on
)
{
ib_uint64_t
current_lsn
;
ib_uint64_t
current_lsn
;
if
(
log_peek_lsn
(
&
current_lsn
)
if
(
log_peek_lsn
(
&
current_lsn
)
...
@@ -3945,7 +3947,7 @@ buf_page_io_complete(
...
@@ -3945,7 +3947,7 @@ buf_page_io_complete(
/* From version 3.23.38 up we store the page checksum
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
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
)))
{
buf_page_get_zip_size
(
bpage
)))
{
corrupt:
corrupt:
fprintf
(
stderr
,
fprintf
(
stderr
,
...
...
storage/xtradb/fil/fil0fil.c
View file @
9e13011e
/*****************************************************************************
/*****************************************************************************
Copyright (c) 1995, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1995, 201
3, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
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
the terms of the GNU General Public License as published by the Free Software
...
@@ -1883,11 +1883,63 @@ fil_write_flushed_lsn_to_data_files(
...
@@ -1883,11 +1883,63 @@ fil_write_flushed_lsn_to_data_files(
return
(
DB_SUCCESS
);
return
(
DB_SUCCESS
);
}
}
/*******************************************************************//**
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
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
UNIV_INTERN
void
const
char
*
fil_read_first_page
(
fil_read_first_page
(
/*================*/
/*================*/
os_file_t
data_file
,
/*!< in: open data file */
os_file_t
data_file
,
/*!< in: open data file */
...
@@ -1909,6 +1961,7 @@ fil_read_first_page(
...
@@ -1909,6 +1961,7 @@ fil_read_first_page(
byte
*
buf
;
byte
*
buf
;
page_t
*
page
;
page_t
*
page
;
ib_uint64_t
flushed_lsn
;
ib_uint64_t
flushed_lsn
;
const
char
*
check_msg
;
buf
=
ut_malloc
(
2
*
UNIV_PAGE_SIZE
);
buf
=
ut_malloc
(
2
*
UNIV_PAGE_SIZE
);
/* Align the memory for a possible read from a raw device */
/* Align the memory for a possible read from a raw device */
...
@@ -1916,13 +1969,18 @@ fil_read_first_page(
...
@@ -1916,13 +1969,18 @@ fil_read_first_page(
os_file_read
(
data_file
,
page
,
0
,
0
,
UNIV_PAGE_SIZE
);
os_file_read
(
data_file
,
page
,
0
,
0
,
UNIV_PAGE_SIZE
);
*
flags
=
mach_read_from_4
(
page
+
*
flags
=
mach_read_from_4
(
FSP_HEADER_OFFSET
+
FSP_SPACE_FLAGS
+
page
);
FSP_HEADER_OFFSET
+
FSP_SPACE_FLAGS
);
flushed_lsn
=
mach_read_from_8
(
page
+
FIL_PAGE_FILE_FLUSH_LSN
);
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
);
ut_free
(
buf
);
if
(
check_msg
)
{
return
(
check_msg
);
}
if
(
!
one_read_already
)
{
if
(
!
one_read_already
)
{
*
min_flushed_lsn
=
flushed_lsn
;
*
min_flushed_lsn
=
flushed_lsn
;
*
max_flushed_lsn
=
flushed_lsn
;
*
max_flushed_lsn
=
flushed_lsn
;
...
@@ -1930,7 +1988,7 @@ fil_read_first_page(
...
@@ -1930,7 +1988,7 @@ fil_read_first_page(
*
min_arch_log_no
=
arch_log_no
;
*
min_arch_log_no
=
arch_log_no
;
*
max_arch_log_no
=
arch_log_no
;
*
max_arch_log_no
=
arch_log_no
;
#endif
/* UNIV_LOG_ARCHIVE */
#endif
/* UNIV_LOG_ARCHIVE */
return
;
return
(
NULL
)
;
}
}
if
(
*
min_flushed_lsn
>
flushed_lsn
)
{
if
(
*
min_flushed_lsn
>
flushed_lsn
)
{
...
@@ -1947,6 +2005,8 @@ fil_read_first_page(
...
@@ -1947,6 +2005,8 @@ fil_read_first_page(
*
max_arch_log_no
=
arch_log_no
;
*
max_arch_log_no
=
arch_log_no
;
}
}
#endif
/* UNIV_LOG_ARCHIVE */
#endif
/* UNIV_LOG_ARCHIVE */
return
(
NULL
);
}
}
/*================ SINGLE-TABLE TABLESPACES ==========================*/
/*================ SINGLE-TABLE TABLESPACES ==========================*/
...
@@ -3271,6 +3331,7 @@ fil_open_single_table_tablespace(
...
@@ -3271,6 +3331,7 @@ fil_open_single_table_tablespace(
os_file_t
file
;
os_file_t
file
;
char
*
filepath
;
char
*
filepath
;
ibool
success
;
ibool
success
;
const
char
*
check_msg
;
byte
*
buf2
;
byte
*
buf2
;
byte
*
page
;
byte
*
page
;
ulint
space_id
;
ulint
space_id
;
...
@@ -3331,6 +3392,8 @@ fil_open_single_table_tablespace(
...
@@ -3331,6 +3392,8 @@ fil_open_single_table_tablespace(
success
=
os_file_read
(
file
,
page
,
0
,
0
,
UNIV_PAGE_SIZE
);
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. */
/* We have to read the tablespace id and flags from the file. */
space_id
=
fsp_header_get_space_id
(
page
);
space_id
=
fsp_header_get_space_id
(
page
);
...
@@ -3366,7 +3429,7 @@ fil_open_single_table_tablespace(
...
@@ -3366,7 +3429,7 @@ fil_open_single_table_tablespace(
current_lsn
=
log_get_lsn
();
current_lsn
=
log_get_lsn
();
/* check the header page's consistency */
/* 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
)))
{
dict_table_flags_to_zip_size
(
space_flags
)))
{
fprintf
(
stderr
,
"InnoDB: page 0 of %s seems corrupt.
\n
"
,
filepath
);
fprintf
(
stderr
,
"InnoDB: page 0 of %s seems corrupt.
\n
"
,
filepath
);
file_is_corrupt
=
TRUE
;
file_is_corrupt
=
TRUE
;
...
@@ -3788,8 +3851,20 @@ skip_write:
...
@@ -3788,8 +3851,20 @@ skip_write:
ut_free
(
buf2
);
ut_free
(
buf2
);
if
(
UNIV_UNLIKELY
(
space_id
!=
id
if
(
check_msg
)
{
||
space_flags
!=
(
flags
&
~
(
~
0
<<
DICT_TF_BITS
))))
{
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
);
ut_print_timestamp
(
stderr
);
fputs
(
" InnoDB: Error: tablespace id and flags in file "
,
fputs
(
" InnoDB: Error: tablespace id and flags in file "
,
...
@@ -4280,11 +4355,21 @@ fil_load_single_table_tablespace(
...
@@ -4280,11 +4355,21 @@ fil_load_single_table_tablespace(
page
=
ut_align
(
buf2
,
UNIV_PAGE_SIZE
);
page
=
ut_align
(
buf2
,
UNIV_PAGE_SIZE
);
if
(
size
>=
FIL_IBD_FILE_INITIAL_SIZE
*
(
lint
)
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
);
success
=
os_file_read
(
file
,
page
,
0
,
0
,
UNIV_PAGE_SIZE
);
/* We have to read the tablespace id from the file */
/* 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
);
space_id
=
fsp_header_get_space_id
(
page
);
flags
=
fsp_header_get_flags
(
page
);
flags
=
fsp_header_get_flags
(
page
);
}
else
{
}
else
{
...
...
storage/xtradb/include/buf0buf.h
View file @
9e13011e
/*****************************************************************************
/*****************************************************************************
Copyright (c) 1995, 201
2
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 201
3
, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
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
the terms of the GNU General Public License as published by the Free Software
...
@@ -684,9 +684,12 @@ UNIV_INTERN
...
@@ -684,9 +684,12 @@ UNIV_INTERN
ibool
ibool
buf_page_is_corrupted
(
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 */
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 */
0 for uncompressed pages */
__attribute__
((
warn_unused_result
));
#ifndef UNIV_HOTBACKUP
#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
/**********************************************************************//**
Gets the space id, page offset, and byte offset within page of a
Gets the space id, page offset, and byte offset within page of a
...
...
storage/xtradb/include/fil0fil.h
View file @
9e13011e
/*****************************************************************************
/*****************************************************************************
Copyright (c) 1995, 201
0, Innobase Oy
. All Rights Reserved.
Copyright (c) 1995, 201
3, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
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
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(
...
@@ -328,10 +328,12 @@ fil_write_flushed_lsn_to_data_files(
ulint
arch_log_no
);
/*!< in: latest archived log
ulint
arch_log_no
);
/*!< in: latest archived log
file number */
file number */
/*******************************************************************//**
/*******************************************************************//**
Reads the flushed lsn and arch no fields from a data file at database
Reads the flushed lsn, arch no, and tablespace flag fields from a data
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
UNIV_INTERN
void
const
char
*
fil_read_first_page
(
fil_read_first_page
(
/*================*/
/*================*/
os_file_t
data_file
,
/*!< in: open data file */
os_file_t
data_file
,
/*!< in: open data file */
...
@@ -347,8 +349,9 @@ fil_read_first_page(
...
@@ -347,8 +349,9 @@ fil_read_first_page(
#endif
/* UNIV_LOG_ARCHIVE */
#endif
/* UNIV_LOG_ARCHIVE */
ib_uint64_t
*
min_flushed_lsn
,
/*!< out: min of flushed
ib_uint64_t
*
min_flushed_lsn
,
/*!< out: min of flushed
lsn values in data files */
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 */
lsn values in data files */
__attribute__
((
warn_unused_result
));
/*******************************************************************//**
/*******************************************************************//**
Increments the count of pending operation, if space is not being deleted.
Increments the count of pending operation, if space is not being deleted.
@return TRUE if being deleted, and operation should be skipped */
@return TRUE if being deleted, and operation should be skipped */
...
...
storage/xtradb/srv/srv0start.c
View file @
9e13011e
/*****************************************************************************
/*****************************************************************************
Copyright (c) 1996, 201
0, Innobase Oy. All Rights R
eserved.
Copyright (c) 1996, 201
3, Oracle and/or its affiliates. All rights r
eserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2009, Percona Inc.
...
@@ -817,6 +817,7 @@ open_or_create_data_files(
...
@@ -817,6 +817,7 @@ open_or_create_data_files(
}
}
if
(
ret
==
FALSE
)
{
if
(
ret
==
FALSE
)
{
const
char
*
check_msg
;
/* We open the data file */
/* We open the data file */
if
(
one_created
)
{
if
(
one_created
)
{
...
@@ -914,13 +915,20 @@ open_or_create_data_files(
...
@@ -914,13 +915,20 @@ open_or_create_data_files(
return
(
DB_ERROR
);
return
(
DB_ERROR
);
}
}
skip_size_check:
skip_size_check:
fil_read_first_page
(
check_msg
=
fil_read_first_page
(
files
[
i
],
one_opened
,
&
flags
,
files
[
i
],
one_opened
,
&
flags
,
#ifdef UNIV_LOG_ARCHIVE
#ifdef UNIV_LOG_ARCHIVE
min_arch_log_no
,
max_arch_log_no
,
min_arch_log_no
,
max_arch_log_no
,
#endif
/* UNIV_LOG_ARCHIVE */
#endif
/* UNIV_LOG_ARCHIVE */
min_flushed_lsn
,
max_flushed_lsn
);
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
if
(
!
one_opened
&&
UNIV_PAGE_SIZE
&&
UNIV_PAGE_SIZE
!=
fsp_flags_get_page_size
(
flags
))
{
!=
fsp_flags_get_page_size
(
flags
))
{
...
@@ -1042,6 +1050,8 @@ skip_size_check:
...
@@ -1042,6 +1050,8 @@ skip_size_check:
if
(
ret
==
FALSE
)
{
if
(
ret
==
FALSE
)
{
const
char
*
check_msg
;
/* We open the data file */
/* We open the data file */
files
[
i
]
=
os_file_create
(
innodb_file_data_key
,
files
[
i
]
=
os_file_create
(
innodb_file_data_key
,
...
@@ -1078,13 +1088,20 @@ skip_size_check:
...
@@ -1078,13 +1088,20 @@ skip_size_check:
(
ulong
)
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
*
9
);
(
ulong
)
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
*
9
);
}
}
fil_read_first_page
(
check_msg
=
fil_read_first_page
(
files
[
i
],
one_opened
,
&
flags
,
files
[
i
],
one_opened
,
&
flags
,
#ifdef UNIV_LOG_ARCHIVE
#ifdef UNIV_LOG_ARCHIVE
min_arch_log_no
,
max_arch_log_no
,
min_arch_log_no
,
max_arch_log_no
,
#endif
/* UNIV_LOG_ARCHIVE */
#endif
/* UNIV_LOG_ARCHIVE */
min_flushed_lsn
,
max_flushed_lsn
);
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
;
one_opened
=
TRUE
;
}
else
{
}
else
{
/* We created the data file and now write it full of
/* We created the data file and now write it full of
...
...
storage/xtradb/trx/trx0sys.c
View file @
9e13011e
/*****************************************************************************
/*****************************************************************************
Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
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
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(
...
@@ -726,7 +726,8 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Check if the page is corrupt */
/* Check if the page is corrupt */
if
(
UNIV_UNLIKELY
if
(
UNIV_UNLIKELY
(
buf_page_is_corrupted
(
read_buf
,
zip_size
)))
{
(
buf_page_is_corrupted
(
TRUE
,
read_buf
,
zip_size
)))
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"InnoDB: Warning: database page"
"InnoDB: Warning: database page"
...
@@ -737,7 +738,8 @@ trx_sys_doublewrite_init_or_restore_pages(
...
@@ -737,7 +738,8 @@ trx_sys_doublewrite_init_or_restore_pages(
" the doublewrite buffer.
\n
"
,
" the doublewrite buffer.
\n
"
,
(
ulong
)
space_id
,
(
ulong
)
page_no
);
(
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
,
fprintf
(
stderr
,
"InnoDB: Dump of the page:
\n
"
);
"InnoDB: Dump of the page:
\n
"
);
buf_page_print
(
buf_page_print
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment