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
7593a465
Commit
7593a465
authored
Nov 24, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: Introduce the unsigned 64-bit data type ib_ulonglong
for log sequence numbers, to replace dulint.
parent
f8da258f
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1051 additions
and
1010 deletions
+1051
-1010
buf/buf0buf.c
buf/buf0buf.c
+17
-27
buf/buf0flu.c
buf/buf0flu.c
+39
-46
buf/buf0lru.c
buf/buf0lru.c
+4
-5
fil/fil0fil.c
fil/fil0fil.c
+34
-36
include/btr0pcur.h
include/btr0pcur.h
+1
-1
include/buf0buf.h
include/buf0buf.h
+9
-9
include/buf0buf.ic
include/buf0buf.ic
+13
-13
include/buf0flu.h
include/buf0flu.h
+22
-17
include/buf0flu.ic
include/buf0flu.ic
+11
-13
include/fil0fil.h
include/fil0fil.h
+13
-11
include/log0log.h
include/log0log.h
+76
-68
include/log0log.ic
include/log0log.ic
+30
-39
include/log0recv.h
include/log0recv.h
+74
-58
include/mach0data.h
include/mach0data.h
+18
-0
include/mach0data.ic
include/mach0data.ic
+34
-0
include/mtr0mtr.h
include/mtr0mtr.h
+2
-2
include/srv0start.h
include/srv0start.h
+2
-2
include/trx0trx.h
include/trx0trx.h
+1
-1
include/univ.i
include/univ.i
+5
-0
include/ut0byte.h
include/ut0byte.h
+20
-0
include/ut0byte.ic
include/ut0byte.ic
+36
-0
log/log0log.c
log/log0log.c
+223
-267
log/log0recv.c
log/log0recv.c
+308
-334
row/row0mysql.c
row/row0mysql.c
+1
-1
srv/srv0srv.c
srv/srv0srv.c
+15
-18
srv/srv0start.c
srv/srv0start.c
+38
-37
trx/trx0sys.c
trx/trx0sys.c
+2
-2
trx/trx0trx.c
trx/trx0trx.c
+3
-3
No files found.
buf/buf0buf.c
View file @
7593a465
...
...
@@ -291,10 +291,10 @@ buf_page_is_corrupted(
ulint
zip_size
)
/* in: size of compressed page;
0 for uncompressed pages */
{
ulint
checksum_field
;
ulint
old_checksum_field
;
ulint
checksum_field
;
ulint
old_checksum_field
;
#ifndef UNIV_HOTBACKUP
dulint
current_lsn
;
ib_ulonglong
current_lsn
;
#endif
if
(
UNIV_LIKELY
(
!
zip_size
)
&&
memcmp
(
read_buf
+
FIL_PAGE_LSN
+
4
,
...
...
@@ -309,16 +309,14 @@ buf_page_is_corrupted(
#ifndef UNIV_HOTBACKUP
if
(
recv_lsn_checks_on
&&
log_peek_lsn
(
&
current_lsn
))
{
if
(
ut_dulint_cmp
(
current_lsn
,
mach_read_from_8
(
read_buf
+
FIL_PAGE_LSN
))
<
0
)
{
if
(
current_lsn
<
mach_read_ull
(
read_buf
+
FIL_PAGE_LSN
))
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Error: page %lu log sequence number"
" %l
u %
lu
\n
"
" %llu
\n
"
"InnoDB: is in the future! Current system "
"log sequence number %l
u %
lu.
\n
"
"log sequence number %llu.
\n
"
"InnoDB: Your database may be corrupt or "
"you may have copied the InnoDB
\n
"
"InnoDB: tablespace but not the InnoDB "
...
...
@@ -328,14 +326,8 @@ buf_page_is_corrupted(
"InnoDB: for more information.
\n
"
,
(
ulong
)
mach_read_from_4
(
read_buf
+
FIL_PAGE_OFFSET
),
(
ulong
)
ut_dulint_get_high
(
mach_read_from_8
(
read_buf
+
FIL_PAGE_LSN
)),
(
ulong
)
ut_dulint_get_low
(
mach_read_from_8
(
read_buf
+
FIL_PAGE_LSN
)),
(
ulong
)
ut_dulint_get_high
(
current_lsn
),
(
ulong
)
ut_dulint_get_low
(
current_lsn
));
mach_read_ull
(
read_buf
+
FIL_PAGE_LSN
),
current_lsn
);
}
}
#endif
...
...
@@ -608,7 +600,7 @@ buf_block_init(
block
->
buf_fix_count
=
0
;
block
->
io_fix
=
0
;
block
->
modify_clock
=
ut_dulint_zero
;
block
->
modify_clock
=
0
;
#ifdef UNIV_DEBUG_FILE_ACCESSES
block
->
file_page_was_freed
=
FALSE
;
...
...
@@ -1005,8 +997,7 @@ shrink_again:
/* Avoid busy-waiting. */
os_thread_sleep
(
100000
);
}
else
if
(
dirty
&&
buf_flush_batch
(
BUF_FLUSH_LRU
,
dirty
,
ut_dulint_zero
)
&&
buf_flush_batch
(
BUF_FLUSH_LRU
,
dirty
,
0
)
==
ULINT_UNDEFINED
)
{
buf_flush_wait_batch_end
(
BUF_FLUSH_LRU
);
...
...
@@ -1558,7 +1549,7 @@ buf_page_optimistic_get_func(
/* out: TRUE if success */
ulint
rw_latch
,
/* in: RW_S_LATCH, RW_X_LATCH */
buf_block_t
*
block
,
/* in: guessed buffer block */
dulint
modify_clock
,
/* in: modify clock value if mode is
ib_ulonglong
modify_clock
,
/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
const
char
*
file
,
/* in: file name */
ulint
line
,
/* in: line where called */
...
...
@@ -1622,7 +1613,7 @@ buf_page_optimistic_get_func(
return
(
FALSE
);
}
if
(
UNIV_UNLIKELY
(
!
UT_DULINT_EQ
(
modify_clock
,
block
->
modify_clock
)
))
{
if
(
UNIV_UNLIKELY
(
modify_clock
!=
block
->
modify_clock
))
{
#ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level
(
block
,
SYNC_NO_ORDER_CHECK
);
#endif
/* UNIV_SYNC_DEBUG */
...
...
@@ -1791,8 +1782,8 @@ buf_page_init_for_backup_restore(
block
->
freed_page_clock
=
0
;
block
->
newest_modification
=
ut_dulint_zero
;
block
->
oldest_modification
=
ut_dulint_zero
;
block
->
newest_modification
=
0
;
block
->
oldest_modification
=
0
;
block
->
accessed
=
FALSE
;
block
->
buf_fix_count
=
0
;
...
...
@@ -1864,8 +1855,8 @@ buf_page_init(
block
->
freed_page_clock
=
0
;
block
->
newest_modification
=
ut_dulint_zero
;
block
->
oldest_modification
=
ut_dulint_zero
;
block
->
newest_modification
=
0
;
block
->
oldest_modification
=
0
;
block
->
accessed
=
FALSE
;
block
->
buf_fix_count
=
0
;
...
...
@@ -2438,8 +2429,7 @@ buf_validate(void)
n_lru
++
;
if
(
ut_dulint_cmp
(
block
->
oldest_modification
,
ut_dulint_zero
)
>
0
)
{
if
(
block
->
oldest_modification
>
0
)
{
n_flush
++
;
}
...
...
buf/buf0flu.c
View file @
7593a465
...
...
@@ -58,9 +58,8 @@ buf_flush_insert_into_flush_list(
ut_a
(
buf_block_get_state
(
block
)
==
BUF_BLOCK_FILE_PAGE
);
ut_ad
((
UT_LIST_GET_FIRST
(
buf_pool
->
flush_list
)
==
NULL
)
||
(
ut_dulint_cmp
((
UT_LIST_GET_FIRST
(
buf_pool
->
flush_list
))
->
oldest_modification
,
block
->
oldest_modification
)
<=
0
));
||
(
UT_LIST_GET_FIRST
(
buf_pool
->
flush_list
)
->
oldest_modification
<=
block
->
oldest_modification
));
UT_LIST_ADD_FIRST
(
flush_list
,
buf_pool
->
flush_list
,
block
);
...
...
@@ -89,8 +88,7 @@ buf_flush_insert_sorted_into_flush_list(
prev_b
=
NULL
;
b
=
UT_LIST_GET_FIRST
(
buf_pool
->
flush_list
);
while
(
b
&&
(
ut_dulint_cmp
(
b
->
oldest_modification
,
block
->
oldest_modification
)
>
0
))
{
while
(
b
&&
b
->
oldest_modification
>
block
->
oldest_modification
)
{
prev_b
=
b
;
b
=
UT_LIST_GET_NEXT
(
flush_list
,
b
);
}
...
...
@@ -133,14 +131,9 @@ buf_flush_ready_for_replace(
return
(
FALSE
);
}
if
((
ut_dulint_cmp
(
block
->
oldest_modification
,
ut_dulint_zero
)
>
0
)
||
(
block
->
buf_fix_count
!=
0
)
||
(
block
->
io_fix
!=
0
))
{
return
(
FALSE
);
}
return
(
TRUE
);
return
(
block
->
oldest_modification
==
0
&&
block
->
buf_fix_count
==
0
&&
block
->
io_fix
==
0
);
}
/************************************************************************
...
...
@@ -160,8 +153,7 @@ buf_flush_ready_for_flush(
#endif
/* UNIV_SYNC_DEBUG */
ut_a
(
buf_block_get_state
(
block
)
==
BUF_BLOCK_FILE_PAGE
);
if
((
ut_dulint_cmp
(
block
->
oldest_modification
,
ut_dulint_zero
)
>
0
)
&&
(
block
->
io_fix
==
0
))
{
if
(
block
->
oldest_modification
!=
0
&&
block
->
io_fix
==
0
)
{
if
(
flush_type
!=
BUF_FLUSH_LRU
)
{
return
(
TRUE
);
...
...
@@ -193,7 +185,7 @@ buf_flush_write_complete(
#endif
/* UNIV_SYNC_DEBUG */
ut_a
(
buf_block_get_state
(
block
)
==
BUF_BLOCK_FILE_PAGE
);
block
->
oldest_modification
=
ut_dulint_zero
;
block
->
oldest_modification
=
0
;
UT_LIST_REMOVE
(
flush_list
,
buf_pool
->
flush_list
,
block
);
...
...
@@ -509,9 +501,10 @@ Initializes a page for writing to the tablespace. */
void
buf_flush_init_for_writing
(
/*=======================*/
byte
*
page
,
/* in/out: page */
void
*
page_zip_
,
/* in/out: compressed page, or NULL */
dulint
newest_lsn
)
/* in: newest modification lsn to the page */
byte
*
page
,
/* in/out: page */
void
*
page_zip_
,
/* in/out: compressed page, or NULL */
ib_ulonglong
newest_lsn
)
/* in: newest modification lsn
to the page */
{
if
(
page_zip_
)
{
page_zip_des_t
*
page_zip
=
page_zip_
;
...
...
@@ -531,8 +524,8 @@ buf_flush_init_for_writing(
/* fall through */
case
FIL_PAGE_TYPE_ZBLOB
:
case
FIL_PAGE_INDEX
:
mach_write_
to_8
(
page_zip
->
data
+
FIL_PAGE_LSN
,
newest_lsn
);
mach_write_
ull
(
page_zip
->
data
+
FIL_PAGE_LSN
,
newest_lsn
);
memset
(
page_zip
->
data
+
FIL_PAGE_FILE_FLUSH_LSN
,
0
,
8
);
mach_write_to_4
(
page_zip
->
data
+
FIL_PAGE_SPACE_OR_CHKSUM
,
...
...
@@ -547,10 +540,10 @@ buf_flush_init_for_writing(
}
/* Write the newest modification lsn to the page header and trailer */
mach_write_
to_8
(
page
+
FIL_PAGE_LSN
,
newest_lsn
);
mach_write_
ull
(
page
+
FIL_PAGE_LSN
,
newest_lsn
);
mach_write_
to_8
(
page
+
UNIV_PAGE_SIZE
-
FIL_PAGE_END_LSN_OLD_CHKSUM
,
newest_lsn
);
mach_write_
ull
(
page
+
UNIV_PAGE_SIZE
-
FIL_PAGE_END_LSN_OLD_CHKSUM
,
newest_lsn
);
/* Store the new formula checksum */
...
...
@@ -589,7 +582,7 @@ buf_flush_write_block_low(
ut_a
(
ibuf_count_get
(
buf_block_get_space
(
block
),
buf_block_get_page_no
(
block
))
==
0
);
#endif
ut_ad
(
!
ut_dulint_is_zero
(
block
->
newest_modification
)
);
ut_ad
(
block
->
newest_modification
!=
0
);
#ifdef UNIV_LOG_DEBUG
if
(
!
univ_log_debug_warned
)
{
...
...
@@ -876,19 +869,22 @@ the calling thread is not allowed to own any latches on pages! */
ulint
buf_flush_batch
(
/*============*/
/* out: number of blocks for which the write
request was queued; ULINT_UNDEFINED if there
was a flush of the same type already running */
ulint
flush_type
,
/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST; if
BUF_FLUSH_LIST, then the caller must not own
any latches on pages */
ulint
min_n
,
/* in: wished minimum mumber of blocks flushed
(it is not guaranteed that the actual number
is that big, though) */
dulint
lsn_limit
)
/* in the case BUF_FLUSH_LIST all blocks whose
oldest_modification is smaller than this
should be flushed (if their number does not
exceed min_n), otherwise ignored */
/* out: number of blocks for which the
write request was queued;
ULINT_UNDEFINED if there was a flush
of the same type already running */
ulint
flush_type
,
/* in: BUF_FLUSH_LRU or
BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
then the caller must not own any
latches on pages */
ulint
min_n
,
/* in: wished minimum mumber of blocks
flushed (it is not guaranteed that the
actual number is that big, though) */
ib_ulonglong
lsn_limit
)
/* in the case BUF_FLUSH_LIST all
blocks whose oldest_modification is
smaller than this should be flushed
(if their number does not exceed
min_n), otherwise ignored */
{
buf_block_t
*
block
;
ulint
page_count
=
0
;
...
...
@@ -934,8 +930,7 @@ buf_flush_batch(
block
=
UT_LIST_GET_LAST
(
buf_pool
->
flush_list
);
if
(
!
block
||
(
ut_dulint_cmp
(
block
->
oldest_modification
,
lsn_limit
)
>=
0
))
{
||
block
->
oldest_modification
>=
lsn_limit
)
{
/* We have flushed enough */
break
;
...
...
@@ -1109,8 +1104,7 @@ buf_flush_free_margin(void)
n_to_flush
=
buf_flush_LRU_recommendation
();
if
(
n_to_flush
>
0
)
{
n_flushed
=
buf_flush_batch
(
BUF_FLUSH_LRU
,
n_to_flush
,
ut_dulint_zero
);
n_flushed
=
buf_flush_batch
(
BUF_FLUSH_LRU
,
n_to_flush
,
0
);
if
(
n_flushed
==
ULINT_UNDEFINED
)
{
/* There was an LRU type flush batch already running;
let us wait for it to end */
...
...
@@ -1130,7 +1124,7 @@ buf_flush_validate_low(void)
/* out: TRUE if ok */
{
buf_block_t
*
block
;
dulint
om
;
ib_ulonglong
om
;
UT_LIST_VALIDATE
(
flush_list
,
buf_block_t
,
buf_pool
->
flush_list
);
...
...
@@ -1139,13 +1133,12 @@ buf_flush_validate_low(void)
while
(
block
!=
NULL
)
{
om
=
block
->
oldest_modification
;
ut_a
(
buf_block_get_state
(
block
)
==
BUF_BLOCK_FILE_PAGE
);
ut_a
(
ut_dulint_cmp
(
om
,
ut_dulint_zero
)
>
0
);
ut_a
(
om
>
0
);
block
=
UT_LIST_GET_NEXT
(
flush_list
,
block
);
if
(
block
)
{
ut_a
(
ut_dulint_cmp
(
om
,
block
->
oldest_modification
)
>=
0
);
ut_a
(
om
>=
block
->
oldest_modification
);
}
}
...
...
buf/buf0lru.c
View file @
7593a465
...
...
@@ -129,12 +129,11 @@ scan_again:
goto
scan_again
;
}
if
(
0
!=
ut_dulint_cmp
(
block
->
oldest_modification
,
ut_dulint_zero
))
{
if
(
block
->
oldest_modification
!=
0
)
{
/* Remove from the flush list of modified
blocks */
block
->
oldest_modification
=
ut_dulint_zero
;
block
->
oldest_modification
=
0
;
UT_LIST_REMOVE
(
flush_list
,
buf_pool
->
flush_list
,
block
);
...
...
@@ -913,7 +912,7 @@ buf_LRU_block_remove_hashed_page(
ut_a
(
buf_block_get_state
(
block
)
==
BUF_BLOCK_FILE_PAGE
);
ut_a
(
block
->
io_fix
==
0
);
ut_a
(
block
->
buf_fix_count
==
0
);
ut_a
(
ut_dulint_cmp
(
block
->
oldest_modification
,
ut_dulint_zero
)
==
0
);
ut_a
(
block
->
oldest_modification
==
0
);
buf_LRU_remove_block
(
block
);
...
...
@@ -1091,7 +1090,7 @@ buf_LRU_print(void)
fprintf
(
stderr
,
"io_fix %lu "
,
(
ulong
)
block
->
io_fix
);
}
if
(
!
ut_dulint_is_zero
(
block
->
oldest_modification
)
)
{
if
(
block
->
oldest_modification
)
{
fputs
(
"modif. "
,
stderr
);
}
...
...
fil/fil0fil.c
View file @
7593a465
...
...
@@ -1639,10 +1639,10 @@ static
ulint
fil_write_lsn_and_arch_no_to_file
(
/*==============================*/
ulint
sum_of_sizes
,
/* in: combined size of previous files in
space, in database pages */
dulint
lsn
,
/* in: lsn to write */
ulint
arch_log_no
/* in: archived log number to write */
ulint
sum_of_sizes
,
/* in: combined size of previous files
in
space, in database pages */
ib_ulonglong
lsn
,
/* in: lsn to write */
ulint
arch_log_no
/* in: archived log number to write */
__attribute__
((
unused
)))
{
byte
*
buf1
;
...
...
@@ -1653,7 +1653,7 @@ fil_write_lsn_and_arch_no_to_file(
fil_read
(
TRUE
,
0
,
0
,
sum_of_sizes
,
0
,
UNIV_PAGE_SIZE
,
buf
,
NULL
);
mach_write_
to_8
(
buf
+
FIL_PAGE_FILE_FLUSH_LSN
,
lsn
);
mach_write_
ull
(
buf
+
FIL_PAGE_FILE_FLUSH_LSN
,
lsn
);
fil_write
(
TRUE
,
0
,
0
,
sum_of_sizes
,
0
,
UNIV_PAGE_SIZE
,
buf
,
NULL
);
...
...
@@ -1667,9 +1667,10 @@ header of the first page of each data file in the system tablespace. */
ulint
fil_write_flushed_lsn_to_data_files
(
/*================================*/
/* out: DB_SUCCESS or error number */
dulint
lsn
,
/* in: lsn to write */
ulint
arch_log_no
)
/* in: latest archived log file number */
/* out: DB_SUCCESS or error number */
ib_ulonglong
lsn
,
/* in: lsn to write */
ulint
arch_log_no
)
/* in: latest archived log
file number */
{
fil_space_t
*
space
;
fil_node_t
*
node
;
...
...
@@ -1723,19 +1724,20 @@ startup. */
void
fil_read_flushed_lsn_and_arch_log_no
(
/*=================================*/
os_file_t
data_file
,
/* in: open data file */
ibool
one_read_already
,
/* in: TRUE if min and max parameters
below already contain sensible data */
os_file_t
data_file
,
/* in: open data file */
ibool
one_read_already
,
/* in: TRUE if min and max
parameters below already
contain sensible data */
#ifdef UNIV_LOG_ARCHIVE
ulint
*
min_arch_log_no
,
/* in/out: */
ulint
*
max_arch_log_no
,
/* in/out: */
ulint
*
min_arch_log_no
,
/* in/out: */
ulint
*
max_arch_log_no
,
/* in/out: */
#endif
/* UNIV_LOG_ARCHIVE */
dulint
*
min_flushed_lsn
,
/* in/out: */
dulint
*
max_flushed_lsn
)
/* in/out: */
ib_ulonglong
*
min_flushed_lsn
,
/* in/out: */
ib_ulonglong
*
max_flushed_lsn
)
/* in/out: */
{
byte
*
buf
;
byte
*
buf2
;
dulint
flushed_lsn
;
byte
*
buf
;
byte
*
buf2
;
ib_ulonglong
flushed_lsn
;
buf2
=
ut_malloc
(
2
*
UNIV_PAGE_SIZE
);
/* Align the memory for a possible read from a raw device */
...
...
@@ -1743,7 +1745,7 @@ fil_read_flushed_lsn_and_arch_log_no(
os_file_read
(
data_file
,
buf
,
0
,
0
,
UNIV_PAGE_SIZE
);
flushed_lsn
=
mach_read_
from_8
(
buf
+
FIL_PAGE_FILE_FLUSH_LSN
);
flushed_lsn
=
mach_read_
ull
(
buf
+
FIL_PAGE_FILE_FLUSH_LSN
);
ut_free
(
buf2
);
...
...
@@ -1757,10 +1759,10 @@ fil_read_flushed_lsn_and_arch_log_no(
return
;
}
if
(
ut_dulint_cmp
(
*
min_flushed_lsn
,
flushed_lsn
)
>
0
)
{
if
(
*
min_flushed_lsn
>
flushed_lsn
)
{
*
min_flushed_lsn
=
flushed_lsn
;
}
if
(
ut_dulint_cmp
(
*
max_flushed_lsn
,
flushed_lsn
)
<
0
)
{
if
(
*
max_flushed_lsn
<
flushed_lsn
)
{
*
max_flushed_lsn
=
flushed_lsn
;
}
#ifdef UNIV_LOG_ARCHIVE
...
...
@@ -2654,7 +2656,7 @@ error_exit2:
mach_write_to_4
(
page
+
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID
,
*
space_id
);
if
(
!
zip_size
)
{
buf_flush_init_for_writing
(
page
,
NULL
,
ut_dulint_zero
);
buf_flush_init_for_writing
(
page
,
NULL
,
0
);
ret
=
os_file_write
(
path
,
file
,
page
,
0
,
0
,
UNIV_PAGE_SIZE
);
}
else
{
page_zip_des_t
page_zip
;
...
...
@@ -2662,7 +2664,7 @@ error_exit2:
page_zip
.
data
=
page
+
UNIV_PAGE_SIZE
;
page_zip
.
state
=
page_zip
.
n_blobs
=
page_zip
.
m_start
=
page_zip
.
m_end
=
0
;
buf_flush_init_for_writing
(
page
,
&
page_zip
,
ut_dulint_zero
);
buf_flush_init_for_writing
(
page
,
&
page_zip
,
0
);
ret
=
os_file_write
(
path
,
file
,
page_zip
.
data
,
0
,
0
,
zip_size
);
}
...
...
@@ -2734,7 +2736,7 @@ fil_reset_too_high_lsns(
/* out: TRUE if success */
const
char
*
name
,
/* in: table name in the
databasename/tablename format */
dulint
current_lsn
)
/* in: reset lsn's if the lsn stamped
ib_ulonglong
current_lsn
)
/* in: reset lsn's if the lsn stamped
to FIL_PAGE_FILE_FLUSH_LSN in the
first page is too high */
{
...
...
@@ -2742,7 +2744,7 @@ fil_reset_too_high_lsns(
char
*
filepath
;
byte
*
page
;
byte
*
buf2
;
dulint
flush_lsn
;
ib_ulonglong
flush_lsn
;
ulint
space_id
;
ib_longlong
file_size
;
ib_longlong
offset
;
...
...
@@ -2783,9 +2785,9 @@ fil_reset_too_high_lsns(
/* We have to read the file flush lsn from the header of the file */
flush_lsn
=
mach_read_
from_8
(
page
+
FIL_PAGE_FILE_FLUSH_LSN
);
flush_lsn
=
mach_read_
ull
(
page
+
FIL_PAGE_FILE_FLUSH_LSN
);
if
(
ut_dulint_cmp
(
current_lsn
,
flush_lsn
)
>=
0
)
{
if
(
current_lsn
>=
flush_lsn
)
{
/* Ok */
success
=
TRUE
;
...
...
@@ -2799,14 +2801,11 @@ fil_reset_too_high_lsns(
fprintf
(
stderr
,
" InnoDB: Flush lsn in the tablespace file %lu"
" to be imported
\n
"
"InnoDB: is %l
u %
lu, which exceeds current"
" system lsn %l
u %
lu.
\n
"
"InnoDB: is %llu, which exceeds current"
" system lsn %llu.
\n
"
"InnoDB: We reset the lsn's in the file "
,
(
ulong
)
space_id
,
(
ulong
)
ut_dulint_get_high
(
flush_lsn
),
(
ulong
)
ut_dulint_get_low
(
flush_lsn
),
(
ulong
)
ut_dulint_get_high
(
current_lsn
),
(
ulong
)
ut_dulint_get_low
(
current_lsn
));
flush_lsn
,
current_lsn
);
ut_print_filename
(
stderr
,
filepath
);
fputs
(
".
\n
"
,
stderr
);
...
...
@@ -2828,8 +2827,7 @@ fil_reset_too_high_lsns(
goto
func_exit
;
}
if
(
ut_dulint_cmp
(
mach_read_from_8
(
page
+
FIL_PAGE_LSN
),
current_lsn
)
>
0
)
{
if
(
mach_read_ull
(
page
+
FIL_PAGE_LSN
)
>
current_lsn
)
{
/* We have to reset the lsn */
if
(
zip_size
)
{
...
...
@@ -2868,7 +2866,7 @@ fil_reset_too_high_lsns(
goto
func_exit
;
}
mach_write_
to_8
(
page
+
FIL_PAGE_FILE_FLUSH_LSN
,
current_lsn
);
mach_write_
ull
(
page
+
FIL_PAGE_FILE_FLUSH_LSN
,
current_lsn
);
success
=
os_file_write
(
filepath
,
file
,
page
,
0
,
0
,
zip_size
?
zip_size
:
UNIV_PAGE_SIZE
);
...
...
include/btr0pcur.h
View file @
7593a465
...
...
@@ -477,7 +477,7 @@ struct btr_pcur_struct{
old_rec record */
buf_block_t
*
block_when_stored
;
/* buffer block when the position was
stored */
dulint
modify_clock
;
/* the modify clock value of the
ib_ulonglong
modify_clock
;
/* the modify clock value of the
buffer block when the cursor position
was stored */
ulint
pos_state
;
/* see TODO note below!
...
...
include/buf0buf.h
View file @
7593a465
...
...
@@ -103,13 +103,13 @@ buf_pool_get_curr_size(void);
/* out: size in bytes */
/************************************************************************
Gets the smallest oldest_modification lsn for any page in the pool. Returns
ut_dulint_
zero if all modified pages have been flushed to disk. */
zero if all modified pages have been flushed to disk. */
UNIV_INLINE
dulint
ib_ulonglong
buf_pool_get_oldest_modification
(
void
);
/*==================================*/
/* out: oldest modification in pool,
ut_dulint_
zero if none */
zero if none */
/************************************************************************
Allocates a buffer block. */
UNIV_INLINE
...
...
@@ -173,7 +173,7 @@ buf_page_optimistic_get_func(
/* out: TRUE if success */
ulint
rw_latch
,
/* in: RW_S_LATCH, RW_X_LATCH */
buf_block_t
*
block
,
/* in: guessed block */
dulint
modify_clock
,
/* in: modify clock value if mode is
ib_ulonglong
modify_clock
,
/* in: modify clock value if mode is
..._GUESS_ON_CLOCK */
const
char
*
file
,
/* in: file name */
ulint
line
,
/* in: line where called */
...
...
@@ -364,7 +364,7 @@ buf_page_peek_if_search_hashed(
Gets the youngest modification log sequence number for a frame.
Returns zero if not file page or no modification occurred yet. */
UNIV_INLINE
dulint
ib_ulonglong
buf_block_get_newest_modification
(
/*==============================*/
/* out: newest modification to page */
...
...
@@ -382,7 +382,7 @@ buf_block_modify_clock_inc(
Returns the value of the modify clock. The caller must have an s-lock
or x-lock on the block. */
UNIV_INLINE
dulint
ib_ulonglong
buf_block_get_modify_clock
(
/*=======================*/
/* out: value */
...
...
@@ -755,11 +755,11 @@ struct buf_block_struct{
UT_LIST_NODE_T
(
buf_block_t
)
flush_list
;
/* node of the modified, not yet
flushed blocks list */
dulint
newest_modification
;
ib_ulonglong
newest_modification
;
/* log sequence number of the youngest
modification to this block, zero if
not modified */
dulint
oldest_modification
;
ib_ulonglong
oldest_modification
;
/* log sequence number of the START of
the log entry written of the oldest
modification to this block which has
...
...
@@ -812,7 +812,7 @@ struct buf_block_struct{
protected by block->mutex */
/* 4. Optimistic search field */
dulint
modify_clock
;
/* this clock is incremented every
ib_ulonglong
modify_clock
;
/* this clock is incremented every
time a pointer to a record on the
page may become obsolete; this is
used in the optimistic cursor
...
...
include/buf0buf.ic
View file @
7593a465
...
...
@@ -39,23 +39,23 @@ buf_pool_get_curr_size(void)
/************************************************************************
Gets the smallest oldest_modification lsn for any page in the pool. Returns
ut_dulint_
zero if all modified pages have been flushed to disk. */
zero if all modified pages have been flushed to disk. */
UNIV_INLINE
dulint
ib_ulonglong
buf_pool_get_oldest_modification(void)
/*==================================*/
/* out: oldest modification in pool,
ut_dulint_
zero if none */
zero if none */
{
buf_block_t* block;
dulint
lsn;
ib_ulonglong
lsn;
mutex_enter(&(buf_pool->mutex));
block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (block == NULL) {
lsn =
ut_dulint_zero
;
lsn =
0
;
} else {
lsn = block->oldest_modification;
}
...
...
@@ -408,23 +408,23 @@ buf_page_io_query(
}
/************************************************************************
Gets the youngest modification log sequence number for a frame.
Returns zero
if not a
file page or no modification occurred yet. */
Gets the youngest modification log sequence number for a frame.
Returns zero if not
file page or no modification occurred yet. */
UNIV_INLINE
dulint
ib_ulonglong
buf_block_get_newest_modification(
/*==============================*/
/* out: newest modification to
the
page */
/* out: newest modification to page */
buf_block_t* block) /* in: block containing the page frame */
{
dulint
lsn;
ib_ulonglong
lsn;
mutex_enter(&(buf_pool->mutex));
if (buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE) {
lsn = block->newest_modification;
} else {
lsn =
ut_dulint_zero
;
lsn =
0
;
}
mutex_exit(&(buf_pool->mutex));
...
...
@@ -447,14 +447,14 @@ buf_block_modify_clock_inc(
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock)
;
block->modify_clock++
;
}
/************************************************************************
Returns the value of the modify clock. The caller must have an s-lock
or x-lock on the block. */
UNIV_INLINE
dulint
ib_ulonglong
buf_block_get_modify_clock(
/*=======================*/
/* out: value */
...
...
include/buf0flu.h
View file @
7593a465
...
...
@@ -34,9 +34,10 @@ Initializes a page for writing to the tablespace. */
void
buf_flush_init_for_writing
(
/*=======================*/
byte
*
page
,
/* in/out: page */
void
*
page_zip
,
/* in/out: compressed page, or NULL */
dulint
newest_lsn
);
/* in: newest modification lsn to the page */
byte
*
page
,
/* in/out: page */
void
*
page_zip_
,
/* in/out: compressed page, or NULL */
ib_ulonglong
newest_lsn
);
/* in: newest modification lsn
to the page */
/***********************************************************************
This utility flushes dirty blocks from the end of the LRU list or flush_list.
NOTE 1: in the case of an LRU flush the calling thread may own latches to
...
...
@@ -47,18 +48,22 @@ the calling thread is not allowed to own any latches on pages! */
ulint
buf_flush_batch
(
/*============*/
/* out: number of blocks for which the write
request was queued */
ulint
flush_type
,
/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST; if
BUF_FLUSH_LIST, then the caller must not own
any latches on pages */
ulint
min_n
,
/* in: wished minimum mumber of blocks flushed
(it is not guaranteed that the actual number
is that big, though) */
dulint
lsn_limit
);
/* in the case BUF_FLUSH_LIST all blocks whose
oldest_modification is smaller than this
should be flushed (if their number does not
exceed min_n), otherwise ignored */
/* out: number of blocks for which the
write request was queued;
ULINT_UNDEFINED if there was a flush
of the same type already running */
ulint
flush_type
,
/* in: BUF_FLUSH_LRU or
BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
then the caller must not own any
latches on pages */
ulint
min_n
,
/* in: wished minimum mumber of blocks
flushed (it is not guaranteed that the
actual number is that big, though) */
ib_ulonglong
lsn_limit
);
/* in the case BUF_FLUSH_LIST all
blocks whose oldest_modification is
smaller than this should be flushed
(if their number does not exceed
min_n), otherwise ignored */
/**********************************************************************
Waits until a flush batch of the given type ends */
...
...
@@ -83,9 +88,9 @@ void
buf_flush_recv_note_modification
(
/*=============================*/
buf_block_t
*
block
,
/* in: block which is modified */
dulint
start_lsn
,
/* in: start lsn of the first mtr in a
ib_ulonglong
start_lsn
,
/* in: start lsn of the first mtr in a
set of mtr's */
dulint
end_lsn
);
/* in: end lsn of the last mtr in the
ib_ulonglong
end_lsn
);
/* in: end lsn of the last mtr in the
set of mtr's */
/************************************************************************
Returns TRUE if the file page block is immediately suitable for replacement,
...
...
include/buf0flu.ic
View file @
7593a465
...
...
@@ -45,21 +45,20 @@ buf_flush_note_modification(
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(
ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero)
!= 0);
ut_ad(
mtr->start_lsn
!= 0);
ut_ad(mtr->modifications);
ut_ad(
ut_dulint_cmp(block->newest_modification, mtr->end_lsn) <= 0
);
ut_ad(
block->newest_modification <= mtr->end_lsn
);
block->newest_modification = mtr->end_lsn;
if (
ut_dulint_is_zero(block->oldest_modification)
) {
if (
!block->oldest_modification
) {
block->oldest_modification = mtr->start_lsn;
ut_ad(
!ut_dulint_is_zero(block->oldest_modification)
);
ut_ad(
block->oldest_modification != 0
);
buf_flush_insert_into_flush_list(block);
} else {
ut_ad(ut_dulint_cmp(block->oldest_modification,
mtr->start_lsn) <= 0);
ut_ad(block->oldest_modification <= mtr->start_lsn);
}
++srv_buf_pool_write_requests;
...
...
@@ -72,9 +71,9 @@ void
buf_flush_recv_note_modification(
/*=============================*/
buf_block_t* block, /* in: block which is modified */
dulint
start_lsn, /* in: start lsn of the first mtr in a
ib_ulonglong
start_lsn, /* in: start lsn of the first mtr in a
set of mtr's */
dulint
end_lsn) /* in: end lsn of the last mtr in the
ib_ulonglong
end_lsn) /* in: end lsn of the last mtr in the
set of mtr's */
{
ut_ad(block);
...
...
@@ -86,20 +85,19 @@ buf_flush_recv_note_modification(
mutex_enter(&(buf_pool->mutex));
ut_ad(
ut_dulint_cmp(block->newest_modification, end_lsn) <= 0
);
ut_ad(
block->newest_modification <= end_lsn
);
block->newest_modification = end_lsn;
if (
ut_dulint_is_zero(block->oldest_modification)
) {
if (
!block->oldest_modification
) {
block->oldest_modification = start_lsn;
ut_ad(
!ut_dulint_is_zero(block->oldest_modification)
);
ut_ad(
block->oldest_modification != 0
);
buf_flush_insert_sorted_into_flush_list(block);
} else {
ut_ad(ut_dulint_cmp(block->oldest_modification,
start_lsn) <= 0);
ut_ad(block->oldest_modification <= start_lsn);
}
mutex_exit(&(buf_pool->mutex));
...
...
include/fil0fil.h
View file @
7593a465
...
...
@@ -285,9 +285,10 @@ header of the first page of each data file in the system tablespace. */
ulint
fil_write_flushed_lsn_to_data_files
(
/*================================*/
/* out: DB_SUCCESS or error number */
dulint
lsn
,
/* in: lsn to write */
ulint
arch_log_no
);
/* in: latest archived log file number */
/* out: DB_SUCCESS or error number */
ib_ulonglong
lsn
,
/* in: lsn to write */
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. */
...
...
@@ -295,15 +296,16 @@ startup. */
void
fil_read_flushed_lsn_and_arch_log_no
(
/*=================================*/
os_file_t
data_file
,
/* in: open data file */
ibool
one_read_already
,
/* in: TRUE if min and max parameters
below already contain sensible data */
os_file_t
data_file
,
/* in: open data file */
ibool
one_read_already
,
/* in: TRUE if min and max
parameters below already
contain sensible data */
#ifdef UNIV_LOG_ARCHIVE
ulint
*
min_arch_log_no
,
/* in/out: */
ulint
*
max_arch_log_no
,
/* in/out: */
ulint
*
min_arch_log_no
,
/* in/out: */
ulint
*
max_arch_log_no
,
/* in/out: */
#endif
/* UNIV_LOG_ARCHIVE */
dulint
*
min_flushed_lsn
,
/* in/out: */
dulint
*
max_flushed_lsn
);
/* in/out: */
ib_ulonglong
*
min_flushed_lsn
,
/* in/out: */
ib_ulonglong
*
max_flushed_lsn
);
/* in/out: */
/***********************************************************************
Increments the count of pending insert buffer page merges, if space is not
being deleted. */
...
...
@@ -455,7 +457,7 @@ fil_reset_too_high_lsns(
/* out: TRUE if success */
const
char
*
name
,
/* in: table name in the
databasename/tablename format */
dulint
current_lsn
);
/* in: reset lsn's if the lsn stamped
ib_ulonglong
current_lsn
);
/* in: reset lsn's if the lsn stamped
to FIL_PAGE_FILE_FLUSH_LSN in the
first page is too high */
/************************************************************************
...
...
include/log0log.h
View file @
7593a465
...
...
@@ -48,9 +48,9 @@ log_calc_where_lsn_is(
/* out: log file number */
ib_longlong
*
log_file_offset
,
/* out: offset in that file
(including the header) */
dulint
first_header_lsn
,
/* in: first log file start
ib_ulonglong
first_header_lsn
,
/* in: first log file start
lsn */
dulint
lsn
,
/* in: lsn whose position to
ib_ulonglong
lsn
,
/* in: lsn whose position to
determine */
ulint
n_log_files
,
/* in: total number of log
files */
...
...
@@ -60,15 +60,15 @@ log_calc_where_lsn_is(
Writes to the log the string given. The log must be released with
log_release. */
UNIV_INLINE
dulint
ib_ulonglong
log_reserve_and_write_fast
(
/*=======================*/
/* out: end lsn of the log record, ut_dulint_zero if
did not succeed */
byte
*
str
,
/* in: string */
ulint
len
,
/* in: string length */
dulint
*
start_lsn
,
/* out: start lsn of the log record */
ibool
*
success
);
/* out: TRUE if success */
/* out: end lsn of the log record,
zero if
did not succeed */
byte
*
str
,
/* in: string */
ulint
len
,
/* in: string length */
ib_ulonglong
*
start_lsn
,
/* out: start lsn of the log record */
ibool
*
success
);
/* out: TRUE if success */
/***************************************************************************
Releases the log mutex. */
UNIV_INLINE
...
...
@@ -88,7 +88,7 @@ log_free_check(void);
Opens the log for log_write_low. The log must be closed with log_close and
released with log_release. */
dulint
ib_ulonglong
log_reserve_and_open
(
/*=================*/
/* out: start lsn of the log record */
...
...
@@ -105,14 +105,14 @@ log_write_low(
/****************************************************************
Closes the log. */
dulint
ib_ulonglong
log_close
(
void
);
/*===========*/
/* out: lsn */
/****************************************************************
Gets the current lsn. */
UNIV_INLINE
dulint
ib_ulonglong
log_get_lsn
(
void
);
/*=============*/
/* out: current lsn */
...
...
@@ -155,13 +155,14 @@ flush flushed enough. If not, starts a new flush. */
void
log_write_up_to
(
/*============*/
dulint
lsn
,
/* in: log sequence number up to which the log should
be written, ut_dulint_max if not specified */
ulint
wait
,
/* in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
or LOG_WAIT_ALL_GROUPS */
ibool
flush_to_disk
);
/* in: TRUE if we want the written log also to be
flushed to disk */
ib_ulonglong
lsn
,
/* in: log sequence number up to which
the log should be written,
IB_ULONGLONG_MAX if not specified */
ulint
wait
,
/* in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
or LOG_WAIT_ALL_GROUPS */
ibool
flush_to_disk
);
/* in: TRUE if we want the written log
also to be flushed to disk */
/********************************************************************
Does a syncronous flush of the log buffer to disk. */
...
...
@@ -176,13 +177,16 @@ be called if the calling thread owns no synchronization objects! */
ibool
log_preflush_pool_modified_pages
(
/*=============================*/
/* out: FALSE if there was a flush batch of
the same type running, which means that we
could not start this flush batch */
dulint
new_oldest
,
/* in: try to advance oldest_modified_lsn
at least to this lsn */
ibool
sync
);
/* in: TRUE if synchronous operation is
desired */
/* out: FALSE if there was a
flush batch of the same type
running, which means that we
could not start this flush
batch */
ib_ulonglong
new_oldest
,
/* in: try to advance
oldest_modified_lsn at least
to this lsn */
ibool
sync
);
/* in: TRUE if synchronous
operation is desired */
/**********************************************************
Makes a checkpoint. Note that this function does not flush dirty
blocks from the buffer pool: it only checks what is lsn of the oldest
...
...
@@ -208,15 +212,16 @@ Makes a checkpoint at a given lsn or later. */
void
log_make_checkpoint_at
(
/*===================*/
dulint
lsn
,
/* in: make a checkpoint at this or a later
lsn, if ut_dulint_max, makes a checkpoint at
the latest lsn */
ibool
write_always
);
/* in: the function normally checks if the
the new checkpoint would have a greater
lsn than the previous one: if not, then no
physical write is done; by setting this
parameter TRUE, a physical write will always be
made to log files */
ib_ulonglong
lsn
,
/* in: make a checkpoint at this or a
later lsn, if IB_ULONGLONG_MAX, makes
a checkpoint at the latest lsn */
ibool
write_always
);
/* in: the function normally checks if
the the new checkpoint would have a
greater lsn than the previous one: if
not, then no physical write is done;
by setting this parameter TRUE, a
physical write will always be made to
log files */
/********************************************************************
Makes a checkpoint at the latest lsn and writes it to first page of each
data file in the database, so that we know that the file spaces contain
...
...
@@ -257,11 +262,11 @@ backup restoration. */
void
log_reset_first_header_and_checkpoint
(
/*==================================*/
byte
*
hdr_buf
,
/* in: buffer which will be written to the start
of the first log file */
dulint
start
);
/* in: lsn of the start of the first log file;
we pretend that there is a checkpoint at
start + LOG_BLOCK_HDR_SIZE */
byte
*
hdr_buf
,
/* in: buffer which will be written to the
start
of the first log file */
ib_ulonglong
start
);
/* in: lsn of the start of the first log file;
we pretend that there is a checkpoint at
start + LOG_BLOCK_HDR_SIZE */
/************************************************************************
Starts an archiving operation. */
...
...
@@ -332,8 +337,8 @@ log_group_read_log_seg(
ulint
type
,
/* in: LOG_ARCHIVE or LOG_RECOVER */
byte
*
buf
,
/* in: buffer where to read */
log_group_t
*
group
,
/* in: log group */
dulint
start_lsn
,
/* in: read area start */
dulint
end_lsn
);
/* in: read area end */
ib_ulonglong
start_lsn
,
/* in: read area start */
ib_ulonglong
end_lsn
);
/* in: read area end */
/**********************************************************
Writes a buffer to a log file group. */
...
...
@@ -344,7 +349,7 @@ log_group_write_buf(
byte
*
buf
,
/* in: buffer */
ulint
len
,
/* in: buffer len; must be divisible
by OS_FILE_LOG_BLOCK_SIZE */
dulint
start_lsn
,
/* in: start lsn of the buffer; must
ib_ulonglong
start_lsn
,
/* in: start lsn of the buffer; must
be divisible by
OS_FILE_LOG_BLOCK_SIZE */
ulint
new_data_offset
);
/* in: start offset of new data in
...
...
@@ -360,7 +365,7 @@ void
log_group_set_fields
(
/*=================*/
log_group_t
*
group
,
/* in: group */
dulint
lsn
);
/* in: lsn for which the values should be
ib_ulonglong
lsn
);
/* in: lsn for which the values should be
set */
/**********************************************************
Calculates the data capacity of a log group, when the log file headers are not
...
...
@@ -461,8 +466,8 @@ UNIV_INLINE
void
log_block_init
(
/*===========*/
byte
*
log_block
,
/* in: pointer to the log buffer */
dulint
lsn
);
/* in: lsn within the log block */
byte
*
log_block
,
/* in: pointer to the log buffer */
ib_ulonglong
lsn
);
/* in: lsn within the log block */
/****************************************************************
Initializes a log block in the log buffer in the old, < 3.23.52 format, where
there was no checksum yet. */
...
...
@@ -470,16 +475,17 @@ UNIV_INLINE
void
log_block_init_in_old_format
(
/*=========================*/
byte
*
log_block
,
/* in: pointer to the log buffer */
dulint
lsn
);
/* in: lsn within the log block */
byte
*
log_block
,
/* in: pointer to the log buffer */
ib_ulonglong
lsn
);
/* in: lsn within the log block */
/****************************************************************
Converts a lsn to a log block number. */
UNIV_INLINE
ulint
log_block_convert_lsn_to_no
(
/*========================*/
/* out: log block number, it is > 0 and <= 1G */
dulint
lsn
);
/* in: lsn of a byte within the block */
/* out: log block number,
it is > 0 and <= 1G */
ib_ulonglong
lsn
);
/* in: lsn of a byte within the block */
/**********************************************************
Prints info of the log. */
...
...
@@ -493,9 +499,9 @@ Peeks the current lsn. */
ibool
log_peek_lsn
(
/*=========*/
/* out: TRUE if success, FALSE if could not get the
log system mutex */
dulint
*
lsn
);
/* out: if returns TRUE, current lsn is here */
/* out: TRUE if success, FALSE if
could not get the
log system mutex */
ib_ulonglong
*
lsn
);
/* out: if returns TRUE, current lsn is here */
/**************************************************************************
Refreshes the statistics used to print per-second averages. */
...
...
@@ -512,7 +518,7 @@ extern log_t* log_sys;
#define LOG_RECOVER 98887331
/* The counting of lsn's starts from this value: this must be non-zero */
#define LOG_START_LSN
ut_dulint_create(0, 16 * OS_FILE_LOG_BLOCK_SIZE
)
#define LOG_START_LSN
((ib_ulonglong) (16 * OS_FILE_LOG_BLOCK_SIZE)
)
#define LOG_BUFFER_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE)
#define LOG_ARCHIVE_BUF_SIZE (srv_log_buffer_size * UNIV_PAGE_SIZE / 4)
...
...
@@ -645,7 +651,7 @@ struct log_group_struct{
group */
ulint
state
;
/* LOG_GROUP_OK or
LOG_GROUP_CORRUPTED */
dulint
lsn
;
/* lsn used to fix coordinates within
ib_ulonglong
lsn
;
/* lsn used to fix coordinates within
the log group */
ulint
lsn_offset
;
/* the offset of the above lsn */
ulint
n_pending_writes
;
/* number of currently pending flush
...
...
@@ -671,7 +677,7 @@ struct log_group_struct{
value to ..._file_no */
ulint
next_archived_offset
;
/* like the preceding field */
/*-----------------------------*/
dulint
scanned_lsn
;
/* used only in recovery: recovery scan
ib_ulonglong
scanned_lsn
;
/* used only in recovery: recovery scan
succeeded up to this lsn in this log
group */
byte
*
checkpoint_buf
;
/* checkpoint header is written from
...
...
@@ -684,7 +690,7 @@ struct log_struct{
byte
pad
[
64
];
/* padding to prevent other memory
update hotspots from residing on the
same memory cache line */
dulint
lsn
;
/* log sequence number */
ib_ulonglong
lsn
;
/* log sequence number */
ulint
buf_free
;
/* first free offset within the log
buffer */
mutex_t
mutex
;
/* mutex protecting the log */
...
...
@@ -696,7 +702,7 @@ struct log_struct{
ulint
old_buf_free
;
/* value of buf free when log was
last time opened; only in the debug
version */
dulint
old_lsn
;
/* value of lsn when log was last time
ib_ulonglong
old_lsn
;
/* value of lsn when log was last time
opened; only in the debug version */
ibool
check_flush_or_checkpoint
;
/* this is set to TRUE when there may
...
...
@@ -719,27 +725,27 @@ struct log_struct{
later; this is advanced when a flush
operation is completed to all the log
groups */
dulint
written_to_some_lsn
;
ib_ulonglong
written_to_some_lsn
;
/* first log sequence number not yet
written to any log group; for this to
be advanced, it is enough that the
write i/o has been completed for any
one log group */
dulint
written_to_all_lsn
;
ib_ulonglong
written_to_all_lsn
;
/* first log sequence number not yet
written to some log group; for this to
be advanced, it is enough that the
write i/o has been completed for all
log groups */
dulint
write_lsn
;
/* end lsn for the current running
ib_ulonglong
write_lsn
;
/* end lsn for the current running
write */
ulint
write_end_offset
;
/* the data in buffer has been written
up to this offset when the current
write ends: this field will then
be copied to buf_next_to_write */
dulint
current_flush_lsn
;
/* end lsn for the current running
ib_ulonglong
current_flush_lsn
;
/* end lsn for the current running
write + flush operation */
dulint
flushed_to_disk_lsn
;
ib_ulonglong
flushed_to_disk_lsn
;
/* how far we have written the log
AND flushed to disk */
ulint
n_pending_writes
;
/* number of currently pending flushes
...
...
@@ -802,11 +808,11 @@ struct log_struct{
/* this is the maximum allowed value
for lsn - last_checkpoint_lsn when a
new query step is started */
dulint
next_checkpoint_no
;
ib_ulonglong
next_checkpoint_no
;
/* next checkpoint number */
dulint
last_checkpoint_lsn
;
ib_ulonglong
last_checkpoint_lsn
;
/* latest checkpoint lsn */
dulint
next_checkpoint_lsn
;
ib_ulonglong
next_checkpoint_lsn
;
/* next checkpoint lsn */
ulint
n_pending_checkpoint_writes
;
/* number of currently pending
...
...
@@ -817,10 +823,11 @@ struct log_struct{
the log mutex */
byte
*
checkpoint_buf
;
/* checkpoint header is read to this
buffer */
#ifdef UNIV_LOG_ARCHIVE
/* Fields involved in archiving */
ulint
archiving_state
;
/* LOG_ARCH_ON, LOG_ARCH_STOPPING
LOG_ARCH_STOPPED, LOG_ARCH_OFF */
dulint
archived_lsn
;
/* archiving has advanced to this
ib_ulonglong
archived_lsn
;
/* archiving has advanced to this
lsn */
ulint
max_archived_lsn_age_async
;
/* recommended maximum age of
...
...
@@ -829,7 +836,7 @@ struct log_struct{
ulint
max_archived_lsn_age
;
/* maximum allowed age for
archived_lsn */
dulint
next_archived_lsn
;
/* during an archive write,
ib_ulonglong
next_archived_lsn
;
/* during an archive write,
until the write is completed, we
store the next value for
archived_lsn here: the write
...
...
@@ -850,6 +857,7 @@ struct log_struct{
os_event_t
archiving_on
;
/* if archiving has been stopped,
a thread can wait for this event to
become signaled */
#endif
/* UNIV_LOG_ARCHIVE */
};
#define LOG_ARCH_ON 71
...
...
include/log0log.ic
View file @
7593a465
...
...
@@ -17,10 +17,11 @@ consistent. */
ibool
log_check_log_recs(
/*===============*/
byte* buf, /* in: pointer to the start of the log segment
in the log_sys->buf log buffer */
ulint len, /* in: segment length in bytes */
dulint buf_start_lsn); /* in: buffer start lsn */
byte* buf, /* in: pointer to the start of
the log segment in the
log_sys->buf log buffer */
ulint len, /* in: segment length in bytes */
ib_ulonglong buf_start_lsn); /* in: buffer start lsn */
/****************************************************************
Gets a log block flush bit. */
...
...
@@ -162,11 +163,10 @@ UNIV_INLINE
void
log_block_set_checkpoint_no(
/*========================*/
byte* log_block, /* in: log block */
dulint
no) /* in: checkpoint no */
byte*
log_block, /* in: log block */
ib_ulonglong
no) /* in: checkpoint no */
{
mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO,
ut_dulint_get_low(no));
mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO, (ulint) no);
}
/****************************************************************
...
...
@@ -175,18 +175,11 @@ UNIV_INLINE
ulint
log_block_convert_lsn_to_no(
/*========================*/
/* out: log block number, it is > 0 and <= 1G */
dulint lsn) /* in: lsn of a byte within the block */
/* out: log block number,
it is > 0 and <= 1G */
ib_ulonglong lsn) /* in: lsn of a byte within the block */
{
ulint no;
no = ut_dulint_get_low(lsn) / OS_FILE_LOG_BLOCK_SIZE;
no += (ut_dulint_get_high(lsn) % OS_FILE_LOG_BLOCK_SIZE)
* 2 * (0x80000000UL / OS_FILE_LOG_BLOCK_SIZE);
no = no & 0x3FFFFFFFUL;
return(no + 1);
return(((ulint) (lsn / OS_FILE_LOG_BLOCK_SIZE) & 0x3FFFFFFFUL) + 1);
}
/****************************************************************
...
...
@@ -250,8 +243,8 @@ UNIV_INLINE
void
log_block_init(
/*===========*/
byte* log_block, /* in: pointer to the log buffer */
dulint
lsn) /* in: lsn within the log block */
byte*
log_block, /* in: pointer to the log buffer */
ib_ulonglong
lsn) /* in: lsn within the log block */
{
ulint no;
...
...
@@ -274,8 +267,8 @@ UNIV_INLINE
void
log_block_init_in_old_format(
/*=========================*/
byte* log_block, /* in: pointer to the log buffer */
dulint
lsn) /* in: lsn within the log block */
byte*
log_block, /* in: pointer to the log buffer */
ib_ulonglong
lsn) /* in: lsn within the log block */
{
ulint no;
...
...
@@ -296,19 +289,19 @@ log_block_init_in_old_format(
Writes to the log the string given. The log must be released with
log_release. */
UNIV_INLINE
dulint
ib_ulonglong
log_reserve_and_write_fast(
/*=======================*/
/* out: end lsn of the log record, ut_dulint_zero if
did not succeed */
byte* str, /* in: string */
ulint len, /* in: string length */
dulint
* start_lsn,/* out: start lsn of the log record */
ibool* success)/* out: TRUE if success */
/* out: end lsn of the log record,
zero if
did not succeed */
byte*
str, /* in: string */
ulint
len, /* in: string length */
ib_ulonglong
* start_lsn,/* out: start lsn of the log record */
ibool*
success)/* out: TRUE if success */
{
log_t* log = log_sys;
ulint data_len;
dulint
lsn;
log_t*
log = log_sys;
ulint
data_len;
ib_ulonglong
lsn;
*success = TRUE;
...
...
@@ -325,7 +318,7 @@ log_reserve_and_write_fast(
mutex_exit(&(log->mutex));
return(
ut_dulint_zero
);
return(
0
);
}
*start_lsn = log->lsn;
...
...
@@ -343,9 +336,7 @@ log_reserve_and_write_fast(
ut_ad(log->buf_free <= log->buf_size);
lsn = ut_dulint_add(log->lsn, len);
log->lsn = lsn;
lsn = log->lsn += len;
#ifdef UNIV_LOG_DEBUG
log_check_log_recs(log->buf + log->old_buf_free,
...
...
@@ -367,12 +358,12 @@ log_release(void)
/****************************************************************
Gets the current lsn. */
UNIV_INLINE
dulint
ib_ulonglong
log_get_lsn(void)
/*=============*/
/* out: current lsn */
{
dulint
lsn;
ib_ulonglong
lsn;
mutex_enter(&(log_sys->mutex));
...
...
include/log0recv.h
View file @
7593a465
...
...
@@ -25,15 +25,18 @@ Reads the checkpoint info needed in hot backup. */
ibool
recv_read_cp_info_for_backup
(
/*=========================*/
/* out: TRUE if success */
byte
*
hdr
,
/* in: buffer containing the log group header */
dulint
*
lsn
,
/* out: checkpoint lsn */
ulint
*
offset
,
/* out: checkpoint offset in the log group */
ulint
*
fsp_limit
,
/* out: fsp limit of space 0, 1000000000 if the
database is running with < version 3.23.50 of InnoDB */
dulint
*
cp_no
,
/* out: checkpoint number */
dulint
*
first_header_lsn
);
/* out: lsn of of the start of the first log file */
/* out: TRUE if success */
byte
*
hdr
,
/* in: buffer containing the log group
header */
ib_ulonglong
*
lsn
,
/* out: checkpoint lsn */
ulint
*
offset
,
/* out: checkpoint offset in the log group */
ulint
*
fsp_limit
,
/* out: fsp limit of space 0,
1000000000 if the database is running
with < version 3.23.50 of InnoDB */
ib_ulonglong
*
cp_no
,
/* out: checkpoint number */
ib_ulonglong
*
first_header_lsn
);
/* out: lsn of of the start of the
first log file */
/***********************************************************************
Scans the log segment and n_bytes_scanned is set to the length of valid
log scanned. */
...
...
@@ -43,7 +46,7 @@ recv_scan_log_seg_for_backup(
/*=========================*/
byte
*
buf
,
/* in: buffer containing log data */
ulint
buf_len
,
/* in: data length in that buffer */
dulint
*
scanned_lsn
,
/* in/out: lsn of buffer start,
ib_ulonglong
*
scanned_lsn
,
/* in/out: lsn of buffer start,
we return scanned lsn */
ulint
*
scanned_checkpoint_no
,
/* in/out: 4 lowest bytes of the
...
...
@@ -90,11 +93,14 @@ the recovery and free the resources used in it. */
ulint
recv_recovery_from_checkpoint_start
(
/*================================*/
/* out: error code or DB_SUCCESS */
ulint
type
,
/* in: LOG_CHECKPOINT or LOG_ARCHIVE */
dulint
limit_lsn
,
/* in: recover up to this lsn if possible */
dulint
min_flushed_lsn
,
/* in: min flushed lsn from data files */
dulint
max_flushed_lsn
);
/* in: max flushed lsn from data files */
/* out: error code or DB_SUCCESS */
ulint
type
,
/* in: LOG_CHECKPOINT or LOG_ARCHIVE */
ib_ulonglong
limit_lsn
,
/* in: recover up to this lsn
if possible */
ib_ulonglong
min_flushed_lsn
,
/* in: min flushed lsn from
data files */
ib_ulonglong
max_flushed_lsn
);
/* in: max flushed lsn from
data files */
/************************************************************
Completes recovery from a checkpoint. */
...
...
@@ -108,40 +114,48 @@ and hashes the log records if new data found. */
ibool
recv_scan_log_recs
(
/*===============*/
/* out: TRUE if limit_lsn has been reached, or
not able to scan any more in this log group */
ibool
apply_automatically
,
/* in: TRUE if we want this function to
apply log records automatically when the
hash table becomes full; in the hot backup tool
the tool does the applying, not this
function */
ulint
available_memory
,
/* in: we let the hash table of recs to grow
to this size, at the maximum */
ibool
store_to_hash
,
/* in: TRUE if the records should be stored
to the hash table; this is set to FALSE if just
debug checking is needed */
byte
*
buf
,
/* in: buffer containing a log segment or
garbage */
ulint
len
,
/* in: buffer length */
dulint
start_lsn
,
/* in: buffer start lsn */
dulint
*
contiguous_lsn
,
/* in/out: it is known that all log groups
contain contiguous log data up to this lsn */
dulint
*
group_scanned_lsn
);
/* out: scanning succeeded up to this lsn */
/* out: TRUE if limit_lsn has been
reached, or not able to scan any more
in this log group */
ibool
apply_automatically
,
/* in: TRUE if we want this
function to apply log records
automatically when the hash table
becomes full; in the hot backup tool
the tool does the applying, not this
function */
ulint
available_memory
,
/* in: we let the hash table of recs
to grow to this size, at the maximum */
ibool
store_to_hash
,
/* in: TRUE if the records should be
stored to the hash table; this is set
to FALSE if just debug checking is
needed */
byte
*
buf
,
/* in: buffer containing a log segment
or garbage */
ulint
len
,
/* in: buffer length */
ib_ulonglong
start_lsn
,
/* in: buffer start lsn */
ib_ulonglong
*
contiguous_lsn
,
/* in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
ib_ulonglong
*
group_scanned_lsn
);
/* out: scanning succeeded up to
this lsn */
/**********************************************************
Resets the logs. The contents of log files will be lost! */
void
recv_reset_logs
(
/*============*/
dulint
lsn
,
/* in: reset to this lsn rounded up to
be divisible by OS_FILE_LOG_BLOCK_SIZE,
after which we add LOG_BLOCK_HDR_SIZE */
ib_ulonglong
lsn
,
/* in: reset to this lsn
rounded up to be divisible by
OS_FILE_LOG_BLOCK_SIZE, after
which we add
LOG_BLOCK_HDR_SIZE */
#ifdef UNIV_LOG_ARCHIVE
ulint
arch_log_no
,
/* in: next archived log file number */
ulint
arch_log_no
,
/* in: next archived log file number */
#endif
/* UNIV_LOG_ARCHIVE */
ibool
new_logs_created
);
/* in: TRUE if resetting logs is done
at the log creation; FALSE if it is done
after archive recovery */
ibool
new_logs_created
);
/* in: TRUE if resetting logs
is done at the log creation;
FALSE if it is done after
archive recovery */
#ifdef UNIV_HOTBACKUP
/**********************************************************
Creates new log files after a backup has been restored. */
...
...
@@ -152,7 +166,7 @@ recv_reset_log_files_for_backup(
const
char
*
log_dir
,
/* in: log file directory path */
ulint
n_log_files
,
/* in: number of log files */
ulint
log_file_size
,
/* in: log file size */
dulint
lsn
);
/* in: new start lsn, must be
ib_ulonglong
lsn
);
/* in: new start lsn, must be
divisible by OS_FILE_LOG_BLOCK_SIZE */
#endif
/* UNIV_HOTBACKUP */
/************************************************************
...
...
@@ -199,14 +213,16 @@ Recovers from archived log files, and also from log files, if they exist. */
ulint
recv_recovery_from_archive_start
(
/*=============================*/
/* out: error code or DB_SUCCESS */
dulint
min_flushed_lsn
,
/* in: min flushed lsn field from the
data files */
dulint
limit_lsn
,
/* in: recover up to this lsn if possible */
ulint
first_log_no
);
/* in: number of the first archived log file
to use in the recovery; the file will be
searched from INNOBASE_LOG_ARCH_DIR specified
in server config file */
/* out: error code or DB_SUCCESS */
ib_ulonglong
min_flushed_lsn
,
/* in: min flushed lsn field from the
data files */
ib_ulonglong
limit_lsn
,
/* in: recover up to this lsn if
possible */
ulint
first_log_no
);
/* in: number of the first archived
log file to use in the recovery; the
file will be searched from
INNOBASE_LOG_ARCH_DIR specified in
server config file */
/************************************************************
Completes recovery from archive. */
...
...
@@ -231,11 +247,11 @@ struct recv_struct{
ulint
len
;
/* log record body length in bytes */
recv_data_t
*
data
;
/* chain of blocks containing the log record
body */
dulint
start_lsn
;
/* start lsn of the log segment written by
ib_ulonglong
start_lsn
;
/* start lsn of the log segment written by
the mtr which generated this log record: NOTE
that this is not necessarily the start lsn of
this log record */
dulint
end_lsn
;
/* end lsn of the log segment written by
ib_ulonglong
end_lsn
;
/* end lsn of the log segment written by
the mtr which generated this log record: NOTE
that this is not necessarily the end lsn of
this log record */
...
...
@@ -269,7 +285,7 @@ struct recv_sys_struct{
ibool
apply_batch_on
;
/* this is TRUE when a log rec application
batch is running */
dulint
lsn
;
/* log sequence number */
ib_ulonglong
lsn
;
/* log sequence number */
ulint
last_log_buf_size
;
/* size of the log buffer when the database
last time wrote to the log */
...
...
@@ -281,12 +297,12 @@ struct recv_sys_struct{
preceding buffer */
byte
*
buf
;
/* buffer for parsing log records */
ulint
len
;
/* amount of data in buf */
dulint
parse_start_lsn
;
ib_ulonglong
parse_start_lsn
;
/* this is the lsn from which we were able to
start parsing log records and adding them to
the hash table;
ut_dulint_
zero if a suitable
the hash table; zero if a suitable
start point not found yet */
dulint
scanned_lsn
;
ib_ulonglong
scanned_lsn
;
/* the log data has been scanned up to this
lsn */
ulint
scanned_checkpoint_no
;
...
...
@@ -295,10 +311,10 @@ struct recv_sys_struct{
ulint
recovered_offset
;
/* start offset of non-parsed log records in
buf */
dulint
recovered_lsn
;
ib_ulonglong
recovered_lsn
;
/* the log records have been parsed up to
this lsn */
dulint
limit_lsn
;
/* recovery should be made at most up to this
ib_ulonglong
limit_lsn
;
/* recovery should be made at most up to this
lsn */
ibool
found_corrupt_log
;
/* this is set to TRUE if we during log
...
...
include/mach0data.h
View file @
7593a465
...
...
@@ -179,6 +179,15 @@ mach_write_to_8(
/*============*/
byte
*
b
,
/* in: pointer to 8 bytes where to store */
dulint
n
);
/* in: dulint integer to be stored */
/***********************************************************
The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */
UNIV_INLINE
void
mach_write_ull
(
/*===========*/
byte
*
b
,
/* in: pointer to 8 bytes where to store */
ib_ulonglong
n
);
/* in: 64-bit integer to be stored */
/************************************************************
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */
...
...
@@ -188,6 +197,15 @@ mach_read_from_8(
/*=============*/
/* out: dulint integer */
const
byte
*
b
);
/* in: pointer to 8 bytes */
/************************************************************
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */
UNIV_INLINE
ib_ulonglong
mach_read_ull
(
/*==========*/
/* out: 64-bit integer */
const
byte
*
b
);
/* in: pointer to 8 bytes */
/*************************************************************
Writes a dulint in a compressed form (5..9 bytes). */
UNIV_INLINE
...
...
include/mach0data.ic
View file @
7593a465
...
...
@@ -273,6 +273,22 @@ mach_write_to_8(
mach_write_to_4(b + 4, ut_dulint_get_low(n));
}
/***********************************************************
The following function is used to store data in 8 consecutive
bytes. We store the most significant byte to the lowest address. */
UNIV_INLINE
void
mach_write_ull(
/*===========*/
byte* b, /* in: pointer to 8 bytes where to store */
ib_ulonglong n) /* in: 64-bit integer to be stored */
{
ut_ad(b);
mach_write_to_4(b, n >> 32);
mach_write_to_4(b + 4, n);
}
/************************************************************
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */
...
...
@@ -294,6 +310,24 @@ mach_read_from_8(
return(ut_dulint_create(high, low));
}
/************************************************************
The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */
UNIV_INLINE
ib_ulonglong
mach_read_ull(
/*==========*/
/* out: 64-bit integer */
const byte* b) /* in: pointer to 8 bytes */
{
ib_ulonglong ull;
ull = ((ib_ulonglong) mach_read_from_4(b)) << 32;
ull |= (ib_ulonglong) mach_read_from_4(b + 4);
return(ull);
}
/***********************************************************
The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */
...
...
include/mtr0mtr.h
View file @
7593a465
...
...
@@ -350,9 +350,9 @@ struct mtr_struct{
have been written to the mtr log */
ulint
log_mode
;
/* specifies which operations should be
logged; default value MTR_LOG_ALL */
dulint
start_lsn
;
/* start lsn of the possible log entry for
ib_ulonglong
start_lsn
;
/* start lsn of the possible log entry for
this mtr */
dulint
end_lsn
;
/* end lsn of the possible log entry for
ib_ulonglong
end_lsn
;
/* end lsn of the possible log entry for
this mtr */
ulint
magic_n
;
};
...
...
include/srv0start.h
View file @
7593a465
...
...
@@ -78,8 +78,8 @@ int
innobase_shutdown_for_mysql
(
void
);
/*=============================*/
/* out: DB_SUCCESS or error code */
extern
dulint
srv_shutdown_lsn
;
extern
dulint
srv_start_lsn
;
extern
ib_ulonglong
srv_shutdown_lsn
;
extern
ib_ulonglong
srv_start_lsn
;
#ifdef __NETWARE__
void
set_panic_flag_for_netware
(
void
);
...
...
include/trx0trx.h
View file @
7593a465
...
...
@@ -446,7 +446,7 @@ struct trx_struct{
were modifications by the transaction;
in that case we must flush the log
in trx_commit_complete_for_mysql() */
dulint
commit_lsn
;
/* lsn at the time of the commit */
ib_ulonglong
commit_lsn
;
/* lsn at the time of the commit */
ibool
dict_operation
;
/* TRUE if the trx is used to create
a table, create an index, or drop a
table. This is a hint that the table
...
...
include/univ.i
View file @
7593a465
...
...
@@ -202,8 +202,10 @@ typedef long int lint;
#
ifdef
__WIN__
typedef
__int64
ib_longlong
;
typedef
unsigned
__int64
ib_ulonglong
;
#
else
typedef
longlong
ib_longlong
;
typedef
ulonglong
ib_ulonglong
;
#
endif
#
ifndef
__WIN__
...
...
@@ -221,6 +223,9 @@ typedef longlong ib_longlong;
/* Maximum value for a ulint */
#
define
ULINT_MAX
((
ulint
)(
-
2
))
/* Maximum value for ib_ulonglong */
#
define
IB_ULONGLONG_MAX
((
ib_ulonglong
)
(
~
0ULL
))
/* This 'ibool' type is used within Innobase. Remember that different included
headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
#
define
ibool
ulint
...
...
include/ut0byte.h
View file @
7593a465
...
...
@@ -148,6 +148,26 @@ ut_dulint_align_up(
dulint
n
,
/* in: number to be rounded */
ulint
align_no
);
/* in: align by this number which must be a
power of 2 */
/************************************************************
Rounds a dulint downward to a multiple of a power of 2. */
UNIV_INLINE
ib_ulonglong
ut_ulonglong_align_down
(
/*====================*/
/* out: rounded value */
ib_ulonglong
n
,
/* in: number to be rounded */
ulint
align_no
);
/* in: align by this number
which must be a power of 2 */
/************************************************************
Rounds ib_ulonglong upward to a multiple of a power of 2. */
UNIV_INLINE
ib_ulonglong
ut_ulonglong_align_up
(
/*==================*/
/* out: rounded value */
ib_ulonglong
n
,
/* in: number to be rounded */
ulint
align_no
);
/* in: align by this number
which must be a power of 2 */
/***********************************************************
Increments a dulint variable by 1. */
#define UT_DULINT_INC(D)\
...
...
include/ut0byte.ic
View file @
7593a465
...
...
@@ -260,6 +260,42 @@ ut_dulint_align_up(
return(ut_dulint_align_down(ut_dulint_add(n, align_no - 1), align_no));
}
/************************************************************
Rounds ib_ulonglong downward to a multiple of a power of 2. */
UNIV_INLINE
ib_ulonglong
ut_ulonglong_align_down(
/*====================*/
/* out: rounded value */
ib_ulonglong n, /* in: number to be rounded */
ulint align_no) /* in: align by this number
which must be a power of 2 */
{
ut_ad(align_no > 0);
ut_ad(ut_is_2pow(align_no));
return(n & (ib_ulonglong) ~(align_no - 1));
}
/************************************************************
Rounds ib_ulonglong upward to a multiple of a power of 2. */
UNIV_INLINE
ib_ulonglong
ut_ulonglong_align_up(
/*==================*/
/* out: rounded value */
ib_ulonglong n, /* in: number to be rounded */
ulint align_no) /* in: align by this number
which must be a power of 2 */
{
ib_ulonglong align_1 = (ib_ulonglong) align_no - 1;
ut_ad(align_no > 0);
ut_ad(ut_is_2pow(align_no));
return((n + align_1) & ~align_1);
}
/************************************************************
The following function calculates the value of an integer n rounded
to the least product of align_no which is >= n. align_no
...
...
log/log0log.c
View file @
7593a465
...
...
@@ -159,11 +159,11 @@ log_fsp_current_free_limit_set_and_checkpoint(
Returns the oldest modified block lsn in the pool, or log_sys->lsn if none
exists. */
static
dulint
ib_ulonglong
log_buf_pool_get_oldest_modification
(
void
)
/*======================================*/
{
dulint
lsn
;
ib_ulonglong
lsn
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
...
...
@@ -171,7 +171,7 @@ log_buf_pool_get_oldest_modification(void)
lsn
=
buf_pool_get_oldest_modification
();
if
(
ut_dulint_is_zero
(
lsn
)
)
{
if
(
!
lsn
)
{
lsn
=
log_sys
->
lsn
;
}
...
...
@@ -183,7 +183,7 @@ log_buf_pool_get_oldest_modification(void)
Opens the log for log_write_low. The log must be closed with log_close and
released with log_release. */
dulint
ib_ulonglong
log_reserve_and_open
(
/*=================*/
/* out: start lsn of the log record */
...
...
@@ -227,8 +227,7 @@ loop:
#ifdef UNIV_LOG_ARCHIVE
if
(
log
->
archiving_state
!=
LOG_ARCH_OFF
)
{
archived_lsn_age
=
ut_dulint_minus
(
log
->
lsn
,
log
->
archived_lsn
);
archived_lsn_age
=
log
->
lsn
-
log
->
archived_lsn
;
if
(
archived_lsn_age
+
len_upper_limit
>
log
->
max_archived_lsn_age
)
{
/* Not enough free archived space in log groups: do a
...
...
@@ -306,12 +305,12 @@ part_loop:
log_sys
->
next_checkpoint_no
);
len
+=
LOG_BLOCK_HDR_SIZE
+
LOG_BLOCK_TRL_SIZE
;
log
->
lsn
=
ut_dulint_add
(
log
->
lsn
,
len
)
;
log
->
lsn
+=
len
;
/* Initialize the next block header */
log_block_init
(
log_block
+
OS_FILE_LOG_BLOCK_SIZE
,
log
->
lsn
);
}
else
{
log
->
lsn
=
ut_dulint_add
(
log
->
lsn
,
len
)
;
log
->
lsn
+=
len
;
}
log
->
buf_free
+=
len
;
...
...
@@ -328,17 +327,17 @@ part_loop:
/****************************************************************
Closes the log. */
dulint
ib_ulonglong
log_close
(
void
)
/*===========*/
/* out: lsn */
{
byte
*
log_block
;
ulint
first_rec_group
;
dulint
oldest_lsn
;
dulint
lsn
;
log_t
*
log
=
log_sys
;
ulint
checkpoint_age
;
byte
*
log_block
;
ulint
first_rec_group
;
ib_ulonglong
oldest_lsn
;
ib_ulonglong
lsn
;
log_t
*
log
=
log_sys
;
ulint
checkpoint_age
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log
->
mutex
)));
...
...
@@ -364,7 +363,7 @@ log_close(void)
log
->
check_flush_or_checkpoint
=
TRUE
;
}
checkpoint_age
=
ut_dulint_minus
(
lsn
,
log
->
last_checkpoint_lsn
)
;
checkpoint_age
=
lsn
-
log
->
last_checkpoint_lsn
;
if
(
checkpoint_age
>=
log
->
log_group_capacity
)
{
/* TODO: split btr_store_big_rec_extern_fields() into small
...
...
@@ -402,9 +401,8 @@ log_close(void)
oldest_lsn
=
buf_pool_get_oldest_modification
();
if
(
ut_dulint_is_zero
(
oldest_lsn
)
||
(
ut_dulint_minus
(
lsn
,
oldest_lsn
)
>
log
->
max_modified_age_async
)
if
(
!
oldest_lsn
||
lsn
-
oldest_lsn
>
log
->
max_modified_age_async
||
checkpoint_age
>
log
->
max_checkpoint_age_async
)
{
log
->
check_flush_or_checkpoint
=
TRUE
;
...
...
@@ -428,10 +426,10 @@ void
log_pad_current_log_block
(
void
)
/*===========================*/
{
byte
b
=
MLOG_DUMMY_RECORD
;
ulint
pad_length
;
ulint
i
;
dulint
lsn
;
byte
b
=
MLOG_DUMMY_RECORD
;
ulint
pad_length
;
ulint
i
;
ib_ulonglong
lsn
;
/* We retrieve lsn only because otherwise gcc crashed on HP-UX */
lsn
=
log_reserve_and_open
(
OS_FILE_LOG_BLOCK_SIZE
);
...
...
@@ -449,8 +447,7 @@ log_pad_current_log_block(void)
log_close
();
log_release
();
ut_a
((
ut_dulint_get_low
(
lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
)
==
LOG_BLOCK_HDR_SIZE
);
ut_a
(
lsn
%
OS_FILE_LOG_BLOCK_SIZE
==
LOG_BLOCK_HDR_SIZE
);
}
#endif
/* UNIV_LOG_ARCHIVE */
...
...
@@ -515,11 +512,11 @@ ulint
log_group_calc_lsn_offset
(
/*======================*/
/* out: offset within the log group */
dulint
lsn
,
/* in: lsn, must be within 4 GB of
ib_ulonglong
lsn
,
/* in: lsn, must be within 4 GB of
group->lsn */
log_group_t
*
group
)
/* in: log group */
{
dulint
gr_lsn
;
ib_ulonglong
gr_lsn
;
ib_longlong
gr_lsn_size_offset
;
ib_longlong
difference
;
ib_longlong
group_size
;
...
...
@@ -539,11 +536,11 @@ log_group_calc_lsn_offset(
group_size
=
(
ib_longlong
)
log_group_get_capacity
(
group
);
if
(
ut_dulint_cmp
(
lsn
,
gr_lsn
)
>=
0
)
{
if
(
lsn
>=
gr_lsn
)
{
difference
=
(
ib_longlong
)
ut_dulint_minus
(
lsn
,
gr_lsn
);
difference
=
(
ib_longlong
)
(
lsn
-
gr_lsn
);
}
else
{
difference
=
(
ib_longlong
)
ut_dulint_minus
(
gr_lsn
,
lsn
);
difference
=
(
ib_longlong
)
(
gr_lsn
-
lsn
);
difference
=
difference
%
group_size
;
...
...
@@ -571,36 +568,31 @@ log_calc_where_lsn_is(
/* out: log file number */
ib_longlong
*
log_file_offset
,
/* out: offset in that file
(including the header) */
dulint
first_header_lsn
,
/* in: first log file start
ib_ulonglong
first_header_lsn
,
/* in: first log file start
lsn */
dulint
lsn
,
/* in: lsn whose position to
ib_ulonglong
lsn
,
/* in: lsn whose position to
determine */
ulint
n_log_files
,
/* in: total number of log
files */
ib_longlong
log_file_size
)
/* in: log file size
(including the header) */
{
ib_longlong
ib_lsn
;
ib_longlong
ib_first_header_lsn
;
ib_longlong
capacity
=
log_file_size
-
LOG_FILE_HDR_SIZE
;
ulint
file_no
;
ib_longlong
add_this_many
;
ib_lsn
=
ut_conv_dulint_to_longlong
(
lsn
);
ib_first_header_lsn
=
ut_conv_dulint_to_longlong
(
first_header_lsn
);
if
(
ib_lsn
<
ib_first_header_lsn
)
{
add_this_many
=
1
+
(
ib_first_header_lsn
-
ib_lsn
)
if
(
lsn
<
first_header_lsn
)
{
add_this_many
=
1
+
(
first_header_lsn
-
lsn
)
/
(
capacity
*
(
ib_longlong
)
n_log_files
);
ib_
lsn
+=
add_this_many
lsn
+=
add_this_many
*
capacity
*
(
ib_longlong
)
n_log_files
;
}
ut_a
(
ib_lsn
>=
ib_
first_header_lsn
);
ut_a
(
lsn
>=
first_header_lsn
);
file_no
=
((
ulint
)((
ib_lsn
-
ib_
first_header_lsn
)
/
capacity
))
file_no
=
((
ulint
)((
lsn
-
first_header_lsn
)
/
capacity
))
%
n_log_files
;
*
log_file_offset
=
(
ib_lsn
-
ib_
first_header_lsn
)
%
capacity
;
*
log_file_offset
=
(
lsn
-
first_header_lsn
)
%
capacity
;
*
log_file_offset
=
*
log_file_offset
+
LOG_FILE_HDR_SIZE
;
...
...
@@ -616,7 +608,7 @@ void
log_group_set_fields
(
/*=================*/
log_group_t
*
group
,
/* in: group */
dulint
lsn
)
/* in: lsn for which the values should be
ib_ulonglong
lsn
)
/* in: lsn for which the values should be
set */
{
group
->
lsn_offset
=
log_group_calc_lsn_offset
(
lsn
,
group
);
...
...
@@ -783,9 +775,9 @@ log_init(void)
log_sys
->
buf_next_to_write
=
0
;
log_sys
->
write_lsn
=
ut_dulint_zero
;
log_sys
->
current_flush_lsn
=
ut_dulint_zero
;
log_sys
->
flushed_to_disk_lsn
=
ut_dulint_zero
;
log_sys
->
write_lsn
=
0
;
log_sys
->
current_flush_lsn
=
0
;
log_sys
->
flushed_to_disk_lsn
=
0
;
log_sys
->
written_to_some_lsn
=
log_sys
->
lsn
;
log_sys
->
written_to_all_lsn
=
log_sys
->
lsn
;
...
...
@@ -803,7 +795,7 @@ log_init(void)
/*----------------------------*/
log_sys
->
adm_checkpoint_interval
=
ULINT_MAX
;
log_sys
->
next_checkpoint_no
=
ut_dulint_zero
;
log_sys
->
next_checkpoint_no
=
0
;
log_sys
->
last_checkpoint_lsn
=
log_sys
->
lsn
;
log_sys
->
n_pending_checkpoint_writes
=
0
;
...
...
@@ -819,7 +811,7 @@ log_init(void)
/* Under MySQL, log archiving is always off */
log_sys
->
archiving_state
=
LOG_ARCH_OFF
;
log_sys
->
archived_lsn
=
log_sys
->
lsn
;
log_sys
->
next_archived_lsn
=
ut_dulint_zero
;
log_sys
->
next_archived_lsn
=
0
;
log_sys
->
n_pending_archive_ios
=
0
;
...
...
@@ -844,7 +836,7 @@ log_init(void)
log_block_set_first_rec_group
(
log_sys
->
buf
,
LOG_BLOCK_HDR_SIZE
);
log_sys
->
buf_free
=
LOG_BLOCK_HDR_SIZE
;
log_sys
->
lsn
=
ut_dulint_add
(
LOG_START_LSN
,
LOG_BLOCK_HDR_SIZE
)
;
log_sys
->
lsn
=
LOG_START_LSN
+
LOG_BLOCK_HDR_SIZE
;
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -856,7 +848,7 @@ log_init(void)
recv_sys
->
scanned_lsn
=
log_sys
->
lsn
;
recv_sys
->
scanned_checkpoint_no
=
0
;
recv_sys
->
recovered_lsn
=
log_sys
->
lsn
;
recv_sys
->
limit_lsn
=
ut_dulint_max
;
recv_sys
->
limit_lsn
=
IB_ULONGLONG_MAX
;
#endif
}
...
...
@@ -1124,7 +1116,7 @@ log_group_file_header_flush(
log_group_t
*
group
,
/* in: log group */
ulint
nth_file
,
/* in: header to the nth file in the
log file space */
dulint
start_lsn
)
/* in: log file data starts at this
ib_ulonglong
start_lsn
)
/* in: log file data starts at this
lsn */
{
byte
*
buf
;
...
...
@@ -1138,7 +1130,7 @@ log_group_file_header_flush(
buf
=
*
(
group
->
file_header_bufs
+
nth_file
);
mach_write_to_4
(
buf
+
LOG_GROUP_ID
,
group
->
id
);
mach_write_
to_8
(
buf
+
LOG_FILE_START_LSN
,
start_lsn
);
mach_write_
ull
(
buf
+
LOG_FILE_START_LSN
,
start_lsn
);
/* Wipe over possible label of ibbackup --restore */
memcpy
(
buf
+
LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
,
" "
,
4
);
...
...
@@ -1190,7 +1182,7 @@ log_group_write_buf(
byte
*
buf
,
/* in: buffer */
ulint
len
,
/* in: buffer len; must be divisible
by OS_FILE_LOG_BLOCK_SIZE */
dulint
start_lsn
,
/* in: start lsn of the buffer; must
ib_ulonglong
start_lsn
,
/* in: start lsn of the buffer; must
be divisible by
OS_FILE_LOG_BLOCK_SIZE */
ulint
new_data_offset
)
/* in: start offset of new data in
...
...
@@ -1207,7 +1199,7 @@ log_group_write_buf(
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
#endif
/* UNIV_SYNC_DEBUG */
ut_a
(
len
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
ut_a
(
ut_dulint_get_low
(
start_lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
ut_a
(
((
ulint
)
start_lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
if
(
new_data_offset
==
0
)
{
write_header
=
TRUE
;
...
...
@@ -1247,12 +1239,11 @@ loop:
fprintf
(
stderr
,
"Writing log file segment to group %lu"
" offset %lu len %lu
\n
"
"start lsn %l
u %
lu
\n
"
"start lsn %llu
\n
"
"First block n:o %lu last block n:o %lu
\n
"
,
(
ulong
)
group
->
id
,
(
ulong
)
next_offset
,
(
ulong
)
write_len
,
(
ulong
)
ut_dulint_get_high
(
start_lsn
),
(
ulong
)
ut_dulint_get_low
(
start_lsn
),
start_lsn
,
(
ulong
)
log_block_get_hdr_no
(
buf
),
(
ulong
)
log_block_get_hdr_no
(
buf
+
write_len
-
OS_FILE_LOG_BLOCK_SIZE
));
...
...
@@ -1290,7 +1281,7 @@ loop:
}
if
(
write_len
<
len
)
{
start_lsn
=
ut_dulint_add
(
start_lsn
,
write_len
)
;
start_lsn
+=
write_len
;
len
-=
write_len
;
buf
+=
write_len
;
...
...
@@ -1309,13 +1300,14 @@ flush flushed enough. If not, starts a new flush. */
void
log_write_up_to
(
/*============*/
dulint
lsn
,
/* in: log sequence number up to which the log should
be written, ut_dulint_max if not specified */
ulint
wait
,
/* in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
or LOG_WAIT_ALL_GROUPS */
ibool
flush_to_disk
)
/* in: TRUE if we want the written log also to be
flushed to disk */
ib_ulonglong
lsn
,
/* in: log sequence number up to which
the log should be written,
IB_ULONGLONG_MAX if not specified */
ulint
wait
,
/* in: LOG_NO_WAIT, LOG_WAIT_ONE_GROUP,
or LOG_WAIT_ALL_GROUPS */
ibool
flush_to_disk
)
/* in: TRUE if we want the written log
also to be flushed to disk */
{
log_group_t
*
group
;
ulint
start_offset
;
...
...
@@ -1350,7 +1342,7 @@ loop:
mutex_enter
(
&
(
log_sys
->
mutex
));
if
(
flush_to_disk
&&
ut_dulint_cmp
(
log_sys
->
flushed_to_disk_lsn
,
lsn
)
>=
0
)
{
&&
log_sys
->
flushed_to_disk_lsn
>=
lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -1358,9 +1350,8 @@ loop:
}
if
(
!
flush_to_disk
&&
(
ut_dulint_cmp
(
log_sys
->
written_to_all_lsn
,
lsn
)
>=
0
||
(
ut_dulint_cmp
(
log_sys
->
written_to_some_lsn
,
lsn
)
>=
0
&&
(
log_sys
->
written_to_all_lsn
>=
lsn
||
(
log_sys
->
written_to_some_lsn
>=
lsn
&&
wait
!=
LOG_WAIT_ALL_GROUPS
)))
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -1372,8 +1363,7 @@ loop:
/* A write (+ possibly flush to disk) is running */
if
(
flush_to_disk
&&
ut_dulint_cmp
(
log_sys
->
current_flush_lsn
,
lsn
)
>=
0
)
{
&&
log_sys
->
current_flush_lsn
>=
lsn
)
{
/* The write + flush will write enough: wait for it to
complete */
...
...
@@ -1381,7 +1371,7 @@ loop:
}
if
(
!
flush_to_disk
&&
ut_dulint_cmp
(
log_sys
->
write_lsn
,
lsn
)
>=
0
)
{
&&
log_sys
->
write_lsn
>=
lsn
)
{
/* The write will write enough: wait for it to
complete */
...
...
@@ -1410,13 +1400,9 @@ loop:
#ifdef UNIV_DEBUG
if
(
log_debug_writes
)
{
fprintf
(
stderr
,
"Writing log from %lu %lu up to lsn %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
log_sys
->
written_to_all_lsn
),
(
ulong
)
ut_dulint_get_low
(
log_sys
->
written_to_all_lsn
),
(
ulong
)
ut_dulint_get_high
(
log_sys
->
lsn
),
(
ulong
)
ut_dulint_get_low
(
log_sys
->
lsn
));
"Writing log from %llu up to lsn %llu
\n
"
,
log_sys
->
written_to_all_lsn
,
log_sys
->
lsn
);
}
#endif
/* UNIV_DEBUG */
log_sys
->
n_pending_writes
++
;
...
...
@@ -1468,8 +1454,8 @@ loop:
log_group_write_buf
(
group
,
log_sys
->
buf
+
area_start
,
area_end
-
area_start
,
ut_
dulint
_align_down
(
log_sys
->
written_to_all_lsn
,
OS_FILE_LOG_BLOCK_SIZE
),
ut_
ulonglong
_align_down
(
log_sys
->
written_to_all_lsn
,
OS_FILE_LOG_BLOCK_SIZE
),
start_offset
-
area_start
);
log_group_set_fields
(
group
,
log_sys
->
write_lsn
);
...
...
@@ -1531,7 +1517,7 @@ void
log_buffer_flush_to_disk
(
void
)
/*==========================*/
{
dulint
lsn
;
ib_ulonglong
lsn
;
mutex_enter
(
&
(
log_sys
->
mutex
));
...
...
@@ -1550,9 +1536,9 @@ void
log_flush_margin
(
void
)
/*==================*/
{
ibool
do_flush
=
FALSE
;
log_t
*
log
=
log_sys
;
dulint
lsn
;
ibool
do_flush
=
FALSE
;
log_t
*
log
=
log_sys
;
ib_ulonglong
lsn
;
mutex_enter
(
&
(
log
->
mutex
));
...
...
@@ -1582,13 +1568,16 @@ no synchronization objects! */
ibool
log_preflush_pool_modified_pages
(
/*=============================*/
/* out: FALSE if there was a flush batch of
the same type running, which means that we
could not start this flush batch */
dulint
new_oldest
,
/* in: try to advance oldest_modified_lsn
at least to this lsn */
ibool
sync
)
/* in: TRUE if synchronous operation is
desired */
/* out: FALSE if there was a
flush batch of the same type
running, which means that we
could not start this flush
batch */
ib_ulonglong
new_oldest
,
/* in: try to advance
oldest_modified_lsn at least
to this lsn */
ibool
sync
)
/* in: TRUE if synchronous
operation is desired */
{
ulint
n_pages
;
...
...
@@ -1631,8 +1620,7 @@ log_complete_checkpoint(void)
#endif
/* UNIV_SYNC_DEBUG */
ut_ad
(
log_sys
->
n_pending_checkpoint_writes
==
0
);
log_sys
->
next_checkpoint_no
=
ut_dulint_add
(
log_sys
->
next_checkpoint_no
,
1
);
log_sys
->
next_checkpoint_no
++
;
log_sys
->
last_checkpoint_lsn
=
log_sys
->
next_checkpoint_lsn
;
...
...
@@ -1707,13 +1695,13 @@ log_group_checkpoint(
{
log_group_t
*
group2
;
#ifdef UNIV_LOG_ARCHIVE
dulint
archived_lsn
;
dulint
next_archived_lsn
;
ib_ulonglong
archived_lsn
;
ib_ulonglong
next_archived_lsn
;
#endif
/* UNIV_LOG_ARCHIVE */
ulint
write_offset
;
ulint
fold
;
byte
*
buf
;
ulint
i
;
ulint
write_offset
;
ulint
fold
;
byte
*
buf
;
ulint
i
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
...
...
@@ -1724,9 +1712,8 @@ log_group_checkpoint(
buf
=
group
->
checkpoint_buf
;
mach_write_to_8
(
buf
+
LOG_CHECKPOINT_NO
,
log_sys
->
next_checkpoint_no
);
mach_write_to_8
(
buf
+
LOG_CHECKPOINT_LSN
,
log_sys
->
next_checkpoint_lsn
);
mach_write_ull
(
buf
+
LOG_CHECKPOINT_NO
,
log_sys
->
next_checkpoint_no
);
mach_write_ull
(
buf
+
LOG_CHECKPOINT_LSN
,
log_sys
->
next_checkpoint_lsn
);
mach_write_to_4
(
buf
+
LOG_CHECKPOINT_OFFSET
,
log_group_calc_lsn_offset
(
...
...
@@ -1736,20 +1723,19 @@ log_group_checkpoint(
#ifdef UNIV_LOG_ARCHIVE
if
(
log_sys
->
archiving_state
==
LOG_ARCH_OFF
)
{
archived_lsn
=
ut_dulint_max
;
archived_lsn
=
IB_ULONGLONG_MAX
;
}
else
{
archived_lsn
=
log_sys
->
archived_lsn
;
if
(
0
!=
ut_dulint_cmp
(
archived_lsn
,
log_sys
->
next_archived_lsn
))
{
if
(
archived_lsn
!=
log_sys
->
next_archived_lsn
)
{
next_archived_lsn
=
log_sys
->
next_archived_lsn
;
/* For debugging only */
}
}
mach_write_
to_8
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
,
archived_lsn
);
mach_write_
ull
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
,
archived_lsn
);
#else
/* UNIV_LOG_ARCHIVE */
mach_write_
to_8
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
,
ut_dulint_max
);
mach_write_
ull
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
,
IB_ULONGLONG_MAX
);
#endif
/* UNIV_LOG_ARCHIVE */
for
(
i
=
0
;
i
<
LOG_MAX_N_GROUPS
;
i
++
)
{
...
...
@@ -1790,7 +1776,7 @@ log_group_checkpoint(
/* We alternate the physical place of the checkpoint info in the first
log file */
if
(
ut_dulint_get_low
(
log_sys
->
next_checkpoint_no
)
%
2
==
0
)
{
if
(
(
log_sys
->
next_checkpoint_no
&
1
)
==
0
)
{
write_offset
=
LOG_CHECKPOINT_1
;
}
else
{
write_offset
=
LOG_CHECKPOINT_2
;
...
...
@@ -1828,20 +1814,20 @@ backup restoration. */
void
log_reset_first_header_and_checkpoint
(
/*==================================*/
byte
*
hdr_buf
,
/* in: buffer which will be written to the start
of the first log file */
dulint
start
)
/* in: lsn of the start of the first log file;
we pretend that there is a checkpoint at
start + LOG_BLOCK_HDR_SIZE */
byte
*
hdr_buf
,
/* in: buffer which will be written to the
start
of the first log file */
ib_ulonglong
start
)
/* in: lsn of the start of the first log file;
we pretend that there is a checkpoint at
start + LOG_BLOCK_HDR_SIZE */
{
ulint
fold
;
byte
*
buf
;
dulint
lsn
;
ulint
fold
;
byte
*
buf
;
ib_ulonglong
lsn
;
mach_write_to_4
(
hdr_buf
+
LOG_GROUP_ID
,
0
);
mach_write_
to_8
(
hdr_buf
+
LOG_FILE_START_LSN
,
start
);
mach_write_
ull
(
hdr_buf
+
LOG_FILE_START_LSN
,
start
);
lsn
=
ut_dulint_add
(
start
,
LOG_BLOCK_HDR_SIZE
)
;
lsn
=
start
+
LOG_BLOCK_HDR_SIZE
;
/* Write the label of ibbackup --restore */
strcpy
((
char
*
)
hdr_buf
+
LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
,
...
...
@@ -1851,15 +1837,15 @@ log_reset_first_header_and_checkpoint(
+
(
sizeof
"ibbackup "
)
-
1
));
buf
=
hdr_buf
+
LOG_CHECKPOINT_1
;
mach_write_
to_8
(
buf
+
LOG_CHECKPOINT_NO
,
ut_dulint_zero
);
mach_write_
to_8
(
buf
+
LOG_CHECKPOINT_LSN
,
lsn
);
mach_write_
ull
(
buf
+
LOG_CHECKPOINT_NO
,
0
);
mach_write_
ull
(
buf
+
LOG_CHECKPOINT_LSN
,
lsn
);
mach_write_to_4
(
buf
+
LOG_CHECKPOINT_OFFSET
,
LOG_FILE_HDR_SIZE
+
LOG_BLOCK_HDR_SIZE
);
mach_write_to_4
(
buf
+
LOG_CHECKPOINT_LOG_BUF_SIZE
,
2
*
1024
*
1024
);
mach_write_
to_8
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
,
ut_dulint_max
);
mach_write_
ull
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
,
IB_ULONGLONG_MAX
);
fold
=
ut_fold_binary
(
buf
,
LOG_CHECKPOINT_CHECKSUM_1
);
mach_write_to_4
(
buf
+
LOG_CHECKPOINT_CHECKSUM_1
,
fold
);
...
...
@@ -1935,7 +1921,7 @@ log_checkpoint(
parameter TRUE, a physical write will always be
made to log files */
{
dulint
oldest_lsn
;
ib_ulonglong
oldest_lsn
;
if
(
recv_recovery_is_on
())
{
recv_apply_hashed_log_recs
(
TRUE
);
...
...
@@ -1964,14 +1950,14 @@ log_checkpoint(
mutex_enter
(
&
(
log_sys
->
mutex
));
if
(
!
write_always
&&
ut_dulint_cmp
(
log_sys
->
last_checkpoint_lsn
,
oldest_lsn
)
>=
0
)
{
&&
log_sys
->
last_checkpoint_lsn
>=
oldest_lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
return
(
TRUE
);
}
ut_ad
(
ut_dulint_cmp
(
log_sys
->
written_to_all_lsn
,
oldest_lsn
)
>=
0
);
ut_ad
(
log_sys
->
written_to_all_lsn
>=
oldest_lsn
);
if
(
log_sys
->
n_pending_checkpoint_writes
>
0
)
{
/* A checkpoint write is running */
...
...
@@ -1991,10 +1977,9 @@ log_checkpoint(
#ifdef UNIV_DEBUG
if
(
log_debug_writes
)
{
fprintf
(
stderr
,
"Making checkpoint no %lu at lsn %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_low
(
log_sys
->
next_checkpoint_no
),
(
ulong
)
ut_dulint_get_high
(
oldest_lsn
),
(
ulong
)
ut_dulint_get_low
(
oldest_lsn
));
fprintf
(
stderr
,
"Making checkpoint no %lu at lsn %llu
\n
"
,
(
ulong
)
log_sys
->
next_checkpoint_no
,
oldest_lsn
);
}
#endif
/* UNIV_DEBUG */
...
...
@@ -2017,31 +2002,22 @@ Makes a checkpoint at a given lsn or later. */
void
log_make_checkpoint_at
(
/*===================*/
dulint
lsn
,
/* in: make a checkpoint at this or a later
lsn, if ut_dulint_max, makes a checkpoint at
the latest lsn */
ibool
write_always
)
/* in: the function normally checks if the
the new checkpoint would have a greater
lsn than the previous one: if not, then no
physical write is done; by setting this
parameter TRUE, a physical write will always be
made to log files */
ib_ulonglong
lsn
,
/* in: make a checkpoint at this or a
later lsn, if IB_ULONGLONG_MAX, makes
a checkpoint at the latest lsn */
ibool
write_always
)
/* in: the function normally checks if
the the new checkpoint would have a
greater lsn than the previous one: if
not, then no physical write is done;
by setting this parameter TRUE, a
physical write will always be made to
log files */
{
ibool
success
;
/* Preflush pages synchronously */
success
=
FALSE
;
while
(
!
success
)
{
success
=
log_preflush_pool_modified_pages
(
lsn
,
TRUE
);
}
success
=
FALSE
;
while
(
!
log_preflush_pool_modified_pages
(
lsn
,
TRUE
));
while
(
!
success
)
{
success
=
log_checkpoint
(
TRUE
,
write_always
);
}
while
(
!
log_checkpoint
(
TRUE
,
write_always
));
}
/********************************************************************
...
...
@@ -2054,15 +2030,15 @@ void
log_checkpoint_margin
(
void
)
/*=======================*/
{
log_t
*
log
=
log_sys
;
ulint
age
;
ulint
checkpoint_age
;
ulint
advance
;
dulint
oldest_lsn
;
ibool
sync
;
ibool
checkpoint_sync
;
ibool
do_checkpoint
;
ibool
success
;
log_t
*
log
=
log_sys
;
ulint
age
;
ulint
checkpoint_age
;
ulint
advance
;
ib_ulonglong
oldest_lsn
;
ibool
sync
;
ibool
checkpoint_sync
;
ibool
do_checkpoint
;
ibool
success
;
loop:
sync
=
FALSE
;
checkpoint_sync
=
FALSE
;
...
...
@@ -2078,7 +2054,7 @@ loop:
oldest_lsn
=
log_buf_pool_get_oldest_modification
();
age
=
ut_dulint_minus
(
log
->
lsn
,
oldest_lsn
)
;
age
=
log
->
lsn
-
oldest_lsn
;
if
(
age
>
log
->
max_modified_age_sync
)
{
...
...
@@ -2094,7 +2070,7 @@ loop:
advance
=
0
;
}
checkpoint_age
=
ut_dulint_minus
(
log
->
lsn
,
log
->
last_checkpoint_lsn
)
;
checkpoint_age
=
log
->
lsn
-
log
->
last_checkpoint_lsn
;
if
(
checkpoint_age
>
log
->
max_checkpoint_age
)
{
/* A checkpoint is urgent: we do it synchronously */
...
...
@@ -2116,7 +2092,7 @@ loop:
mutex_exit
(
&
(
log
->
mutex
));
if
(
advance
)
{
dulint
new_oldest
=
ut_dulint_add
(
oldest_lsn
,
advance
)
;
ib_ulonglong
new_oldest
=
oldest_lsn
+
advance
;
success
=
log_preflush_pool_modified_pages
(
new_oldest
,
sync
);
...
...
@@ -2155,8 +2131,8 @@ log_group_read_log_seg(
ulint
type
,
/* in: LOG_ARCHIVE or LOG_RECOVER */
byte
*
buf
,
/* in: buffer where to read */
log_group_t
*
group
,
/* in: log group */
dulint
start_lsn
,
/* in: read area start */
dulint
end_lsn
)
/* in: read area end */
ib_ulonglong
start_lsn
,
/* in: read area start */
ib_ulonglong
end_lsn
)
/* in: read area end */
{
ulint
len
;
ulint
source_offset
;
...
...
@@ -2166,15 +2142,11 @@ log_group_read_log_seg(
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
#endif
/* UNIV_SYNC_DEBUG */
sync
=
FALSE
;
if
(
type
==
LOG_RECOVER
)
{
sync
=
TRUE
;
}
sync
=
(
type
==
LOG_RECOVER
);
loop:
source_offset
=
log_group_calc_lsn_offset
(
start_lsn
,
group
);
len
=
ut_dulint_minus
(
end_lsn
,
start_lsn
);
len
=
(
ulint
)
(
end_lsn
-
start_lsn
);
ut_ad
(
len
!=
0
);
...
...
@@ -2196,10 +2168,10 @@ loop:
source_offset
/
UNIV_PAGE_SIZE
,
source_offset
%
UNIV_PAGE_SIZE
,
len
,
buf
,
NULL
);
start_lsn
=
ut_dulint_add
(
start_lsn
,
len
)
;
start_lsn
+=
len
;
buf
+=
len
;
if
(
ut_dulint_cmp
(
start_lsn
,
end_lsn
)
!=
0
)
{
if
(
start_lsn
!=
end_lsn
)
{
goto
loop
;
}
...
...
@@ -2231,7 +2203,7 @@ log_group_archive_file_header_write(
ulint
nth_file
,
/* in: header to the nth file in the
archive log file space */
ulint
file_no
,
/* in: archived file number */
dulint
start_lsn
)
/* in: log file data starts at this
ib_ulonglong
start_lsn
)
/* in: log file data starts at this
lsn */
{
byte
*
buf
;
...
...
@@ -2246,7 +2218,7 @@ log_group_archive_file_header_write(
buf
=
*
(
group
->
archive_file_header_bufs
+
nth_file
);
mach_write_to_4
(
buf
+
LOG_GROUP_ID
,
group
->
id
);
mach_write_
to_8
(
buf
+
LOG_FILE_START_LSN
,
start_lsn
);
mach_write_
ull
(
buf
+
LOG_FILE_START_LSN
,
start_lsn
);
mach_write_to_4
(
buf
+
LOG_FILE_NO
,
file_no
);
mach_write_to_4
(
buf
+
LOG_FILE_ARCH_COMPLETED
,
FALSE
);
...
...
@@ -2271,7 +2243,7 @@ log_group_archive_completed_header_write(
log_group_t
*
group
,
/* in: log group */
ulint
nth_file
,
/* in: header to the nth file in the
archive log file space */
dulint
end_lsn
)
/* in: end lsn of the file */
ib_ulonglong
end_lsn
)
/* in: end lsn of the file */
{
byte
*
buf
;
ulint
dest_offset
;
...
...
@@ -2284,7 +2256,7 @@ log_group_archive_completed_header_write(
buf
=
*
(
group
->
archive_file_header_bufs
+
nth_file
);
mach_write_to_4
(
buf
+
LOG_FILE_ARCH_COMPLETED
,
TRUE
);
mach_write_
to_8
(
buf
+
LOG_FILE_END_LSN
,
end_lsn
);
mach_write_
ull
(
buf
+
LOG_FILE_END_LSN
,
end_lsn
);
dest_offset
=
nth_file
*
group
->
file_size
+
LOG_FILE_ARCH_COMPLETED
;
...
...
@@ -2306,16 +2278,16 @@ log_group_archive(
/*==============*/
log_group_t
*
group
)
/* in: log group */
{
os_file_t
file_handle
;
dulint
start_lsn
;
dulint
end_lsn
;
char
name
[
1024
];
byte
*
buf
;
ulint
len
;
ibool
ret
;
ulint
next_offset
;
ulint
n_files
;
ulint
open_mode
;
os_file_t
file_handle
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
char
name
[
1024
];
byte
*
buf
;
ulint
len
;
ibool
ret
;
ulint
next_offset
;
ulint
n_files
;
ulint
open_mode
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
...
...
@@ -2323,11 +2295,11 @@ log_group_archive(
start_lsn
=
log_sys
->
archived_lsn
;
ut_a
(
ut_dulint_get_low
(
start_lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
ut_a
(
start_lsn
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
end_lsn
=
log_sys
->
next_archived_lsn
;
ut_a
(
ut_dulint_get_low
(
end_lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
ut_a
(
end_lsn
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
buf
=
log_sys
->
archive_buf
;
...
...
@@ -2396,7 +2368,7 @@ loop:
}
}
len
=
ut_dulint_minus
(
end_lsn
,
start_lsn
)
;
len
=
end_lsn
-
start_lsn
;
if
(
group
->
file_size
<
(
next_offset
%
group
->
file_size
)
+
len
)
{
...
...
@@ -2406,10 +2378,9 @@ loop:
#ifdef UNIV_DEBUG
if
(
log_debug_writes
)
{
fprintf
(
stderr
,
"Archiving starting at lsn %l
u %
lu, len %lu"
"Archiving starting at lsn %llu, len %lu"
" to group %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
start_lsn
),
(
ulong
)
ut_dulint_get_low
(
start_lsn
),
start_lsn
,
(
ulong
)
len
,
(
ulong
)
group
->
id
);
}
#endif
/* UNIV_DEBUG */
...
...
@@ -2423,7 +2394,7 @@ loop:
ut_calc_align
(
len
,
OS_FILE_LOG_BLOCK_SIZE
),
buf
,
&
log_archive_io
);
start_lsn
=
ut_dulint_add
(
start_lsn
,
len
)
;
start_lsn
+=
len
;
next_offset
+=
len
;
buf
+=
len
;
...
...
@@ -2431,7 +2402,7 @@ loop:
n_files
++
;
}
if
(
ut_dulint_cmp
(
end_lsn
,
start_lsn
)
!=
0
)
{
if
(
end_lsn
!=
start_lsn
)
{
goto
loop
;
}
...
...
@@ -2473,8 +2444,8 @@ log_archive_write_complete_groups(void)
ulint
end_offset
;
ulint
trunc_files
;
ulint
n_files
;
dulint
start_lsn
;
dulint
end_lsn
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
ulint
i
;
#ifdef UNIV_SYNC_DEBUG
...
...
@@ -2512,16 +2483,14 @@ log_archive_write_complete_groups(void)
#endif
/* UNIV_DEBUG */
/* Calculate the archive file space start lsn */
start_lsn
=
ut_dulint_subtract
(
log_sys
->
next_archived_lsn
,
end_offset
-
LOG_FILE_HDR_SIZE
+
trunc_files
*
(
group
->
file_size
-
LOG_FILE_HDR_SIZE
));
start_lsn
=
log_sys
->
next_archived_lsn
-
(
end_offset
-
LOG_FILE_HDR_SIZE
+
trunc_files
*
(
group
->
file_size
-
LOG_FILE_HDR_SIZE
));
end_lsn
=
start_lsn
;
for
(
i
=
0
;
i
<
trunc_files
;
i
++
)
{
end_lsn
=
ut_dulint_add
(
end_lsn
,
group
->
file_size
-
LOG_FILE_HDR_SIZE
);
end_lsn
+=
group
->
file_size
-
LOG_FILE_HDR_SIZE
;
/* Write a notice to the headers of archived log
files that the file write has been completed */
...
...
@@ -2617,9 +2586,9 @@ log_archive_do(
ulint
*
n_bytes
)
/* out: archive log buffer size, 0 if nothing to
archive */
{
ibool
calc_new_limit
;
dulint
start_lsn
;
dulint
limit_lsn
;
ibool
calc_new_limit
;
ib_ulonglong
start_lsn
;
ib_ulonglong
limit_lsn
;
calc_new_limit
=
TRUE
;
loop:
...
...
@@ -2648,19 +2617,18 @@ loop:
if
(
calc_new_limit
)
{
ut_a
(
log_sys
->
archive_buf_size
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
limit_lsn
=
ut_dulint_add
(
start_lsn
,
log_sys
->
archive_buf_size
);
limit_lsn
=
start_lsn
+
log_sys
->
archive_buf_size
;
*
n_bytes
=
log_sys
->
archive_buf_size
;
if
(
ut_dulint_cmp
(
limit_lsn
,
log_sys
->
lsn
)
>=
0
)
{
if
(
limit_lsn
>=
log_sys
->
lsn
)
{
limit_lsn
=
ut_
dulint
_align_down
(
limit_lsn
=
ut_
ulonglong
_align_down
(
log_sys
->
lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
}
}
if
(
ut_dulint_cmp
(
log_sys
->
archived_lsn
,
limit_lsn
)
>=
0
)
{
if
(
log_sys
->
archived_lsn
>=
limit_lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -2669,7 +2637,7 @@ loop:
return
(
TRUE
);
}
if
(
ut_dulint_cmp
(
log_sys
->
written_to_all_lsn
,
limit_lsn
)
<
0
)
{
if
(
log_sys
->
written_to_all_lsn
<
limit_lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -2704,11 +2672,8 @@ loop:
#ifdef UNIV_DEBUG
if
(
log_debug_writes
)
{
fprintf
(
stderr
,
"Archiving from lsn %lu %lu to lsn %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
log_sys
->
archived_lsn
),
(
ulong
)
ut_dulint_get_low
(
log_sys
->
archived_lsn
),
(
ulong
)
ut_dulint_get_high
(
limit_lsn
),
(
ulong
)
ut_dulint_get_low
(
limit_lsn
));
"Archiving from lsn %llu to lsn %llu
\n
"
,
log_sys
->
archived_lsn
,
limit_lsn
);
}
#endif
/* UNIV_DEBUG */
...
...
@@ -2738,8 +2703,8 @@ void
log_archive_all
(
void
)
/*=================*/
{
dulint
present_lsn
;
ulint
dummy
;
ib_ulonglong
present_lsn
;
ulint
dummy
;
mutex_enter
(
&
(
log_sys
->
mutex
));
...
...
@@ -2758,7 +2723,7 @@ log_archive_all(void)
for
(;;)
{
mutex_enter
(
&
(
log_sys
->
mutex
));
if
(
ut_dulint_cmp
(
present_lsn
,
log_sys
->
archived_lsn
)
<=
0
)
{
if
(
present_lsn
<=
log_sys
->
archived_lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -2965,8 +2930,8 @@ log_archive_archivelog(void)
log_sys
->
archiving_state
=
LOG_ARCH_ON
;
log_sys
->
archived_lsn
=
ut_
dulint
_align_down
(
log_sys
->
lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
=
ut_
ulonglong
_align_down
(
log_sys
->
lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
mutex_exit
(
&
(
log_sys
->
mutex
));
return
(
DB_SUCCESS
);
...
...
@@ -2999,7 +2964,7 @@ loop:
return
;
}
age
=
ut_dulint_minus
(
log
->
lsn
,
log
->
archived_lsn
)
;
age
=
log
->
lsn
-
log
->
archived_lsn
;
if
(
age
>
log
->
max_archived_lsn_age
)
{
...
...
@@ -3073,8 +3038,8 @@ void
logs_empty_and_mark_files_at_shutdown
(
void
)
/*=======================================*/
{
dulint
lsn
;
ulint
arch_log_no
;
ib_ulonglong
lsn
;
ulint
arch_log_no
;
if
(
srv_print_verbose_log
)
{
ut_print_timestamp
(
stderr
);
...
...
@@ -3151,19 +3116,16 @@ loop:
log_archive_all
();
#endif
/* UNIV_LOG_ARCHIVE */
log_make_checkpoint_at
(
ut_dulint_max
,
TRUE
);
log_make_checkpoint_at
(
IB_ULONGLONG_MAX
,
TRUE
);
mutex_enter
(
&
(
log_sys
->
mutex
));
lsn
=
log_sys
->
lsn
;
if
(
(
ut_dulint_cmp
(
lsn
,
log_sys
->
last_checkpoint_lsn
)
!=
0
)
if
(
lsn
!=
log_sys
->
last_checkpoint_lsn
#ifdef UNIV_LOG_ARCHIVE
||
(
srv_log_archive_on
&&
ut_dulint_cmp
(
lsn
,
ut_dulint_add
(
log_sys
->
archived_lsn
,
LOG_BLOCK_HDR_SIZE
))
!=
0
)
&&
lsn
!=
log_sys
->
archived_lsn
+
LOG_BLOCK_HDR_SIZE
)
#endif
/* UNIV_LOG_ARCHIVE */
)
{
...
...
@@ -3232,17 +3194,14 @@ loop:
/* Make some checks that the server really is quiet */
ut_a
(
srv_n_threads_active
[
SRV_MASTER
]
==
0
);
ut_a
(
buf_all_freed
());
ut_a
(
0
==
ut_dulint_cmp
(
lsn
,
log_sys
->
lsn
)
);
ut_a
(
lsn
==
log_sys
->
lsn
);
if
(
ut_dulint_cmp
(
lsn
,
srv_start_lsn
)
<
0
)
{
if
(
lsn
<
srv_start_lsn
)
{
fprintf
(
stderr
,
"InnoDB: Error: log sequence number"
" at shutdown %lu %lu
\n
"
"InnoDB: is lower than at startup %lu %lu!
\n
"
,
(
ulong
)
ut_dulint_get_high
(
lsn
),
(
ulong
)
ut_dulint_get_low
(
lsn
),
(
ulong
)
ut_dulint_get_high
(
srv_start_lsn
),
(
ulong
)
ut_dulint_get_low
(
srv_start_lsn
));
" at shutdown %llu
\n
"
"InnoDB: is lower than at startup %llu!
\n
"
,
lsn
,
srv_start_lsn
);
}
srv_shutdown_lsn
=
lsn
;
...
...
@@ -3256,7 +3215,7 @@ loop:
/* Make some checks that the server really is quiet */
ut_a
(
srv_n_threads_active
[
SRV_MASTER
]
==
0
);
ut_a
(
buf_all_freed
());
ut_a
(
0
==
ut_dulint_cmp
(
lsn
,
log_sys
->
lsn
)
);
ut_a
(
lsn
==
log_sys
->
lsn
);
}
/**********************************************************
...
...
@@ -3266,17 +3225,18 @@ consistent. */
ibool
log_check_log_recs
(
/*===============*/
byte
*
buf
,
/* in: pointer to the start of the log segment
in the log_sys->buf log buffer */
ulint
len
,
/* in: segment length in bytes */
dulint
buf_start_lsn
)
/* in: buffer start lsn */
byte
*
buf
,
/* in: pointer to the start of
the log segment in the
log_sys->buf log buffer */
ulint
len
,
/* in: segment length in bytes */
ib_ulonglong
buf_start_lsn
)
/* in: buffer start lsn */
{
dulint
contiguous_lsn
;
dulint
scanned_lsn
;
byte
*
start
;
byte
*
end
;
byte
*
buf1
;
byte
*
scan_buf
;
ib_ulonglong
contiguous_lsn
;
ib_ulonglong
scanned_lsn
;
byte
*
start
;
byte
*
end
;
byte
*
buf1
;
byte
*
scan_buf
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
...
...
@@ -3299,13 +3259,12 @@ log_check_log_recs(
(
buf_pool
->
curr_size
-
recv_n_pool_free_frames
)
*
UNIV_PAGE_SIZE
,
FALSE
,
scan_buf
,
end
-
start
,
ut_
dulint
_align_down
(
buf_start_lsn
,
OS_FILE_LOG_BLOCK_SIZE
),
ut_
ulonglong
_align_down
(
buf_start_lsn
,
OS_FILE_LOG_BLOCK_SIZE
),
&
contiguous_lsn
,
&
scanned_lsn
);
ut_a
(
ut_dulint_cmp
(
scanned_lsn
,
ut_dulint_add
(
buf_start_lsn
,
len
))
==
0
);
ut_a
(
ut_dulint_cmp
(
recv_sys
->
recovered_lsn
,
scanned_lsn
)
==
0
);
ut_a
(
scanned_lsn
==
buf_start_lsn
+
len
);
ut_a
(
recv_sys
->
recovered_lsn
==
scanned_lsn
);
mem_free
(
buf1
);
...
...
@@ -3318,9 +3277,9 @@ Peeks the current lsn. */
ibool
log_peek_lsn
(
/*=========*/
/* out: TRUE if success, FALSE if could not get the
log system mutex */
dulint
*
lsn
)
/* out: if returns TRUE, current lsn is here */
/* out: TRUE if success, FALSE if
could not get the
log system mutex */
ib_ulonglong
*
lsn
)
/* out: if returns TRUE, current lsn is here */
{
if
(
0
==
mutex_enter_nowait
(
&
(
log_sys
->
mutex
),
__FILE__
,
__LINE__
))
{
*
lsn
=
log_sys
->
lsn
;
...
...
@@ -3347,15 +3306,12 @@ log_print(
mutex_enter
(
&
(
log_sys
->
mutex
));
fprintf
(
file
,
"Log sequence number %lu %lu
\n
"
"Log flushed up to %lu %lu
\n
"
"Last checkpoint at %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
log_sys
->
lsn
),
(
ulong
)
ut_dulint_get_low
(
log_sys
->
lsn
),
(
ulong
)
ut_dulint_get_high
(
log_sys
->
flushed_to_disk_lsn
),
(
ulong
)
ut_dulint_get_low
(
log_sys
->
flushed_to_disk_lsn
),
(
ulong
)
ut_dulint_get_high
(
log_sys
->
last_checkpoint_lsn
),
(
ulong
)
ut_dulint_get_low
(
log_sys
->
last_checkpoint_lsn
));
"Log sequence number %llu
\n
"
"Log flushed up to %llu
\n
"
"Last checkpoint at %llu
\n
"
,
log_sys
->
lsn
,
log_sys
->
flushed_to_disk_lsn
,
log_sys
->
last_checkpoint_lsn
);
current_time
=
time
(
NULL
);
...
...
log/log0recv.c
View file @
7593a465
...
...
@@ -97,7 +97,7 @@ ulint recv_n_pool_free_frames = 256;
is bigger than the lsn we are able to scan up to, that is an indication that
the recovery failed and the database may be corrupt. */
dulint
recv_max_page_lsn
;
ib_ulonglong
recv_max_page_lsn
;
/************************************************************
Creates the recovery system. */
...
...
@@ -159,7 +159,7 @@ recv_sys_init(
OS_FILE_LOG_BLOCK_SIZE
);
recv_sys
->
found_corrupt_log
=
FALSE
;
recv_max_page_lsn
=
ut_dulint_zero
;
recv_max_page_lsn
=
0
;
mutex_exit
(
&
(
recv_sys
->
mutex
));
}
...
...
@@ -218,46 +218,45 @@ void
recv_truncate_group
(
/*================*/
log_group_t
*
group
,
/* in: log group */
dulint
recovered_lsn
,
/* in: recovery succeeded up to this
ib_ulonglong
recovered_lsn
,
/* in: recovery succeeded up to this
lsn */
dulint
limit_lsn
,
/* in: this was the limit for
ib_ulonglong
limit_lsn
,
/* in: this was the limit for
recovery */
dulint
checkpoint_lsn
,
/* in: recovery was started from this
ib_ulonglong
checkpoint_lsn
,
/* in: recovery was started from this
checkpoint */
dulint
archived_lsn
)
/* in: the log has been archived up to
ib_ulonglong
archived_lsn
)
/* in: the log has been archived up to
this lsn */
{
dulint
start_lsn
;
dulint
end_lsn
;
dulint
finish_lsn1
;
dulint
finish_lsn2
;
dulint
finish_lsn
;
ulint
len
;
ulint
i
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
ib_ulonglong
finish_lsn1
;
ib_ulonglong
finish_lsn2
;
ib_ulonglong
finish_lsn
;
ulint
len
;
ulint
i
;
if
(
ut_dulint_cmp
(
archived_lsn
,
ut_dulint_max
)
==
0
)
{
if
(
archived_lsn
==
IB_ULONGLONG_MAX
)
{
/* Checkpoint was taken in the NOARCHIVELOG mode */
archived_lsn
=
checkpoint_lsn
;
}
finish_lsn1
=
ut_dulint_add
(
ut_dulint_align_down
(
archived_lsn
,
OS_FILE_LOG_BLOCK_SIZE
),
log_group_get_capacity
(
group
));
finish_lsn1
=
ut_ulonglong_align_down
(
archived_lsn
,
OS_FILE_LOG_BLOCK_SIZE
)
+
log_group_get_capacity
(
group
);
finish_lsn2
=
ut_dulint_add
(
ut_dulint_align_up
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
),
recv_sys
->
last_log_buf_size
);
finish_lsn2
=
ut_ulonglong_align_up
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
)
+
recv_sys
->
last_log_buf_size
;
if
(
ut_dulint_cmp
(
limit_lsn
,
ut_dulint_max
)
!=
0
)
{
if
(
limit_lsn
!=
IB_ULONGLONG_MAX
)
{
/* We do not know how far we should erase log records: erase
as much as possible */
finish_lsn
=
finish_lsn1
;
}
else
{
/* It is enough to erase the length of the log buffer */
finish_lsn
=
ut_dulint_get_min
(
finish_lsn1
,
finish_lsn2
);
finish_lsn
=
finish_lsn1
<
finish_lsn2
?
finish_lsn1
:
finish_lsn2
;
}
ut_a
(
RECV_SCAN_SIZE
<=
log_sys
->
buf_size
);
...
...
@@ -268,36 +267,36 @@ recv_truncate_group(
*
(
log_sys
->
buf
+
i
)
=
'\0'
;
}
start_lsn
=
ut_
dulint
_align_down
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
start_lsn
=
ut_
ulonglong
_align_down
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
if
(
ut_dulint_cmp
(
start_lsn
,
recovered_lsn
)
!=
0
)
{
if
(
start_lsn
!=
recovered_lsn
)
{
/* Copy the last incomplete log block to the log buffer and
edit its data length: */
ut_memcpy
(
log_sys
->
buf
,
recv_sys
->
last_block
,
OS_FILE_LOG_BLOCK_SIZE
);
log_block_set_data_len
(
log_sys
->
buf
,
ut_dulint_minus
(
recovered_lsn
,
start_lsn
)
);
log_block_set_data_len
(
log_sys
->
buf
,
recovered_lsn
-
start_lsn
);
}
if
(
ut_dulint_cmp
(
start_lsn
,
finish_lsn
)
>=
0
)
{
if
(
start_lsn
>=
finish_lsn
)
{
return
;
}
for
(;;)
{
end_lsn
=
ut_dulint_add
(
start_lsn
,
RECV_SCAN_SIZE
)
;
end_lsn
=
start_lsn
+
RECV_SCAN_SIZE
;
if
(
ut_dulint_cmp
(
end_lsn
,
finish_lsn
)
>
0
)
{
if
(
end_lsn
>
finish_lsn
)
{
end_lsn
=
finish_lsn
;
}
len
=
ut_dulint_minus
(
end_lsn
,
start_lsn
)
;
len
=
end_lsn
-
start_lsn
;
log_group_write_buf
(
group
,
log_sys
->
buf
,
len
,
start_lsn
,
0
);
if
(
ut_dulint_cmp
(
end_lsn
,
finish_lsn
)
>=
0
)
{
if
(
end_lsn
>=
finish_lsn
)
{
return
;
}
...
...
@@ -323,38 +322,38 @@ recv_copy_group(
group */
log_group_t
*
group
,
/* in: copy to this log
group */
dulint
recovered_lsn
)
/* in: recovery succeeded up
ib_ulonglong
recovered_lsn
)
/* in: recovery succeeded up
to this lsn */
{
dulint
start_lsn
;
dulint
end_lsn
;
ulint
len
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
ulint
len
;
if
(
ut_dulint_cmp
(
group
->
scanned_lsn
,
recovered_lsn
)
>=
0
)
{
if
(
group
->
scanned_lsn
>=
recovered_lsn
)
{
return
;
}
ut_a
(
RECV_SCAN_SIZE
<=
log_sys
->
buf_size
);
start_lsn
=
ut_
dulint
_align_down
(
group
->
scanned_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
start_lsn
=
ut_
ulonglong
_align_down
(
group
->
scanned_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
for
(;;)
{
end_lsn
=
ut_dulint_add
(
start_lsn
,
RECV_SCAN_SIZE
)
;
end_lsn
=
start_lsn
+
RECV_SCAN_SIZE
;
if
(
ut_dulint_cmp
(
end_lsn
,
recovered_lsn
)
>
0
)
{
end_lsn
=
ut_
dulint_align_up
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
if
(
end_lsn
>
recovered_lsn
)
{
end_lsn
=
ut_
ulonglong_align_up
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
}
log_group_read_log_seg
(
LOG_RECOVER
,
log_sys
->
buf
,
up_to_date_group
,
start_lsn
,
end_lsn
);
len
=
ut_dulint_minus
(
end_lsn
,
start_lsn
)
;
len
=
end_lsn
-
start_lsn
;
log_group_write_buf
(
group
,
log_sys
->
buf
,
len
,
start_lsn
,
0
);
if
(
ut_dulint_cmp
(
end_lsn
,
recovered_lsn
)
>=
0
)
{
if
(
end_lsn
>=
recovered_lsn
)
{
return
;
}
...
...
@@ -376,10 +375,10 @@ recv_synchronize_groups(
log group */
{
log_group_t
*
group
;
dulint
start_lsn
;
dulint
end_lsn
;
dulint
recovered_lsn
;
dulint
limit_lsn
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
ib_ulonglong
recovered_lsn
;
ib_ulonglong
limit_lsn
;
recovered_lsn
=
recv_sys
->
recovered_lsn
;
limit_lsn
=
recv_sys
->
limit_lsn
;
...
...
@@ -387,11 +386,11 @@ recv_synchronize_groups(
/* Read the last recovered log block to the recovery system buffer:
the block is always incomplete */
start_lsn
=
ut_
dulint
_align_down
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
end_lsn
=
ut_
dulint
_align_up
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
start_lsn
=
ut_
ulonglong
_align_down
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
end_lsn
=
ut_
ulonglong
_align_up
(
recovered_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
ut_a
(
ut_dulint_cmp
(
start_lsn
,
end_lsn
)
!=
0
);
ut_a
(
start_lsn
!=
end_lsn
);
log_group_read_log_seg
(
LOG_RECOVER
,
recv_sys
->
last_block
,
up_to_date_group
,
start_lsn
,
end_lsn
);
...
...
@@ -472,14 +471,14 @@ recv_find_max_checkpoint(
LOG_CHECKPOINT_2 */
{
log_group_t
*
group
;
dulint
max_no
;
dulint
checkpoint_no
;
ib_ulonglong
max_no
;
ib_ulonglong
checkpoint_no
;
ulint
field
;
byte
*
buf
;
group
=
UT_LIST_GET_FIRST
(
log_sys
->
log_groups
);
max_no
=
ut_dulint_zero
;
max_no
=
0
;
*
max_group
=
NULL
;
*
max_field
=
0
;
...
...
@@ -512,11 +511,11 @@ recv_find_max_checkpoint(
group
->
state
=
LOG_GROUP_OK
;
group
->
lsn
=
mach_read_
from_8
(
group
->
lsn
=
mach_read_
ull
(
buf
+
LOG_CHECKPOINT_LSN
);
group
->
lsn_offset
=
mach_read_from_4
(
buf
+
LOG_CHECKPOINT_OFFSET
);
checkpoint_no
=
mach_read_
from_8
(
checkpoint_no
=
mach_read_
ull
(
buf
+
LOG_CHECKPOINT_NO
);
#ifdef UNIV_DEBUG
...
...
@@ -524,13 +523,12 @@ recv_find_max_checkpoint(
fprintf
(
stderr
,
"InnoDB: Checkpoint number %lu"
" found in group %lu
\n
"
,
(
ulong
)
ut_dulint_get_low
(
checkpoint_no
),
(
ulong
)
checkpoint_no
,
(
ulong
)
group
->
id
);
}
#endif
/* UNIV_DEBUG */
if
(
ut_dulint_cmp
(
checkpoint_no
,
max_no
)
>=
0
)
{
if
(
checkpoint_no
>=
max_no
)
{
*
max_group
=
group
;
*
max_field
=
field
;
max_no
=
checkpoint_no
;
...
...
@@ -568,32 +566,34 @@ Reads the checkpoint info needed in hot backup. */
ibool
recv_read_cp_info_for_backup
(
/*=========================*/
/* out: TRUE if success */
byte
*
hdr
,
/* in: buffer containing the log group header */
dulint
*
lsn
,
/* out: checkpoint lsn */
ulint
*
offset
,
/* out: checkpoint offset in the log group */
ulint
*
fsp_limit
,
/* out: fsp limit of space 0, 1000000000 if the
database is running with < version 3.23.50 of InnoDB */
dulint
*
cp_no
,
/* out: checkpoint number */
dulint
*
first_header_lsn
)
/* out: lsn of of the start of the first log file */
/* out: TRUE if success */
byte
*
hdr
,
/* in: buffer containing the log group
header */
ib_ulonglong
*
lsn
,
/* out: checkpoint lsn */
ulint
*
offset
,
/* out: checkpoint offset in the log group */
ulint
*
fsp_limit
,
/* out: fsp limit of space 0,
1000000000 if the database is running
with < version 3.23.50 of InnoDB */
ib_ulonglong
*
cp_no
,
/* out: checkpoint number */
ib_ulonglong
*
first_header_lsn
)
/* out: lsn of of the start of the
first log file */
{
ulint
max_cp
=
0
;
dulint
max_cp_no
=
ut_dulint_zero
;
byte
*
cp_buf
;
ulint
max_cp
=
0
;
ib_ulonglong
max_cp_no
=
0
;
byte
*
cp_buf
;
cp_buf
=
hdr
+
LOG_CHECKPOINT_1
;
if
(
recv_check_cp_is_consistent
(
cp_buf
))
{
max_cp_no
=
mach_read_
from_8
(
cp_buf
+
LOG_CHECKPOINT_NO
);
max_cp_no
=
mach_read_
ull
(
cp_buf
+
LOG_CHECKPOINT_NO
);
max_cp
=
LOG_CHECKPOINT_1
;
}
cp_buf
=
hdr
+
LOG_CHECKPOINT_2
;
if
(
recv_check_cp_is_consistent
(
cp_buf
))
{
if
(
ut_dulint_cmp
(
mach_read_from_8
(
cp_buf
+
LOG_CHECKPOINT_NO
),
max_cp_no
)
>
0
)
{
if
(
mach_read_ull
(
cp_buf
+
LOG_CHECKPOINT_NO
)
>
max_cp_no
)
{
max_cp
=
LOG_CHECKPOINT_2
;
}
}
...
...
@@ -604,7 +604,7 @@ recv_read_cp_info_for_backup(
cp_buf
=
hdr
+
max_cp
;
*
lsn
=
mach_read_
from_8
(
cp_buf
+
LOG_CHECKPOINT_LSN
);
*
lsn
=
mach_read_
ull
(
cp_buf
+
LOG_CHECKPOINT_LSN
);
*
offset
=
mach_read_from_4
(
cp_buf
+
LOG_CHECKPOINT_OFFSET
);
/* If the user is running a pre-3.23.50 version of InnoDB, its
...
...
@@ -624,9 +624,9 @@ recv_read_cp_info_for_backup(
/* fprintf(stderr, "fsp limit %lu MB\n", *fsp_limit); */
*
cp_no
=
mach_read_
from_8
(
cp_buf
+
LOG_CHECKPOINT_NO
);
*
cp_no
=
mach_read_
ull
(
cp_buf
+
LOG_CHECKPOINT_NO
);
*
first_header_lsn
=
mach_read_
from_8
(
hdr
+
LOG_FILE_START_LSN
);
*
first_header_lsn
=
mach_read_
ull
(
hdr
+
LOG_FILE_START_LSN
);
return
(
TRUE
);
}
...
...
@@ -676,7 +676,7 @@ recv_scan_log_seg_for_backup(
/*=========================*/
byte
*
buf
,
/* in: buffer containing log data */
ulint
buf_len
,
/* in: data length in that buffer */
dulint
*
scanned_lsn
,
/* in/out: lsn of buffer start,
ib_ulonglong
*
scanned_lsn
,
/* in/out: lsn of buffer start,
we return scanned lsn */
ulint
*
scanned_checkpoint_no
,
/* in/out: 4 lowest bytes of the
...
...
@@ -741,7 +741,7 @@ recv_scan_log_seg_for_backup(
*
scanned_checkpoint_no
=
log_block_get_checkpoint_no
(
log_block
);
*
scanned_lsn
=
ut_dulint_add
(
*
scanned_lsn
,
data_len
)
;
*
scanned_lsn
+=
data_len
;
*
n_bytes_scanned
+=
data_len
;
...
...
@@ -1035,13 +1035,13 @@ static
void
recv_add_to_hash_table
(
/*===================*/
byte
type
,
/* in: log record type */
ulint
space
,
/* in: space id */
ulint
page_no
,
/* in: page number */
byte
*
body
,
/* in: log record body */
byte
*
rec_end
,
/* in: log record end */
dulint
start_lsn
,
/* in: start lsn of the mtr */
dulint
end_lsn
)
/* in: end lsn of the mtr */
byte
type
,
/* in: log record type */
ulint
space
,
/* in: space id */
ulint
page_no
,
/* in: page number */
byte
*
body
,
/* in: log record body */
byte
*
rec_end
,
/* in: log record end */
ib_ulonglong
start_lsn
,
/* in: start lsn of the mtr */
ib_ulonglong
end_lsn
)
/* in: end lsn of the mtr */
{
recv_t
*
recv
;
ulint
len
;
...
...
@@ -1168,10 +1168,10 @@ recv_recover_page(
recv_addr_t
*
recv_addr
;
recv_t
*
recv
;
byte
*
buf
;
dulint
start_lsn
;
dulint
end_lsn
;
dulint
page_lsn
;
dulint
page_newest_lsn
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
ib_ulonglong
page_lsn
;
ib_ulonglong
page_newest_lsn
;
ibool
modification_to_page
;
ibool
success
;
mtr_t
mtr
;
...
...
@@ -1236,7 +1236,7 @@ recv_recover_page(
}
/* Read the newest modification lsn from the page */
page_lsn
=
mach_read_
from_8
(
page
+
FIL_PAGE_LSN
);
page_lsn
=
mach_read_
ull
(
page
+
FIL_PAGE_LSN
);
if
(
!
recover_backup
)
{
/* It may be that the page has been modified in the buffer
...
...
@@ -1244,7 +1244,7 @@ recv_recover_page(
page_newest_lsn
=
buf_block_get_newest_modification
(
block
);
if
(
!
ut_dulint_is_zero
(
page_newest_lsn
)
)
{
if
(
page_newest_lsn
)
{
page_lsn
=
page_newest_lsn
;
}
...
...
@@ -1252,11 +1252,11 @@ recv_recover_page(
/* In recovery from a backup we do not really use the buffer
pool */
page_newest_lsn
=
ut_dulint_zero
;
page_newest_lsn
=
0
;
}
modification_to_page
=
FALSE
;
start_lsn
=
end_lsn
=
ut_dulint_zero
;
start_lsn
=
end_lsn
=
0
;
recv
=
UT_LIST_GET_FIRST
(
recv_addr
->
rec_list
);
...
...
@@ -1277,13 +1277,12 @@ recv_recover_page(
if
(
recv
->
type
==
MLOG_INIT_FILE_PAGE
)
{
page_lsn
=
page_newest_lsn
;
mach_write_to_8
(
page
+
UNIV_PAGE_SIZE
-
FIL_PAGE_END_LSN_OLD_CHKSUM
,
ut_dulint_zero
);
mach_write_to_8
(
page
+
FIL_PAGE_LSN
,
ut_dulint_zero
);
mach_write_ull
(
page
+
UNIV_PAGE_SIZE
-
FIL_PAGE_END_LSN_OLD_CHKSUM
,
0
);
mach_write_ull
(
page
+
FIL_PAGE_LSN
,
0
);
}
if
(
ut_dulint_cmp
(
recv
->
start_lsn
,
page_lsn
)
>=
0
)
{
if
(
recv
->
start_lsn
>=
page_lsn
)
{
if
(
!
modification_to_page
)
{
...
...
@@ -1306,13 +1305,11 @@ recv_recover_page(
recv_parse_or_apply_log_rec_body
(
recv
->
type
,
buf
,
buf
+
recv
->
len
,
block
,
&
mtr
);
mach_write_to_8
(
page
+
UNIV_PAGE_SIZE
-
FIL_PAGE_END_LSN_OLD_CHKSUM
,
ut_dulint_add
(
recv
->
start_lsn
,
recv
->
len
));
mach_write_to_8
(
page
+
FIL_PAGE_LSN
,
ut_dulint_add
(
recv
->
start_lsn
,
recv
->
len
));
mach_write_ull
(
page
+
UNIV_PAGE_SIZE
-
FIL_PAGE_END_LSN_OLD_CHKSUM
,
recv
->
start_lsn
+
recv
->
len
);
mach_write_ull
(
page
+
FIL_PAGE_LSN
,
recv
->
start_lsn
+
recv
->
len
);
}
if
(
recv
->
len
>
RECV_DATA_BLOCK_SIZE
)
{
...
...
@@ -1324,7 +1321,7 @@ recv_recover_page(
mutex_enter
(
&
(
recv_sys
->
mutex
));
if
(
ut_dulint_cmp
(
recv_max_page_lsn
,
page_lsn
)
<
0
)
{
if
(
recv_max_page_lsn
<
page_lsn
)
{
recv_max_page_lsn
=
page_lsn
;
}
...
...
@@ -1522,7 +1519,7 @@ loop:
mutex_exit
(
&
(
log_sys
->
mutex
));
n_pages
=
buf_flush_batch
(
BUF_FLUSH_LIST
,
ULINT_MAX
,
ut_dulint_max
);
IB_ULONGLONG_MAX
);
ut_a
(
n_pages
!=
ULINT_UNDEFINED
);
buf_flush_wait_batch_end
(
BUF_FLUSH_LIST
);
...
...
@@ -1661,7 +1658,7 @@ recv_apply_log_recs_for_backup(void)
buf_flush_init_for_writing
(
block
->
frame
,
buf_block_get_page_zip
(
block
),
mach_read_
from_8
(
block
->
frame
+
FIL_PAGE_LSN
));
mach_read_
ull
(
block
->
frame
+
FIL_PAGE_LSN
));
if
(
zip_size
)
{
error
=
fil_io
(
OS_FILE_WRITE
,
TRUE
,
...
...
@@ -1767,17 +1764,17 @@ recv_parse_log_rec(
/***********************************************************
Calculates the new value for lsn when more data is added to the log. */
static
dulint
ib_ulonglong
recv_calc_lsn_on_data_add
(
/*======================*/
dulint
lsn
,
/* in: old lsn */
ulint
len
)
/* in: this many bytes of data is added, log block
headers not included */
ib_ulonglong
lsn
,
/* in: old lsn */
ib_ulonglong
len
)
/* in: this many bytes of data is
added, log block
headers not included */
{
ulint
frag_len
;
ulint
lsn_len
;
frag_len
=
(
ut_dulint_get_low
(
lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
)
frag_len
=
(
((
ulint
)
lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
)
-
LOG_BLOCK_HDR_SIZE
;
ut_ad
(
frag_len
<
OS_FILE_LOG_BLOCK_SIZE
-
LOG_BLOCK_HDR_SIZE
-
LOG_BLOCK_TRL_SIZE
);
...
...
@@ -1786,7 +1783,7 @@ recv_calc_lsn_on_data_add(
-
LOG_BLOCK_TRL_SIZE
))
*
(
LOG_BLOCK_HDR_SIZE
+
LOG_BLOCK_TRL_SIZE
);
return
(
ut_dulint_add
(
lsn
,
lsn_len
)
);
return
(
lsn
+
lsn_len
);
}
#ifdef UNIV_LOG_DEBUG
...
...
@@ -1827,12 +1824,11 @@ recv_report_corrupt_log(
fprintf
(
stderr
,
"InnoDB: ############### CORRUPT LOG RECORD FOUND
\n
"
"InnoDB: Log record type %lu, space id %lu, page number %lu
\n
"
"InnoDB: Log parsing proceeded successfully up to %l
u %
lu
\n
"
"InnoDB: Log parsing proceeded successfully up to %llu
\n
"
"InnoDB: Previous log record type %lu, is multi %lu
\n
"
"InnoDB: Recv offset %lu, prev %lu
\n
"
,
(
ulong
)
type
,
(
ulong
)
space
,
(
ulong
)
page_no
,
(
ulong
)
ut_dulint_get_high
(
recv_sys
->
recovered_lsn
),
(
ulong
)
ut_dulint_get_low
(
recv_sys
->
recovered_lsn
),
recv_sys
->
recovered_lsn
,
(
ulong
)
recv_previous_parsed_rec_type
,
(
ulong
)
recv_previous_parsed_rec_is_multi
,
(
ulong
)
(
ptr
-
recv_sys
->
buf
),
...
...
@@ -1882,23 +1878,23 @@ recv_parse_log_recs(
to the hash table; this is set to FALSE if just
debug checking is needed */
{
byte
*
ptr
;
byte
*
end_ptr
;
ulint
single_rec
;
ulint
len
;
ulint
total_len
;
dulint
new_recovered_lsn
;
dulint
old_lsn
;
byte
type
;
ulint
space
;
ulint
page_no
;
byte
*
body
;
ulint
n_recs
;
byte
*
ptr
;
byte
*
end_ptr
;
ulint
single_rec
;
ulint
len
;
ulint
total_len
;
ib_ulonglong
new_recovered_lsn
;
ib_ulonglong
old_lsn
;
byte
type
;
ulint
space
;
ulint
page_no
;
byte
*
body
;
ulint
n_recs
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
#endif
/* UNIV_SYNC_DEBUG */
ut_ad
(
!
ut_dulint_is_zero
(
recv_sys
->
parse_start_lsn
)
);
ut_ad
(
recv_sys
->
parse_start_lsn
!=
0
);
loop:
ptr
=
recv_sys
->
buf
+
recv_sys
->
recovered_offset
;
...
...
@@ -1934,8 +1930,7 @@ loop:
new_recovered_lsn
=
recv_calc_lsn_on_data_add
(
old_lsn
,
len
);
if
(
ut_dulint_cmp
(
new_recovered_lsn
,
recv_sys
->
scanned_lsn
)
>
0
)
{
if
(
new_recovered_lsn
>
recv_sys
->
scanned_lsn
)
{
/* The log record filled a log block, and we require
that also the next log block should have been scanned
in */
...
...
@@ -2065,8 +2060,7 @@ loop:
new_recovered_lsn
=
recv_calc_lsn_on_data_add
(
recv_sys
->
recovered_lsn
,
total_len
);
if
(
ut_dulint_cmp
(
new_recovered_lsn
,
recv_sys
->
scanned_lsn
)
>
0
)
{
if
(
new_recovered_lsn
>
recv_sys
->
scanned_lsn
)
{
/* The log record filled a log block, and we require
that also the next log block should have been scanned
in */
...
...
@@ -2122,19 +2116,19 @@ static
ibool
recv_sys_add_to_parsing_buf
(
/*========================*/
/* out: TRUE if more data added */
byte
*
log_block
,
/* in: log block */
dulint
scanned_lsn
)
/* in: lsn of how far we were able to find
data in this log block */
/* out: TRUE if more data added */
byte
*
log_block
,
/* in: log block */
ib_ulonglong
scanned_lsn
)
/* in: lsn of how far we were able
to find
data in this log block */
{
ulint
more_len
;
ulint
data_len
;
ulint
start_offset
;
ulint
end_offset
;
ut_ad
(
ut_dulint_cmp
(
scanned_lsn
,
recv_sys
->
scanned_lsn
)
>=
0
);
ut_ad
(
scanned_lsn
>=
recv_sys
->
scanned_lsn
);
if
(
ut_dulint_is_zero
(
recv_sys
->
parse_start_lsn
)
)
{
if
(
!
recv_sys
->
parse_start_lsn
)
{
/* Cannot start parsing yet because no start point for
it found */
...
...
@@ -2143,20 +2137,18 @@ recv_sys_add_to_parsing_buf(
data_len
=
log_block_get_data_len
(
log_block
);
if
(
ut_dulint_cmp
(
recv_sys
->
parse_start_lsn
,
scanned_lsn
)
>=
0
)
{
if
(
recv_sys
->
parse_start_lsn
>=
scanned_lsn
)
{
return
(
FALSE
);
}
else
if
(
ut_dulint_cmp
(
recv_sys
->
scanned_lsn
,
scanned_lsn
)
>=
0
)
{
}
else
if
(
recv_sys
->
scanned_lsn
>=
scanned_lsn
)
{
return
(
FALSE
);
}
else
if
(
ut_dulint_cmp
(
recv_sys
->
parse_start_lsn
,
recv_sys
->
scanned_lsn
)
>
0
)
{
more_len
=
ut_dulint_minus
(
scanned_lsn
,
recv_sys
->
parse_start_lsn
);
}
else
if
(
recv_sys
->
parse_start_lsn
>
recv_sys
->
scanned_lsn
)
{
more_len
=
(
ulint
)
(
scanned_lsn
-
recv_sys
->
parse_start_lsn
);
}
else
{
more_len
=
ut_dulint_minus
(
scanned_lsn
,
recv_sys
->
scanned_lsn
);
more_len
=
(
ulint
)
(
scanned_lsn
-
recv_sys
->
scanned_lsn
);
}
if
(
more_len
==
0
)
{
...
...
@@ -2214,34 +2206,39 @@ and hashes the log records if new data found. */
ibool
recv_scan_log_recs
(
/*===============*/
/* out: TRUE if limit_lsn has been reached, or
not able to scan any more in this log group */
ibool
apply_automatically
,
/* in: TRUE if we want this function to
apply log records automatically when the
hash table becomes full; in the hot backup tool
the tool does the applying, not this
function */
ulint
available_memory
,
/* in: we let the hash table of recs to grow
to this size, at the maximum */
ibool
store_to_hash
,
/* in: TRUE if the records should be stored
to the hash table; this is set to FALSE if just
debug checking is needed */
byte
*
buf
,
/* in: buffer containing a log segment or
garbage */
ulint
len
,
/* in: buffer length */
dulint
start_lsn
,
/* in: buffer start lsn */
dulint
*
contiguous_lsn
,
/* in/out: it is known that all log groups
contain contiguous log data up to this lsn */
dulint
*
group_scanned_lsn
)
/* out: scanning succeeded up to this lsn */
/* out: TRUE if limit_lsn has been
reached, or not able to scan any more
in this log group */
ibool
apply_automatically
,
/* in: TRUE if we want this
function to apply log records
automatically when the hash table
becomes full; in the hot backup tool
the tool does the applying, not this
function */
ulint
available_memory
,
/* in: we let the hash table of recs
to grow to this size, at the maximum */
ibool
store_to_hash
,
/* in: TRUE if the records should be
stored to the hash table; this is set
to FALSE if just debug checking is
needed */
byte
*
buf
,
/* in: buffer containing a log segment
or garbage */
ulint
len
,
/* in: buffer length */
ib_ulonglong
start_lsn
,
/* in: buffer start lsn */
ib_ulonglong
*
contiguous_lsn
,
/* in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
ib_ulonglong
*
group_scanned_lsn
)
/* out: scanning succeeded up to
this lsn */
{
byte
*
log_block
;
ulint
no
;
dulint
scanned_lsn
;
ibool
finished
;
ulint
data_len
;
ibool
more_data
;
ut_ad
(
ut_dulint_get_low
(
start_lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
byte
*
log_block
;
ulint
no
;
ib_ulonglong
scanned_lsn
;
ibool
finished
;
ulint
data_len
;
ibool
more_data
;
ut_ad
(
start_lsn
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
ut_ad
(
len
%
OS_FILE_LOG_BLOCK_SIZE
==
0
);
ut_ad
(
len
>
0
);
ut_a
(
apply_automatically
<=
TRUE
);
...
...
@@ -2270,13 +2267,11 @@ recv_scan_log_recs(
log_block
))
{
fprintf
(
stderr
,
"InnoDB: Log block no %lu at"
" lsn %l
u %
lu has
\n
"
" lsn %llu has
\n
"
"InnoDB: ok header, but checksum field"
" contains %lu, should be %lu
\n
"
,
(
ulong
)
no
,
(
ulong
)
ut_dulint_get_high
(
scanned_lsn
),
(
ulong
)
ut_dulint_get_low
(
scanned_lsn
),
scanned_lsn
,
(
ulong
)
log_block_get_checksum
(
log_block
),
(
ulong
)
log_block_calc_checksum
(
...
...
@@ -2298,7 +2293,7 @@ recv_scan_log_recs(
we know that log data is contiguous up to scanned_lsn
in all non-corrupt log groups. */
if
(
ut_dulint_cmp
(
scanned_lsn
,
*
contiguous_lsn
)
>
0
)
{
if
(
scanned_lsn
>
*
contiguous_lsn
)
{
*
contiguous_lsn
=
scanned_lsn
;
}
}
...
...
@@ -2306,8 +2301,7 @@ recv_scan_log_recs(
data_len
=
log_block_get_data_len
(
log_block
);
if
((
store_to_hash
||
(
data_len
==
OS_FILE_LOG_BLOCK_SIZE
))
&&
(
ut_dulint_cmp
(
ut_dulint_add
(
scanned_lsn
,
data_len
),
recv_sys
->
scanned_lsn
)
>
0
)
&&
scanned_lsn
+
data_len
>
recv_sys
->
scanned_lsn
&&
(
recv_sys
->
scanned_checkpoint_no
>
0
)
&&
(
log_block_get_checkpoint_no
(
log_block
)
<
recv_sys
->
scanned_checkpoint_no
)
...
...
@@ -2328,23 +2322,21 @@ recv_scan_log_recs(
break
;
}
if
(
ut_dulint_is_zero
(
recv_sys
->
parse_start_lsn
)
if
(
!
recv_sys
->
parse_start_lsn
&&
(
log_block_get_first_rec_group
(
log_block
)
>
0
))
{
/* We found a point from which to start the parsing
of log records */
recv_sys
->
parse_start_lsn
=
ut_dulint_add
(
scanned_lsn
,
log_block_get_first_rec_group
(
log_block
));
recv_sys
->
parse_start_lsn
=
scanned_lsn
+
log_block_get_first_rec_group
(
log_block
);
recv_sys
->
scanned_lsn
=
recv_sys
->
parse_start_lsn
;
recv_sys
->
recovered_lsn
=
recv_sys
->
parse_start_lsn
;
}
scanned_lsn
=
ut_dulint_add
(
scanned_lsn
,
data_len
)
;
scanned_lsn
+=
data_len
;
if
(
ut_dulint_cmp
(
scanned_lsn
,
recv_sys
->
scanned_lsn
)
>
0
)
{
if
(
scanned_lsn
>
recv_sys
->
scanned_lsn
)
{
/* We were able to find more log data: add it to the
parsing buffer if parse_start_lsn is already
...
...
@@ -2388,9 +2380,8 @@ recv_scan_log_recs(
fprintf
(
stderr
,
"InnoDB: Doing recovery: scanned up to"
" log sequence number %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
*
group_scanned_lsn
),
(
ulong
)
ut_dulint_get_low
(
*
group_scanned_lsn
));
" log sequence number %llu
\n
"
,
*
group_scanned_lsn
);
}
}
...
...
@@ -2429,21 +2420,23 @@ static
void
recv_group_scan_log_recs
(
/*=====================*/
log_group_t
*
group
,
/* in: log group */
dulint
*
contiguous_lsn
,
/* in/out: it is known that all log groups
contain contiguous log data up to this lsn */
dulint
*
group_scanned_lsn
)
/* out: scanning succeeded up to this lsn */
log_group_t
*
group
,
/* in: log group */
ib_ulonglong
*
contiguous_lsn
,
/* in/out: it is known that all log
groups contain contiguous log data up
to this lsn */
ib_ulonglong
*
group_scanned_lsn
)
/* out: scanning succeeded up to
this lsn */
{
ibool
finished
;
dulint
start_lsn
;
dulint
end_lsn
;
ibool
finished
;
ib_ulonglong
start_lsn
;
ib_ulonglong
end_lsn
;
finished
=
FALSE
;
start_lsn
=
*
contiguous_lsn
;
while
(
!
finished
)
{
end_lsn
=
ut_dulint_add
(
start_lsn
,
RECV_SCAN_SIZE
)
;
end_lsn
=
start_lsn
+
RECV_SCAN_SIZE
;
log_group_read_log_seg
(
LOG_RECOVER
,
log_sys
->
buf
,
group
,
start_lsn
,
end_lsn
);
...
...
@@ -2459,10 +2452,9 @@ recv_group_scan_log_recs(
if
(
log_debug_writes
)
{
fprintf
(
stderr
,
"InnoDB: Scanned group %lu up to"
" log sequence number %l
u %
lu
\n
"
,
" log sequence number %llu
\n
"
,
(
ulong
)
group
->
id
,
(
ulong
)
ut_dulint_get_high
(
*
group_scanned_lsn
),
(
ulong
)
ut_dulint_get_low
(
*
group_scanned_lsn
));
*
group_scanned_lsn
);
}
#endif
/* UNIV_DEBUG */
}
...
...
@@ -2476,29 +2468,31 @@ the recovery and free the resources used in it. */
ulint
recv_recovery_from_checkpoint_start
(
/*================================*/
/* out: error code or DB_SUCCESS */
ulint
type
,
/* in: LOG_CHECKPOINT or LOG_ARCHIVE */
dulint
limit_lsn
,
/* in: recover up to this lsn if possible */
dulint
min_flushed_lsn
,
/* in: min flushed lsn from data files */
dulint
max_flushed_lsn
)
/* in: max flushed lsn from data files */
/* out: error code or DB_SUCCESS */
ulint
type
,
/* in: LOG_CHECKPOINT or LOG_ARCHIVE */
ib_ulonglong
limit_lsn
,
/* in: recover up to this lsn
if possible */
ib_ulonglong
min_flushed_lsn
,
/* in: min flushed lsn from
data files */
ib_ulonglong
max_flushed_lsn
)
/* in: max flushed lsn from
data files */
{
log_group_t
*
group
;
log_group_t
*
max_cp_group
;
log_group_t
*
up_to_date_group
;
ulint
max_cp_field
;
dulint
checkpoint_lsn
;
dulint
checkpoint_no
;
dulint
old_scanned_lsn
;
dulint
group_scanned_lsn
;
dulint
contiguous_lsn
;
dulint
archived_lsn
;
ib_ulonglong
checkpoint_lsn
;
ib_ulonglong
checkpoint_no
;
ib_ulonglong
old_scanned_lsn
;
ib_ulonglong
group_scanned_lsn
;
ib_ulonglong
contiguous_lsn
;
ib_ulonglong
archived_lsn
;
ulint
capacity
;
byte
*
buf
;
byte
log_hdr_buf
[
LOG_FILE_HDR_SIZE
];
ulint
err
;
ut_ad
((
type
!=
LOG_CHECKPOINT
)
||
(
ut_dulint_cmp
(
limit_lsn
,
ut_dulint_max
)
==
0
));
ut_ad
(
type
!=
LOG_CHECKPOINT
||
limit_lsn
==
IB_ULONGLONG_MAX
);
if
(
type
==
LOG_CHECKPOINT
)
{
recv_sys_create
();
...
...
@@ -2535,9 +2529,9 @@ recv_recovery_from_checkpoint_start(
buf
=
log_sys
->
checkpoint_buf
;
checkpoint_lsn
=
mach_read_
from_8
(
buf
+
LOG_CHECKPOINT_LSN
);
checkpoint_no
=
mach_read_
from_8
(
buf
+
LOG_CHECKPOINT_NO
);
archived_lsn
=
mach_read_
from_8
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
);
checkpoint_lsn
=
mach_read_
ull
(
buf
+
LOG_CHECKPOINT_LSN
);
checkpoint_no
=
mach_read_
ull
(
buf
+
LOG_CHECKPOINT_NO
);
archived_lsn
=
mach_read_
ull
(
buf
+
LOG_CHECKPOINT_ARCHIVED_LSN
);
/* Read the first log file header to print a note if this is
a recovery from a restored InnoDB Hot Backup */
...
...
@@ -2599,11 +2593,10 @@ recv_recovery_from_checkpoint_start(
there is something wrong we will print a message to the
user about recovery: */
if
(
ut_dulint_cmp
(
checkpoint_lsn
,
max_flushed_lsn
)
!=
0
||
ut_dulint_cmp
(
checkpoint_lsn
,
min_flushed_lsn
)
!=
0
)
{
if
(
checkpoint_lsn
!=
max_flushed_lsn
||
checkpoint_lsn
!=
min_flushed_lsn
)
{
if
(
ut_dulint_cmp
(
checkpoint_lsn
,
max_flushed_lsn
)
<
0
)
{
if
(
checkpoint_lsn
<
max_flushed_lsn
)
{
fprintf
(
stderr
,
"InnoDB: #########################"
"#################################
\n
"
...
...
@@ -2617,24 +2610,15 @@ recv_recovery_from_checkpoint_start(
" ib_logfiles to start up"
" the database?
\n
"
"InnoDB: Log sequence number in"
" ib_logfiles is %l
u %
lu, log
\n
"
" ib_logfiles is %llu, log
\n
"
"InnoDB: sequence numbers stamped"
" to ibdata file headers are between
\n
"
"InnoDB: %l
u %lu and %lu %
lu.
\n
"
"InnoDB: %l
lu and %l
lu.
\n
"
"InnoDB: #########################"
"#################################
\n
"
,
(
ulong
)
ut_dulint_get_high
(
checkpoint_lsn
),
(
ulong
)
ut_dulint_get_low
(
checkpoint_lsn
),
(
ulong
)
ut_dulint_get_high
(
min_flushed_lsn
),
(
ulong
)
ut_dulint_get_low
(
min_flushed_lsn
),
(
ulong
)
ut_dulint_get_high
(
max_flushed_lsn
),
(
ulong
)
ut_dulint_get_low
(
max_flushed_lsn
));
checkpoint_lsn
,
min_flushed_lsn
,
max_flushed_lsn
);
}
recv_needed_recovery
=
TRUE
;
...
...
@@ -2673,17 +2657,16 @@ recv_recovery_from_checkpoint_start(
fprintf
(
stderr
,
" InnoDB: Starting log scan"
" based on checkpoint at
\n
"
"InnoDB: log sequence number %lu %lu.
\n
"
,
(
ulong
)
ut_dulint_get_high
(
checkpoint_lsn
),
(
ulong
)
ut_dulint_get_low
(
checkpoint_lsn
));
"InnoDB: log sequence number %llu.
\n
"
,
checkpoint_lsn
);
}
else
{
/* Init the doublewrite buffer memory structure */
trx_sys_doublewrite_init_or_restore_pages
(
FALSE
);
}
}
contiguous_lsn
=
ut_
dulint
_align_down
(
recv_sys
->
scanned_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
contiguous_lsn
=
ut_
ulonglong
_align_down
(
recv_sys
->
scanned_lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
if
(
type
==
LOG_ARCHIVE
)
{
/* Try to recover the remaining part from logs: first from
the logs of the archived group */
...
...
@@ -2691,11 +2674,8 @@ recv_recovery_from_checkpoint_start(
group
=
recv_sys
->
archive_group
;
capacity
=
log_group_get_capacity
(
group
);
if
((
ut_dulint_cmp
(
recv_sys
->
scanned_lsn
,
ut_dulint_add
(
checkpoint_lsn
,
capacity
))
>
0
)
||
(
ut_dulint_cmp
(
checkpoint_lsn
,
ut_dulint_add
(
recv_sys
->
scanned_lsn
,
capacity
))
>
0
))
{
if
(
recv_sys
->
scanned_lsn
>
checkpoint_lsn
+
capacity
||
checkpoint_lsn
>
recv_sys
->
scanned_lsn
+
capacity
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -2707,7 +2687,7 @@ recv_recovery_from_checkpoint_start(
recv_group_scan_log_recs
(
group
,
&
contiguous_lsn
,
&
group_scanned_lsn
);
if
(
ut_dulint_cmp
(
recv_sys
->
scanned_lsn
,
checkpoint_lsn
)
<
0
)
{
if
(
recv_sys
->
scanned_lsn
<
checkpoint_lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
...
...
@@ -2739,7 +2719,7 @@ recv_recovery_from_checkpoint_start(
&
group_scanned_lsn
);
group
->
scanned_lsn
=
group_scanned_lsn
;
if
(
ut_dulint_cmp
(
old_scanned_lsn
,
group_scanned_lsn
)
<
0
)
{
if
(
old_scanned_lsn
<
group_scanned_lsn
)
{
/* We found a more up-to-date group */
up_to_date_group
=
group
;
...
...
@@ -2754,39 +2734,35 @@ recv_recovery_from_checkpoint_start(
}
/* We currently have only one log group */
if
(
ut_dulint_cmp
(
group_scanned_lsn
,
checkpoint_lsn
)
<
0
)
{
if
(
group_scanned_lsn
<
checkpoint_lsn
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: ERROR: We were only able to scan the log"
" up to
\n
"
"InnoDB: %l
u %lu, but a checkpoint was at %lu %
lu.
\n
"
"InnoDB: %l
lu, but a checkpoint was at %l
lu.
\n
"
"InnoDB: It is possible that"
" the database is now corrupt!
\n
"
,
(
ulong
)
ut_dulint_get_high
(
group_scanned_lsn
),
(
ulong
)
ut_dulint_get_low
(
group_scanned_lsn
),
(
ulong
)
ut_dulint_get_high
(
checkpoint_lsn
),
(
ulong
)
ut_dulint_get_low
(
checkpoint_lsn
));
group_scanned_lsn
,
checkpoint_lsn
);
}
if
(
ut_dulint_cmp
(
group_scanned_lsn
,
recv_max_page_lsn
)
<
0
)
{
if
(
group_scanned_lsn
<
recv_max_page_lsn
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: ERROR: We were only able to scan the log"
" up to %l
u %
lu
\n
"
"InnoDB: but a database page a had an lsn %l
u %
lu."
" up to %llu
\n
"
"InnoDB: but a database page a had an lsn %llu."
" It is possible that the
\n
"
"InnoDB: database is now corrupt!
\n
"
,
(
ulong
)
ut_dulint_get_high
(
group_scanned_lsn
),
(
ulong
)
ut_dulint_get_low
(
group_scanned_lsn
),
(
ulong
)
ut_dulint_get_high
(
recv_max_page_lsn
),
(
ulong
)
ut_dulint_get_low
(
recv_max_page_lsn
));
group_scanned_lsn
,
recv_max_page_lsn
);
}
if
(
ut_dulint_cmp
(
recv_sys
->
recovered_lsn
,
checkpoint_lsn
)
<
0
)
{
if
(
recv_sys
->
recovered_lsn
<
checkpoint_lsn
)
{
mutex_exit
(
&
(
log_sys
->
mutex
));
if
(
ut_dulint_cmp
(
recv_sys
->
recovered_lsn
,
limit_lsn
)
>=
0
)
{
if
(
recv_sys
->
recovered_lsn
>=
limit_lsn
)
{
return
(
DB_SUCCESS
);
}
...
...
@@ -2800,7 +2776,7 @@ recv_recovery_from_checkpoint_start(
group; we also copy checkpoint info to groups */
log_sys
->
next_checkpoint_lsn
=
checkpoint_lsn
;
log_sys
->
next_checkpoint_no
=
ut_dulint_add
(
checkpoint_no
,
1
)
;
log_sys
->
next_checkpoint_no
=
checkpoint_no
+
1
;
#ifdef UNIV_LOG_ARCHIVE
log_sys
->
archived_lsn
=
archived_lsn
;
...
...
@@ -2809,19 +2785,14 @@ recv_recovery_from_checkpoint_start(
recv_synchronize_groups
(
up_to_date_group
);
if
(
!
recv_needed_recovery
)
{
if
(
ut_dulint_cmp
(
checkpoint_lsn
,
recv_sys
->
recovered_lsn
)
!=
0
)
{
if
(
checkpoint_lsn
!=
recv_sys
->
recovered_lsn
)
{
fprintf
(
stderr
,
"InnoDB: Warning: we did not need to do"
" crash recovery, but log scan
\n
"
"InnoDB: progressed past the checkpoint"
" lsn %lu %lu up to lsn %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
checkpoint_lsn
),
(
ulong
)
ut_dulint_get_low
(
checkpoint_lsn
),
(
ulong
)
ut_dulint_get_high
(
recv_sys
->
recovered_lsn
),
(
ulong
)
ut_dulint_get_low
(
recv_sys
->
recovered_lsn
));
" lsn %llu up to lsn %llu
\n
"
,
checkpoint_lsn
,
recv_sys
->
recovered_lsn
);
}
}
else
{
srv_start_lsn
=
recv_sys
->
recovered_lsn
;
...
...
@@ -2831,18 +2802,17 @@ recv_recovery_from_checkpoint_start(
ut_memcpy
(
log_sys
->
buf
,
recv_sys
->
last_block
,
OS_FILE_LOG_BLOCK_SIZE
);
log_sys
->
buf_free
=
ut_dulint_get_low
(
log_sys
->
lsn
)
%
OS_FILE_LOG_BLOCK_SIZE
;
log_sys
->
buf_free
=
(
ulint
)
log_sys
->
lsn
%
OS_FILE_LOG_BLOCK_SIZE
;
log_sys
->
buf_next_to_write
=
log_sys
->
buf_free
;
log_sys
->
written_to_some_lsn
=
log_sys
->
lsn
;
log_sys
->
written_to_all_lsn
=
log_sys
->
lsn
;
log_sys
->
last_checkpoint_lsn
=
checkpoint_lsn
;
log_sys
->
next_checkpoint_no
=
ut_dulint_add
(
checkpoint_no
,
1
)
;
log_sys
->
next_checkpoint_no
=
checkpoint_no
+
1
;
#ifdef UNIV_LOG_ARCHIVE
if
(
ut_dulint_cmp
(
archived_lsn
,
ut_dulint_max
)
==
0
)
{
if
(
archived_lsn
==
IB_ULONGLONG_MAX
)
{
log_sys
->
archiving_state
=
LOG_ARCH_OFF
;
}
...
...
@@ -2931,22 +2901,25 @@ Resets the logs. The contents of log files will be lost! */
void
recv_reset_logs
(
/*============*/
dulint
lsn
,
/* in: reset to this lsn rounded up to
be divisible by OS_FILE_LOG_BLOCK_SIZE,
after which we add LOG_BLOCK_HDR_SIZE */
ib_ulonglong
lsn
,
/* in: reset to this lsn
rounded up to be divisible by
OS_FILE_LOG_BLOCK_SIZE, after
which we add
LOG_BLOCK_HDR_SIZE */
#ifdef UNIV_LOG_ARCHIVE
ulint
arch_log_no
,
/* in: next archived log file number */
ulint
arch_log_no
,
/* in: next archived log file number */
#endif
/* UNIV_LOG_ARCHIVE */
ibool
new_logs_created
)
/* in: TRUE if resetting logs is done
at the log creation; FALSE if it is done
after archive recovery */
ibool
new_logs_created
)
/* in: TRUE if resetting logs
is done at the log creation;
FALSE if it is done after
archive recovery */
{
log_group_t
*
group
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
(
log_sys
->
mutex
)));
#endif
/* UNIV_SYNC_DEBUG */
log_sys
->
lsn
=
ut_
dulint
_align_up
(
lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
log_sys
->
lsn
=
ut_
ulonglong
_align_up
(
lsn
,
OS_FILE_LOG_BLOCK_SIZE
);
group
=
UT_LIST_GET_FIRST
(
log_sys
->
log_groups
);
...
...
@@ -2970,8 +2943,8 @@ recv_reset_logs(
log_sys
->
written_to_some_lsn
=
log_sys
->
lsn
;
log_sys
->
written_to_all_lsn
=
log_sys
->
lsn
;
log_sys
->
next_checkpoint_no
=
ut_dulint_zero
;
log_sys
->
last_checkpoint_lsn
=
ut_dulint_zero
;
log_sys
->
next_checkpoint_no
=
0
;
log_sys
->
last_checkpoint_lsn
=
0
;
#ifdef UNIV_LOG_ARCHIVE
log_sys
->
archived_lsn
=
log_sys
->
lsn
;
...
...
@@ -2981,14 +2954,14 @@ recv_reset_logs(
log_block_set_first_rec_group
(
log_sys
->
buf
,
LOG_BLOCK_HDR_SIZE
);
log_sys
->
buf_free
=
LOG_BLOCK_HDR_SIZE
;
log_sys
->
lsn
=
ut_dulint_add
(
log_sys
->
lsn
,
LOG_BLOCK_HDR_SIZE
)
;
log_sys
->
lsn
+=
LOG_BLOCK_HDR_SIZE
;
mutex_exit
(
&
(
log_sys
->
mutex
));
/* Reset the checkpoint fields in logs */
log_make_checkpoint_at
(
ut_dulint_max
,
TRUE
);
log_make_checkpoint_at
(
ut_dulint_max
,
TRUE
);
log_make_checkpoint_at
(
IB_ULONGLONG_MAX
,
TRUE
);
log_make_checkpoint_at
(
IB_ULONGLONG_MAX
,
TRUE
);
mutex_enter
(
&
(
log_sys
->
mutex
));
}
...
...
@@ -3003,7 +2976,7 @@ recv_reset_log_files_for_backup(
const
char
*
log_dir
,
/* in: log file directory path */
ulint
n_log_files
,
/* in: number of log files */
ulint
log_file_size
,
/* in: log file size */
dulint
lsn
)
/* in: new start lsn, must be
ib_ulonglong
lsn
)
/* in: new start lsn, must be
divisible by OS_FILE_LOG_BLOCK_SIZE */
{
os_file_t
log_file
;
...
...
@@ -3096,19 +3069,19 @@ log_group_recover_from_archive_file(
consistent archive files */
log_group_t
*
group
)
/* in: log group */
{
os_file_t
file_handle
;
dulint
start_lsn
;
dulint
file_end_lsn
;
dulint
dummy_lsn
;
dulint
scanned_lsn
;
ulint
len
;
ibool
ret
;
byte
*
buf
;
ulint
read_offset
;
ulint
file_size
;
ulint
file_size_high
;
int
input_char
;
char
name
[
10000
];
os_file_t
file_handle
;
ib_ulonglong
start_lsn
;
ib_ulonglong
file_end_lsn
;
ib_ulonglong
dummy_lsn
;
ib_ulonglong
scanned_lsn
;
ulint
len
;
ibool
ret
;
byte
*
buf
;
ulint
read_offset
;
ulint
file_size
;
ulint
file_size_high
;
int
input_char
;
char
name
[
10000
];
ut_a
(
0
);
...
...
@@ -3196,12 +3169,12 @@ ask_again:
return
(
TRUE
);
}
start_lsn
=
mach_read_
from_8
(
buf
+
LOG_FILE_START_LSN
);
file_end_lsn
=
mach_read_
from_8
(
buf
+
LOG_FILE_END_LSN
);
start_lsn
=
mach_read_
ull
(
buf
+
LOG_FILE_START_LSN
);
file_end_lsn
=
mach_read_
ull
(
buf
+
LOG_FILE_END_LSN
);
if
(
ut_dulint_is_zero
(
recv_sys
->
scanned_lsn
)
)
{
if
(
!
recv_sys
->
scanned_lsn
)
{
if
(
ut_dulint_cmp
(
recv_sys
->
parse_start_lsn
,
start_lsn
)
<
0
)
{
if
(
recv_sys
->
parse_start_lsn
<
start_lsn
)
{
fprintf
(
stderr
,
"InnoDB: Archive log file %s"
" starts from too big a lsn
\n
"
,
...
...
@@ -3212,7 +3185,7 @@ ask_again:
recv_sys
->
scanned_lsn
=
start_lsn
;
}
if
(
ut_dulint_cmp
(
recv_sys
->
scanned_lsn
,
start_lsn
)
!=
0
)
{
if
(
recv_sys
->
scanned_lsn
!=
start_lsn
)
{
fprintf
(
stderr
,
"InnoDB: Archive log file %s starts from"
...
...
@@ -3240,9 +3213,8 @@ ask_again:
if
(
log_debug_writes
)
{
fprintf
(
stderr
,
"InnoDB: Archive read starting at"
" lsn %lu %lu, len %lu from file %s
\n
"
,
(
ulong
)
ut_dulint_get_high
(
start_lsn
),
(
ulong
)
ut_dulint_get_low
(
start_lsn
),
" lsn %llu, len %lu from file %s
\n
"
,
start_lsn
,
(
ulong
)
len
,
name
);
}
#endif
/* UNIV_DEBUG */
...
...
@@ -3256,7 +3228,7 @@ ask_again:
*
UNIV_PAGE_SIZE
,
TRUE
,
buf
,
len
,
start_lsn
,
&
dummy_lsn
,
&
scanned_lsn
);
if
(
ut_dulint_cmp
(
scanned_lsn
,
file_end_lsn
)
==
0
)
{
if
(
scanned_lsn
==
file_end_lsn
)
{
return
(
FALSE
);
}
...
...
@@ -3270,9 +3242,9 @@ ask_again:
}
read_offset
+=
len
;
start_lsn
=
ut_dulint_add
(
start_lsn
,
len
)
;
start_lsn
+=
len
;
ut_ad
(
ut_dulint_cmp
(
start_lsn
,
scanned_lsn
)
==
0
);
ut_ad
(
start_lsn
==
scanned_lsn
);
}
return
(
FALSE
);
...
...
@@ -3284,14 +3256,16 @@ Recovers from archived log files, and also from log files, if they exist. */
ulint
recv_recovery_from_archive_start
(
/*=============================*/
/* out: error code or DB_SUCCESS */
dulint
min_flushed_lsn
,
/* in: min flushed lsn field from the
data files */
dulint
limit_lsn
,
/* in: recover up to this lsn if possible */
ulint
first_log_no
)
/* in: number of the first archived log file
to use in the recovery; the file will be
searched from INNOBASE_LOG_ARCH_DIR specified
in server config file */
/* out: error code or DB_SUCCESS */
ib_ulonglong
min_flushed_lsn
,
/* in: min flushed lsn field from the
data files */
ib_ulonglong
limit_lsn
,
/* in: recover up to this lsn if
possible */
ulint
first_log_no
)
/* in: number of the first archived
log file to use in the recovery; the
file will be searched from
INNOBASE_LOG_ARCH_DIR specified in
server config file */
{
log_group_t
*
group
;
ulint
group_id
;
...
...
@@ -3333,7 +3307,7 @@ recv_recovery_from_archive_start(
recv_sys
->
parse_start_lsn
=
min_flushed_lsn
;
recv_sys
->
scanned_lsn
=
ut_dulint_zero
;
recv_sys
->
scanned_lsn
=
0
;
recv_sys
->
scanned_checkpoint_no
=
0
;
recv_sys
->
recovered_lsn
=
recv_sys
->
parse_start_lsn
;
...
...
@@ -3359,9 +3333,9 @@ recv_recovery_from_archive_start(
group
->
archived_file_no
++
;
}
if
(
ut_dulint_cmp
(
recv_sys
->
recovered_lsn
,
limit_lsn
)
<
0
)
{
if
(
recv_sys
->
recovered_lsn
<
limit_lsn
)
{
if
(
ut_dulint_is_zero
(
recv_sys
->
scanned_lsn
)
)
{
if
(
!
recv_sys
->
scanned_lsn
)
{
recv_sys
->
scanned_lsn
=
recv_sys
->
parse_start_lsn
;
}
...
...
@@ -3370,8 +3344,8 @@ recv_recovery_from_archive_start(
err
=
recv_recovery_from_checkpoint_start
(
LOG_ARCHIVE
,
limit_lsn
,
ut_dulint_max
,
ut_dulint_max
);
IB_ULONGLONG_MAX
,
IB_ULONGLONG_MAX
);
if
(
err
!=
DB_SUCCESS
)
{
return
(
err
);
...
...
@@ -3380,7 +3354,7 @@ recv_recovery_from_archive_start(
mutex_enter
(
&
(
log_sys
->
mutex
));
}
if
(
ut_dulint_cmp
(
limit_lsn
,
ut_dulint_max
)
!=
0
)
{
if
(
limit_lsn
!=
IB_ULONGLONG_MAX
)
{
recv_apply_hashed_log_recs
(
FALSE
);
...
...
row/row0mysql.c
View file @
7593a465
...
...
@@ -2512,7 +2512,7 @@ row_import_tablespace_for_mysql(
{
dict_table_t
*
table
;
ibool
success
;
dulint
current_lsn
;
ib_ulonglong
current_lsn
;
ulint
err
=
DB_SUCCESS
;
ut_ad
(
trx
->
mysql_thread_id
==
os_thread_get_curr_id
());
...
...
srv/srv0srv.c
View file @
7593a465
...
...
@@ -170,9 +170,9 @@ ulint srv_lock_table_size = ULINT_MAX;
ulint
srv_n_file_io_threads
=
ULINT_MAX
;
#ifdef UNIV_LOG_ARCHIVE
ibool
srv_log_archive_on
=
FALSE
;
ibool
srv_archive_recovery
=
0
;
dulint
srv_archive_recovery_limit_lsn
;
ibool
srv_log_archive_on
=
FALSE
;
ibool
srv_archive_recovery
=
0
;
ib_ulonglong
srv_archive_recovery_limit_lsn
;
#endif
/* UNIV_LOG_ARCHIVE */
ulint
srv_lock_wait_timeout
=
1024
*
1024
*
1024
;
...
...
@@ -2016,9 +2016,9 @@ srv_error_monitor_thread(
os_thread_create */
{
/* number of successive fatal timeouts observed */
ulint
fatal_cnt
=
0
;
dulint
old_lsn
;
dulint
new_lsn
;
ulint
fatal_cnt
=
0
;
ib_ulonglong
old_lsn
;
ib_ulonglong
new_lsn
;
old_lsn
=
srv_start_lsn
;
...
...
@@ -2034,18 +2034,15 @@ loop:
new_lsn
=
log_get_lsn
();
if
(
ut_dulint_cmp
(
new_lsn
,
old_lsn
)
<
0
)
{
if
(
new_lsn
<
old_lsn
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Error: old log sequence number %l
u %
lu"
" InnoDB: Error: old log sequence number %llu"
" was greater
\n
"
"InnoDB: than the new log sequence number %l
u %
lu!
\n
"
"InnoDB: than the new log sequence number %llu!
\n
"
"InnoDB: Please submit a bug report"
" to http://bugs.mysql.com
\n
"
,
(
ulong
)
ut_dulint_get_high
(
old_lsn
),
(
ulong
)
ut_dulint_get_low
(
old_lsn
),
(
ulong
)
ut_dulint_get_high
(
new_lsn
),
(
ulong
)
ut_dulint_get_low
(
new_lsn
));
old_lsn
,
new_lsn
);
}
old_lsn
=
new_lsn
;
...
...
@@ -2265,7 +2262,7 @@ loop:
buffer pool under the limit wished by the user */
n_pages_flushed
=
buf_flush_batch
(
BUF_FLUSH_LIST
,
100
,
ut_dulint_max
);
IB_ULONGLONG_MAX
);
/* If we had to do the flush, it may have taken
even more than 1 second, and also, there may be more
...
...
@@ -2302,7 +2299,7 @@ loop:
if
(
n_pend_ios
<
3
&&
(
n_ios
-
n_ios_very_old
<
200
))
{
srv_main_thread_op_info
=
"flushing buffer pool pages"
;
buf_flush_batch
(
BUF_FLUSH_LIST
,
100
,
ut_dulint_max
);
buf_flush_batch
(
BUF_FLUSH_LIST
,
100
,
IB_ULONGLONG_MAX
);
srv_main_thread_op_info
=
"flushing log"
;
log_buffer_flush_to_disk
();
...
...
@@ -2353,14 +2350,14 @@ loop:
the time it requires to flush 100 pages */
n_pages_flushed
=
buf_flush_batch
(
BUF_FLUSH_LIST
,
100
,
ut_dulint_max
);
IB_ULONGLONG_MAX
);
}
else
{
/* Otherwise, we only flush a small number of pages so that
we do not unnecessarily use much disk i/o capacity from
other work */
n_pages_flushed
=
buf_flush_batch
(
BUF_FLUSH_LIST
,
10
,
ut_dulint_max
);
IB_ULONGLONG_MAX
);
}
srv_main_thread_op_info
=
"making checkpoint"
;
...
...
@@ -2463,7 +2460,7 @@ flush_loop:
if
(
srv_fast_shutdown
<
2
)
{
n_pages_flushed
=
buf_flush_batch
(
BUF_FLUSH_LIST
,
100
,
ut_dulint_max
);
IB_ULONGLONG_MAX
);
}
else
{
/* In the fastest shutdown we do not flush the buffer pool
to data files: we set n_pages_flushed to 0 artificially. */
...
...
srv/srv0start.c
View file @
7593a465
...
...
@@ -57,9 +57,9 @@ Created 2/16/1996 Heikki Tuuri
#include "que0que.h"
/* Log sequence number immediately after startup */
dulint
srv_start_lsn
;
ib_ulonglong
srv_start_lsn
;
/* Log sequence number at shutdown */
dulint
srv_shutdown_lsn
;
ib_ulonglong
srv_shutdown_lsn
;
#ifdef HAVE_DARWIN_THREADS
# include <sys/utsname.h>
...
...
@@ -689,18 +689,21 @@ static
ulint
open_or_create_data_files
(
/*======================*/
/* out: DB_SUCCESS or error code */
ibool
*
create_new_db
,
/* out: TRUE if new database should be
created */
/* out: DB_SUCCESS or error code */
ibool
*
create_new_db
,
/* out: TRUE if new database should be
created */
#ifdef UNIV_LOG_ARCHIVE
ulint
*
min_arch_log_no
,
/* out: min of archived log numbers in data
files */
ulint
*
max_arch_log_no
,
/* out: */
ulint
*
min_arch_log_no
,
/* out: min of archived log
numbers in data files */
ulint
*
max_arch_log_no
,
/* out: max of archived log
numbers in data files */
#endif
/* UNIV_LOG_ARCHIVE */
dulint
*
min_flushed_lsn
,
/* out: min of flushed lsn values in data
files */
dulint
*
max_flushed_lsn
,
/* out: */
ulint
*
sum_of_new_sizes
)
/* out: sum of sizes of the new files added */
ib_ulonglong
*
min_flushed_lsn
,
/* out: min of flushed lsn
values in data files */
ib_ulonglong
*
max_flushed_lsn
,
/* out: max of flushed lsn
values in data files */
ulint
*
sum_of_new_sizes
)
/* out: sum of sizes of the
new files added */
{
ibool
ret
;
ulint
i
;
...
...
@@ -963,23 +966,24 @@ innobase_start_or_create_for_mysql(void)
/* out: DB_SUCCESS or error code */
{
buf_pool_t
*
ret
;
ibool
create_new_db
;
ibool
log_file_created
;
ibool
log_created
=
FALSE
;
ibool
log_opened
=
FALSE
;
dulint
min_flushed_lsn
;
dulint
max_flushed_lsn
;
ibool
create_new_db
;
ibool
log_file_created
;
ibool
log_created
=
FALSE
;
ibool
log_opened
=
FALSE
;
ib_ulonglong
min_flushed_lsn
;
ib_ulonglong
max_flushed_lsn
;
#ifdef UNIV_LOG_ARCHIVE
ulint
min_arch_log_no
;
ulint
max_arch_log_no
;
ulint
min_arch_log_no
;
ulint
max_arch_log_no
;
#endif
/* UNIV_LOG_ARCHIVE */
ulint
sum_of_new_sizes
;
ulint
sum_of_data_file_sizes
;
ulint
tablespace_size_in_header
;
ulint
err
;
ulint
i
;
ibool
srv_file_per_table_original_value
=
srv_file_per_table
;
mtr_t
mtr
;
ulint
sum_of_new_sizes
;
ulint
sum_of_data_file_sizes
;
ulint
tablespace_size_in_header
;
ulint
err
;
ulint
i
;
ibool
srv_file_per_table_original_value
=
srv_file_per_table
;
mtr_t
mtr
;
#ifdef HAVE_DARWIN_THREADS
# ifdef F_FULLFSYNC
/* This executable has been compiled on Mac OS X 10.3 or later.
...
...
@@ -1366,7 +1370,7 @@ innobase_start_or_create_for_mysql(void)
&&
!
srv_archive_recovery
#endif
/* UNIV_LOG_ARCHIVE */
)
{
if
(
ut_dulint_cmp
(
max_flushed_lsn
,
min_flushed_lsn
)
!=
0
if
(
max_flushed_lsn
!=
min_flushed_lsn
#ifdef UNIV_LOG_ARCHIVE
||
max_arch_log_no
!=
min_arch_log_no
#endif
/* UNIV_LOG_ARCHIVE */
...
...
@@ -1381,8 +1385,7 @@ innobase_start_or_create_for_mysql(void)
return
(
DB_ERROR
);
}
if
(
ut_dulint_cmp
(
max_flushed_lsn
,
ut_dulint_create
(
0
,
1000
))
<
0
)
{
if
(
max_flushed_lsn
<
(
ib_ulonglong
)
1000
)
{
fprintf
(
stderr
,
"InnoDB: Cannot initialize created"
" log files because
\n
"
...
...
@@ -1450,7 +1453,7 @@ innobase_start_or_create_for_mysql(void)
been shut down normally: this is the normal startup path */
err
=
recv_recovery_from_checkpoint_start
(
LOG_CHECKPOINT
,
ut_dulint_max
,
IB_ULONGLONG_MAX
,
min_flushed_lsn
,
max_flushed_lsn
);
if
(
err
!=
DB_SUCCESS
)
{
...
...
@@ -1676,9 +1679,8 @@ innobase_start_or_create_for_mysql(void)
if
(
srv_print_verbose_log
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Started; log sequence number %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
srv_start_lsn
),
(
ulong
)
ut_dulint_get_low
(
srv_start_lsn
));
" InnoDB: Started; log sequence number %llu
\n
"
,
srv_start_lsn
);
}
if
(
srv_force_recovery
>
0
)
{
...
...
@@ -1938,9 +1940,8 @@ innobase_shutdown_for_mysql(void)
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Shutdown completed;"
" log sequence number %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
srv_shutdown_lsn
),
(
ulong
)
ut_dulint_get_low
(
srv_shutdown_lsn
));
" log sequence number %llu
\n
"
,
srv_shutdown_lsn
);
}
return
((
int
)
DB_SUCCESS
);
...
...
trx/trx0sys.c
View file @
7593a465
...
...
@@ -149,7 +149,7 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void)
mtr_commit
(
&
mtr
);
/* Flush the modified pages to disk and make a checkpoint */
log_make_checkpoint_at
(
ut_dulint_max
,
TRUE
);
log_make_checkpoint_at
(
IB_ULONGLONG_MAX
,
TRUE
);
trx_sys_multiple_tablespace_format
=
TRUE
;
}
...
...
@@ -322,7 +322,7 @@ start_again:
mtr_commit
(
&
mtr
);
/* Flush the modified pages to disk and make a checkpoint */
log_make_checkpoint_at
(
ut_dulint_max
,
TRUE
);
log_make_checkpoint_at
(
IB_ULONGLONG_MAX
,
TRUE
);
fprintf
(
stderr
,
"InnoDB: Doublewrite buffer created
\n
"
);
...
...
trx/trx0trx.c
View file @
7593a465
...
...
@@ -743,7 +743,7 @@ trx_commit_off_kernel(
trx_t
*
trx
)
/* in: transaction */
{
page_t
*
update_hdr_page
;
dulint
lsn
;
ib_ulonglong
lsn
;
trx_rseg_t
*
rseg
;
trx_undo_t
*
undo
;
ibool
must_flush_log
=
FALSE
;
...
...
@@ -1621,7 +1621,7 @@ trx_commit_complete_for_mysql(
/* out: 0 or error number */
trx_t
*
trx
)
/* in: trx handle */
{
dulint
lsn
=
trx
->
commit_lsn
;
ib_ulonglong
lsn
=
trx
->
commit_lsn
;
ut_a
(
trx
);
...
...
@@ -1799,7 +1799,7 @@ trx_prepare_off_kernel(
page_t
*
update_hdr_page
;
trx_rseg_t
*
rseg
;
ibool
must_flush_log
=
FALSE
;
dulint
lsn
;
ib_ulonglong
lsn
;
mtr_t
mtr
;
#ifdef UNIV_SYNC_DEBUG
...
...
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