Commit 7593a465 authored by marko's avatar marko

branches/zip: Introduce the unsigned 64-bit data type ib_ulonglong

for log sequence numbers, to replace dulint.
parent f8da258f
...@@ -294,7 +294,7 @@ buf_page_is_corrupted( ...@@ -294,7 +294,7 @@ buf_page_is_corrupted(
ulint checksum_field; ulint checksum_field;
ulint old_checksum_field; ulint old_checksum_field;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
dulint current_lsn; ib_ulonglong current_lsn;
#endif #endif
if (UNIV_LIKELY(!zip_size) if (UNIV_LIKELY(!zip_size)
&& memcmp(read_buf + FIL_PAGE_LSN + 4, && memcmp(read_buf + FIL_PAGE_LSN + 4,
...@@ -309,16 +309,14 @@ buf_page_is_corrupted( ...@@ -309,16 +309,14 @@ buf_page_is_corrupted(
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
if (recv_lsn_checks_on && log_peek_lsn(&current_lsn)) { if (recv_lsn_checks_on && log_peek_lsn(&current_lsn)) {
if (ut_dulint_cmp(current_lsn, if (current_lsn < mach_read_ull(read_buf + FIL_PAGE_LSN)) {
mach_read_from_8(read_buf + FIL_PAGE_LSN))
< 0) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: page %lu log sequence number" " InnoDB: Error: page %lu log sequence number"
" %lu %lu\n" " %llu\n"
"InnoDB: is in the future! Current system " "InnoDB: is in the future! Current system "
"log sequence number %lu %lu.\n" "log sequence number %llu.\n"
"InnoDB: Your database may be corrupt or " "InnoDB: Your database may be corrupt or "
"you may have copied the InnoDB\n" "you may have copied the InnoDB\n"
"InnoDB: tablespace but not the InnoDB " "InnoDB: tablespace but not the InnoDB "
...@@ -328,14 +326,8 @@ buf_page_is_corrupted( ...@@ -328,14 +326,8 @@ buf_page_is_corrupted(
"InnoDB: for more information.\n", "InnoDB: for more information.\n",
(ulong) mach_read_from_4(read_buf (ulong) mach_read_from_4(read_buf
+ FIL_PAGE_OFFSET), + FIL_PAGE_OFFSET),
(ulong) ut_dulint_get_high( mach_read_ull(read_buf + FIL_PAGE_LSN),
mach_read_from_8(read_buf current_lsn);
+ 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));
} }
} }
#endif #endif
...@@ -608,7 +600,7 @@ buf_block_init( ...@@ -608,7 +600,7 @@ buf_block_init(
block->buf_fix_count = 0; block->buf_fix_count = 0;
block->io_fix = 0; block->io_fix = 0;
block->modify_clock = ut_dulint_zero; block->modify_clock = 0;
#ifdef UNIV_DEBUG_FILE_ACCESSES #ifdef UNIV_DEBUG_FILE_ACCESSES
block->file_page_was_freed = FALSE; block->file_page_was_freed = FALSE;
...@@ -1005,8 +997,7 @@ buf_pool_shrink( ...@@ -1005,8 +997,7 @@ buf_pool_shrink(
/* Avoid busy-waiting. */ /* Avoid busy-waiting. */
os_thread_sleep(100000); os_thread_sleep(100000);
} else if (dirty } else if (dirty
&& buf_flush_batch(BUF_FLUSH_LRU, dirty, && buf_flush_batch(BUF_FLUSH_LRU, dirty, 0)
ut_dulint_zero)
== ULINT_UNDEFINED) { == ULINT_UNDEFINED) {
buf_flush_wait_batch_end(BUF_FLUSH_LRU); buf_flush_wait_batch_end(BUF_FLUSH_LRU);
...@@ -1558,7 +1549,7 @@ buf_page_optimistic_get_func( ...@@ -1558,7 +1549,7 @@ buf_page_optimistic_get_func(
/* out: TRUE if success */ /* out: TRUE if success */
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_block_t* block, /* in: guessed buffer block */ 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 */ ..._GUESS_ON_CLOCK */
const char* file, /* in: file name */ const char* file, /* in: file name */
ulint line, /* in: line where called */ ulint line, /* in: line where called */
...@@ -1622,7 +1613,7 @@ buf_page_optimistic_get_func( ...@@ -1622,7 +1613,7 @@ buf_page_optimistic_get_func(
return(FALSE); 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 #ifdef UNIV_SYNC_DEBUG
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -1791,8 +1782,8 @@ buf_page_init_for_backup_restore( ...@@ -1791,8 +1782,8 @@ buf_page_init_for_backup_restore(
block->freed_page_clock = 0; block->freed_page_clock = 0;
block->newest_modification = ut_dulint_zero; block->newest_modification = 0;
block->oldest_modification = ut_dulint_zero; block->oldest_modification = 0;
block->accessed = FALSE; block->accessed = FALSE;
block->buf_fix_count = 0; block->buf_fix_count = 0;
...@@ -1864,8 +1855,8 @@ buf_page_init( ...@@ -1864,8 +1855,8 @@ buf_page_init(
block->freed_page_clock = 0; block->freed_page_clock = 0;
block->newest_modification = ut_dulint_zero; block->newest_modification = 0;
block->oldest_modification = ut_dulint_zero; block->oldest_modification = 0;
block->accessed = FALSE; block->accessed = FALSE;
block->buf_fix_count = 0; block->buf_fix_count = 0;
...@@ -2438,8 +2429,7 @@ buf_validate(void) ...@@ -2438,8 +2429,7 @@ buf_validate(void)
n_lru++; n_lru++;
if (ut_dulint_cmp(block->oldest_modification, if (block->oldest_modification > 0) {
ut_dulint_zero) > 0) {
n_flush++; n_flush++;
} }
......
...@@ -58,9 +58,8 @@ buf_flush_insert_into_flush_list( ...@@ -58,9 +58,8 @@ buf_flush_insert_into_flush_list(
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL) ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
|| (ut_dulint_cmp((UT_LIST_GET_FIRST(buf_pool->flush_list)) || (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification
->oldest_modification, <= block->oldest_modification));
block->oldest_modification) <= 0));
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block); UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
...@@ -89,8 +88,7 @@ buf_flush_insert_sorted_into_flush_list( ...@@ -89,8 +88,7 @@ buf_flush_insert_sorted_into_flush_list(
prev_b = NULL; prev_b = NULL;
b = UT_LIST_GET_FIRST(buf_pool->flush_list); b = UT_LIST_GET_FIRST(buf_pool->flush_list);
while (b && (ut_dulint_cmp(b->oldest_modification, while (b && b->oldest_modification > block->oldest_modification) {
block->oldest_modification) > 0)) {
prev_b = b; prev_b = b;
b = UT_LIST_GET_NEXT(flush_list, b); b = UT_LIST_GET_NEXT(flush_list, b);
} }
...@@ -133,14 +131,9 @@ buf_flush_ready_for_replace( ...@@ -133,14 +131,9 @@ buf_flush_ready_for_replace(
return(FALSE); return(FALSE);
} }
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0) return(block->oldest_modification == 0
|| (block->buf_fix_count != 0) && block->buf_fix_count == 0
|| (block->io_fix != 0)) { && block->io_fix == 0);
return(FALSE);
}
return(TRUE);
} }
/************************************************************************ /************************************************************************
...@@ -160,8 +153,7 @@ buf_flush_ready_for_flush( ...@@ -160,8 +153,7 @@ buf_flush_ready_for_flush(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0) if (block->oldest_modification != 0 && block->io_fix == 0) {
&& (block->io_fix == 0)) {
if (flush_type != BUF_FLUSH_LRU) { if (flush_type != BUF_FLUSH_LRU) {
return(TRUE); return(TRUE);
...@@ -193,7 +185,7 @@ buf_flush_write_complete( ...@@ -193,7 +185,7 @@ buf_flush_write_complete(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); 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); UT_LIST_REMOVE(flush_list, buf_pool->flush_list, block);
...@@ -511,7 +503,8 @@ buf_flush_init_for_writing( ...@@ -511,7 +503,8 @@ buf_flush_init_for_writing(
/*=======================*/ /*=======================*/
byte* page, /* in/out: page */ byte* page, /* in/out: page */
void* page_zip_, /* in/out: compressed page, or NULL */ void* page_zip_, /* in/out: compressed page, or NULL */
dulint newest_lsn) /* in: newest modification lsn to the page */ ib_ulonglong newest_lsn) /* in: newest modification lsn
to the page */
{ {
if (page_zip_) { if (page_zip_) {
page_zip_des_t* page_zip = page_zip_; page_zip_des_t* page_zip = page_zip_;
...@@ -531,7 +524,7 @@ buf_flush_init_for_writing( ...@@ -531,7 +524,7 @@ buf_flush_init_for_writing(
/* fall through */ /* fall through */
case FIL_PAGE_TYPE_ZBLOB: case FIL_PAGE_TYPE_ZBLOB:
case FIL_PAGE_INDEX: case FIL_PAGE_INDEX:
mach_write_to_8(page_zip->data mach_write_ull(page_zip->data
+ FIL_PAGE_LSN, newest_lsn); + FIL_PAGE_LSN, newest_lsn);
memset(page_zip->data + FIL_PAGE_FILE_FLUSH_LSN, 0, 8); memset(page_zip->data + FIL_PAGE_FILE_FLUSH_LSN, 0, 8);
mach_write_to_4(page_zip->data mach_write_to_4(page_zip->data
...@@ -547,9 +540,9 @@ buf_flush_init_for_writing( ...@@ -547,9 +540,9 @@ buf_flush_init_for_writing(
} }
/* Write the newest modification lsn to the page header and trailer */ /* 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, mach_write_ull(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
newest_lsn); newest_lsn);
/* Store the new formula checksum */ /* Store the new formula checksum */
...@@ -589,7 +582,7 @@ buf_flush_write_block_low( ...@@ -589,7 +582,7 @@ buf_flush_write_block_low(
ut_a(ibuf_count_get(buf_block_get_space(block), ut_a(ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0); buf_block_get_page_no(block)) == 0);
#endif #endif
ut_ad(!ut_dulint_is_zero(block->newest_modification)); ut_ad(block->newest_modification != 0);
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (!univ_log_debug_warned) { if (!univ_log_debug_warned) {
...@@ -876,19 +869,22 @@ the calling thread is not allowed to own any latches on pages! */ ...@@ -876,19 +869,22 @@ the calling thread is not allowed to own any latches on pages! */
ulint ulint
buf_flush_batch( buf_flush_batch(
/*============*/ /*============*/
/* out: number of blocks for which the write /* out: number of blocks for which the
request was queued; ULINT_UNDEFINED if there write request was queued;
was a flush of the same type already running */ ULINT_UNDEFINED if there was a flush
ulint flush_type, /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST; if of the same type already running */
BUF_FLUSH_LIST, then the caller must not own ulint flush_type, /* in: BUF_FLUSH_LRU or
any latches on pages */ BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
ulint min_n, /* in: wished minimum mumber of blocks flushed then the caller must not own any
(it is not guaranteed that the actual number latches on pages */
is that big, though) */ ulint min_n, /* in: wished minimum mumber of blocks
dulint lsn_limit) /* in the case BUF_FLUSH_LIST all blocks whose flushed (it is not guaranteed that the
oldest_modification is smaller than this actual number is that big, though) */
should be flushed (if their number does not ib_ulonglong lsn_limit) /* in the case BUF_FLUSH_LIST all
exceed min_n), otherwise ignored */ 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; buf_block_t* block;
ulint page_count = 0; ulint page_count = 0;
...@@ -934,8 +930,7 @@ buf_flush_batch( ...@@ -934,8 +930,7 @@ buf_flush_batch(
block = UT_LIST_GET_LAST(buf_pool->flush_list); block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (!block if (!block
|| (ut_dulint_cmp(block->oldest_modification, || block->oldest_modification >= lsn_limit) {
lsn_limit) >= 0)) {
/* We have flushed enough */ /* We have flushed enough */
break; break;
...@@ -1109,8 +1104,7 @@ buf_flush_free_margin(void) ...@@ -1109,8 +1104,7 @@ buf_flush_free_margin(void)
n_to_flush = buf_flush_LRU_recommendation(); n_to_flush = buf_flush_LRU_recommendation();
if (n_to_flush > 0) { if (n_to_flush > 0) {
n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush, n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush, 0);
ut_dulint_zero);
if (n_flushed == ULINT_UNDEFINED) { if (n_flushed == ULINT_UNDEFINED) {
/* There was an LRU type flush batch already running; /* There was an LRU type flush batch already running;
let us wait for it to end */ let us wait for it to end */
...@@ -1130,7 +1124,7 @@ buf_flush_validate_low(void) ...@@ -1130,7 +1124,7 @@ buf_flush_validate_low(void)
/* out: TRUE if ok */ /* out: TRUE if ok */
{ {
buf_block_t* block; buf_block_t* block;
dulint om; ib_ulonglong om;
UT_LIST_VALIDATE(flush_list, buf_block_t, buf_pool->flush_list); UT_LIST_VALIDATE(flush_list, buf_block_t, buf_pool->flush_list);
...@@ -1139,13 +1133,12 @@ buf_flush_validate_low(void) ...@@ -1139,13 +1133,12 @@ buf_flush_validate_low(void)
while (block != NULL) { while (block != NULL) {
om = block->oldest_modification; om = block->oldest_modification;
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); 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); block = UT_LIST_GET_NEXT(flush_list, block);
if (block) { if (block) {
ut_a(ut_dulint_cmp(om, block->oldest_modification) ut_a(om >= block->oldest_modification);
>= 0);
} }
} }
......
...@@ -129,12 +129,11 @@ buf_LRU_invalidate_tablespace( ...@@ -129,12 +129,11 @@ buf_LRU_invalidate_tablespace(
goto scan_again; goto scan_again;
} }
if (0 != ut_dulint_cmp(block->oldest_modification, if (block->oldest_modification != 0) {
ut_dulint_zero)) {
/* Remove from the flush list of modified /* Remove from the flush list of modified
blocks */ blocks */
block->oldest_modification = ut_dulint_zero; block->oldest_modification = 0;
UT_LIST_REMOVE(flush_list, UT_LIST_REMOVE(flush_list,
buf_pool->flush_list, block); buf_pool->flush_list, block);
...@@ -913,7 +912,7 @@ buf_LRU_block_remove_hashed_page( ...@@ -913,7 +912,7 @@ buf_LRU_block_remove_hashed_page(
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_a(block->io_fix == 0); ut_a(block->io_fix == 0);
ut_a(block->buf_fix_count == 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); buf_LRU_remove_block(block);
...@@ -1091,7 +1090,7 @@ buf_LRU_print(void) ...@@ -1091,7 +1090,7 @@ buf_LRU_print(void)
fprintf(stderr, "io_fix %lu ", (ulong) block->io_fix); fprintf(stderr, "io_fix %lu ", (ulong) block->io_fix);
} }
if (!ut_dulint_is_zero(block->oldest_modification)) { if (block->oldest_modification) {
fputs("modif. ", stderr); fputs("modif. ", stderr);
} }
......
...@@ -1639,9 +1639,9 @@ static ...@@ -1639,9 +1639,9 @@ static
ulint ulint
fil_write_lsn_and_arch_no_to_file( fil_write_lsn_and_arch_no_to_file(
/*==============================*/ /*==============================*/
ulint sum_of_sizes, /* in: combined size of previous files in ulint sum_of_sizes, /* in: combined size of previous files
space, in database pages */ in space, in database pages */
dulint lsn, /* in: lsn to write */ ib_ulonglong lsn, /* in: lsn to write */
ulint arch_log_no /* in: archived log number to write */ ulint arch_log_no /* in: archived log number to write */
__attribute__((unused))) __attribute__((unused)))
{ {
...@@ -1653,7 +1653,7 @@ fil_write_lsn_and_arch_no_to_file( ...@@ -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); 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); fil_write(TRUE, 0, 0, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL);
...@@ -1668,8 +1668,9 @@ ulint ...@@ -1668,8 +1668,9 @@ ulint
fil_write_flushed_lsn_to_data_files( fil_write_flushed_lsn_to_data_files(
/*================================*/ /*================================*/
/* out: DB_SUCCESS or error number */ /* out: DB_SUCCESS or error number */
dulint lsn, /* in: lsn to write */ ib_ulonglong lsn, /* in: lsn to write */
ulint arch_log_no) /* in: latest archived log file number */ ulint arch_log_no) /* in: latest archived log
file number */
{ {
fil_space_t* space; fil_space_t* space;
fil_node_t* node; fil_node_t* node;
...@@ -1724,18 +1725,19 @@ void ...@@ -1724,18 +1725,19 @@ void
fil_read_flushed_lsn_and_arch_log_no( fil_read_flushed_lsn_and_arch_log_no(
/*=================================*/ /*=================================*/
os_file_t data_file, /* in: open data file */ os_file_t data_file, /* in: open data file */
ibool one_read_already, /* in: TRUE if min and max parameters ibool one_read_already, /* in: TRUE if min and max
below already contain sensible data */ parameters below already
contain sensible data */
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no, /* in/out: */ ulint* min_arch_log_no, /* in/out: */
ulint* max_arch_log_no, /* in/out: */ ulint* max_arch_log_no, /* in/out: */
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
dulint* min_flushed_lsn, /* in/out: */ ib_ulonglong* min_flushed_lsn, /* in/out: */
dulint* max_flushed_lsn) /* in/out: */ ib_ulonglong* max_flushed_lsn) /* in/out: */
{ {
byte* buf; byte* buf;
byte* buf2; byte* buf2;
dulint flushed_lsn; ib_ulonglong flushed_lsn;
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE); buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for a possible read from a raw device */ /* Align the memory for a possible read from a raw device */
...@@ -1743,7 +1745,7 @@ fil_read_flushed_lsn_and_arch_log_no( ...@@ -1743,7 +1745,7 @@ fil_read_flushed_lsn_and_arch_log_no(
os_file_read(data_file, buf, 0, 0, UNIV_PAGE_SIZE); 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); ut_free(buf2);
...@@ -1757,10 +1759,10 @@ fil_read_flushed_lsn_and_arch_log_no( ...@@ -1757,10 +1759,10 @@ fil_read_flushed_lsn_and_arch_log_no(
return; return;
} }
if (ut_dulint_cmp(*min_flushed_lsn, flushed_lsn) > 0) { if (*min_flushed_lsn > flushed_lsn) {
*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; *max_flushed_lsn = flushed_lsn;
} }
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
...@@ -2654,7 +2656,7 @@ fil_create_new_single_table_tablespace( ...@@ -2654,7 +2656,7 @@ fil_create_new_single_table_tablespace(
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, *space_id); mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, *space_id);
if (!zip_size) { 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); ret = os_file_write(path, file, page, 0, 0, UNIV_PAGE_SIZE);
} else { } else {
page_zip_des_t page_zip; page_zip_des_t page_zip;
...@@ -2662,7 +2664,7 @@ fil_create_new_single_table_tablespace( ...@@ -2662,7 +2664,7 @@ fil_create_new_single_table_tablespace(
page_zip.data = page + UNIV_PAGE_SIZE; page_zip.data = page + UNIV_PAGE_SIZE;
page_zip.state = page_zip.n_blobs page_zip.state = page_zip.n_blobs
= page_zip.m_start = page_zip.m_end = 0; = 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); ret = os_file_write(path, file, page_zip.data, 0, 0, zip_size);
} }
...@@ -2734,7 +2736,7 @@ fil_reset_too_high_lsns( ...@@ -2734,7 +2736,7 @@ fil_reset_too_high_lsns(
/* out: TRUE if success */ /* out: TRUE if success */
const char* name, /* in: table name in the const char* name, /* in: table name in the
databasename/tablename format */ 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 to FIL_PAGE_FILE_FLUSH_LSN in the
first page is too high */ first page is too high */
{ {
...@@ -2742,7 +2744,7 @@ fil_reset_too_high_lsns( ...@@ -2742,7 +2744,7 @@ fil_reset_too_high_lsns(
char* filepath; char* filepath;
byte* page; byte* page;
byte* buf2; byte* buf2;
dulint flush_lsn; ib_ulonglong flush_lsn;
ulint space_id; ulint space_id;
ib_longlong file_size; ib_longlong file_size;
ib_longlong offset; ib_longlong offset;
...@@ -2783,9 +2785,9 @@ fil_reset_too_high_lsns( ...@@ -2783,9 +2785,9 @@ fil_reset_too_high_lsns(
/* We have to read the file flush lsn from the header of the file */ /* 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 */ /* Ok */
success = TRUE; success = TRUE;
...@@ -2799,14 +2801,11 @@ fil_reset_too_high_lsns( ...@@ -2799,14 +2801,11 @@ fil_reset_too_high_lsns(
fprintf(stderr, fprintf(stderr,
" InnoDB: Flush lsn in the tablespace file %lu" " InnoDB: Flush lsn in the tablespace file %lu"
" to be imported\n" " to be imported\n"
"InnoDB: is %lu %lu, which exceeds current" "InnoDB: is %llu, which exceeds current"
" system lsn %lu %lu.\n" " system lsn %llu.\n"
"InnoDB: We reset the lsn's in the file ", "InnoDB: We reset the lsn's in the file ",
(ulong) space_id, (ulong) space_id,
(ulong) ut_dulint_get_high(flush_lsn), flush_lsn, current_lsn);
(ulong) ut_dulint_get_low(flush_lsn),
(ulong) ut_dulint_get_high(current_lsn),
(ulong) ut_dulint_get_low(current_lsn));
ut_print_filename(stderr, filepath); ut_print_filename(stderr, filepath);
fputs(".\n", stderr); fputs(".\n", stderr);
...@@ -2828,8 +2827,7 @@ fil_reset_too_high_lsns( ...@@ -2828,8 +2827,7 @@ fil_reset_too_high_lsns(
goto func_exit; goto func_exit;
} }
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN), if (mach_read_ull(page + FIL_PAGE_LSN) > current_lsn) {
current_lsn) > 0) {
/* We have to reset the lsn */ /* We have to reset the lsn */
if (zip_size) { if (zip_size) {
...@@ -2868,7 +2866,7 @@ fil_reset_too_high_lsns( ...@@ -2868,7 +2866,7 @@ fil_reset_too_high_lsns(
goto func_exit; 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, success = os_file_write(filepath, file, page, 0, 0,
zip_size ? zip_size : UNIV_PAGE_SIZE); zip_size ? zip_size : UNIV_PAGE_SIZE);
......
...@@ -477,7 +477,7 @@ struct btr_pcur_struct{ ...@@ -477,7 +477,7 @@ struct btr_pcur_struct{
old_rec record */ old_rec record */
buf_block_t* block_when_stored;/* buffer block when the position was buf_block_t* block_when_stored;/* buffer block when the position was
stored */ 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 buffer block when the cursor position
was stored */ was stored */
ulint pos_state; /* see TODO note below! ulint pos_state; /* see TODO note below!
......
...@@ -103,13 +103,13 @@ buf_pool_get_curr_size(void); ...@@ -103,13 +103,13 @@ buf_pool_get_curr_size(void);
/* out: size in bytes */ /* out: size in bytes */
/************************************************************************ /************************************************************************
Gets the smallest oldest_modification lsn for any page in the pool. Returns 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 UNIV_INLINE
dulint ib_ulonglong
buf_pool_get_oldest_modification(void); buf_pool_get_oldest_modification(void);
/*==================================*/ /*==================================*/
/* out: oldest modification in pool, /* out: oldest modification in pool,
ut_dulint_zero if none */ zero if none */
/************************************************************************ /************************************************************************
Allocates a buffer block. */ Allocates a buffer block. */
UNIV_INLINE UNIV_INLINE
...@@ -173,7 +173,7 @@ buf_page_optimistic_get_func( ...@@ -173,7 +173,7 @@ buf_page_optimistic_get_func(
/* out: TRUE if success */ /* out: TRUE if success */
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */ ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH */
buf_block_t* block, /* in: guessed block */ 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 */ ..._GUESS_ON_CLOCK */
const char* file, /* in: file name */ const char* file, /* in: file name */
ulint line, /* in: line where called */ ulint line, /* in: line where called */
...@@ -364,7 +364,7 @@ buf_page_peek_if_search_hashed( ...@@ -364,7 +364,7 @@ buf_page_peek_if_search_hashed(
Gets the youngest modification log sequence number for a frame. Gets the youngest modification log sequence number for a frame.
Returns zero if not file page or no modification occurred yet. */ Returns zero if not file page or no modification occurred yet. */
UNIV_INLINE UNIV_INLINE
dulint ib_ulonglong
buf_block_get_newest_modification( buf_block_get_newest_modification(
/*==============================*/ /*==============================*/
/* out: newest modification to page */ /* out: newest modification to page */
...@@ -382,7 +382,7 @@ buf_block_modify_clock_inc( ...@@ -382,7 +382,7 @@ buf_block_modify_clock_inc(
Returns the value of the modify clock. The caller must have an s-lock Returns the value of the modify clock. The caller must have an s-lock
or x-lock on the block. */ or x-lock on the block. */
UNIV_INLINE UNIV_INLINE
dulint ib_ulonglong
buf_block_get_modify_clock( buf_block_get_modify_clock(
/*=======================*/ /*=======================*/
/* out: value */ /* out: value */
...@@ -755,11 +755,11 @@ struct buf_block_struct{ ...@@ -755,11 +755,11 @@ struct buf_block_struct{
UT_LIST_NODE_T(buf_block_t) flush_list; UT_LIST_NODE_T(buf_block_t) flush_list;
/* node of the modified, not yet /* node of the modified, not yet
flushed blocks list */ flushed blocks list */
dulint newest_modification; ib_ulonglong newest_modification;
/* log sequence number of the youngest /* log sequence number of the youngest
modification to this block, zero if modification to this block, zero if
not modified */ not modified */
dulint oldest_modification; ib_ulonglong oldest_modification;
/* log sequence number of the START of /* log sequence number of the START of
the log entry written of the oldest the log entry written of the oldest
modification to this block which has modification to this block which has
...@@ -812,7 +812,7 @@ struct buf_block_struct{ ...@@ -812,7 +812,7 @@ struct buf_block_struct{
protected by block->mutex */ protected by block->mutex */
/* 4. Optimistic search field */ /* 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 time a pointer to a record on the
page may become obsolete; this is page may become obsolete; this is
used in the optimistic cursor used in the optimistic cursor
......
...@@ -39,23 +39,23 @@ buf_pool_get_curr_size(void) ...@@ -39,23 +39,23 @@ buf_pool_get_curr_size(void)
/************************************************************************ /************************************************************************
Gets the smallest oldest_modification lsn for any page in the pool. Returns 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 UNIV_INLINE
dulint ib_ulonglong
buf_pool_get_oldest_modification(void) buf_pool_get_oldest_modification(void)
/*==================================*/ /*==================================*/
/* out: oldest modification in pool, /* out: oldest modification in pool,
ut_dulint_zero if none */ zero if none */
{ {
buf_block_t* block; buf_block_t* block;
dulint lsn; ib_ulonglong lsn;
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
block = UT_LIST_GET_LAST(buf_pool->flush_list); block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (block == NULL) { if (block == NULL) {
lsn = ut_dulint_zero; lsn = 0;
} else { } else {
lsn = block->oldest_modification; lsn = block->oldest_modification;
} }
...@@ -408,23 +408,23 @@ buf_page_io_query( ...@@ -408,23 +408,23 @@ buf_page_io_query(
} }
/************************************************************************ /************************************************************************
Gets the youngest modification log sequence number for a frame. Returns zero Gets the youngest modification log sequence number for a frame.
if not a file page or no modification occurred yet. */ Returns zero if not file page or no modification occurred yet. */
UNIV_INLINE UNIV_INLINE
dulint ib_ulonglong
buf_block_get_newest_modification( 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 */ buf_block_t* block) /* in: block containing the page frame */
{ {
dulint lsn; ib_ulonglong lsn;
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
if (buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE) { if (buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE) {
lsn = block->newest_modification; lsn = block->newest_modification;
} else { } else {
lsn = ut_dulint_zero; lsn = 0;
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
...@@ -447,14 +447,14 @@ buf_block_modify_clock_inc( ...@@ -447,14 +447,14 @@ buf_block_modify_clock_inc(
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE)); || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */ #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 Returns the value of the modify clock. The caller must have an s-lock
or x-lock on the block. */ or x-lock on the block. */
UNIV_INLINE UNIV_INLINE
dulint ib_ulonglong
buf_block_get_modify_clock( buf_block_get_modify_clock(
/*=======================*/ /*=======================*/
/* out: value */ /* out: value */
......
...@@ -35,8 +35,9 @@ void ...@@ -35,8 +35,9 @@ void
buf_flush_init_for_writing( buf_flush_init_for_writing(
/*=======================*/ /*=======================*/
byte* page, /* in/out: page */ byte* page, /* in/out: page */
void* page_zip, /* in/out: compressed page, or NULL */ void* page_zip_, /* in/out: compressed page, or NULL */
dulint newest_lsn); /* in: newest modification lsn to the page */ 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. 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 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! */ ...@@ -47,18 +48,22 @@ the calling thread is not allowed to own any latches on pages! */
ulint ulint
buf_flush_batch( buf_flush_batch(
/*============*/ /*============*/
/* out: number of blocks for which the write /* out: number of blocks for which the
request was queued */ write request was queued;
ulint flush_type, /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST; if ULINT_UNDEFINED if there was a flush
BUF_FLUSH_LIST, then the caller must not own of the same type already running */
any latches on pages */ ulint flush_type, /* in: BUF_FLUSH_LRU or
ulint min_n, /* in: wished minimum mumber of blocks flushed BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
(it is not guaranteed that the actual number then the caller must not own any
is that big, though) */ latches on pages */
dulint lsn_limit); /* in the case BUF_FLUSH_LIST all blocks whose ulint min_n, /* in: wished minimum mumber of blocks
oldest_modification is smaller than this flushed (it is not guaranteed that the
should be flushed (if their number does not actual number is that big, though) */
exceed min_n), otherwise ignored */ 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 */ Waits until a flush batch of the given type ends */
...@@ -83,9 +88,9 @@ void ...@@ -83,9 +88,9 @@ void
buf_flush_recv_note_modification( buf_flush_recv_note_modification(
/*=============================*/ /*=============================*/
buf_block_t* block, /* in: block which is modified */ 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 */ 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 */ set of mtr's */
/************************************************************************ /************************************************************************
Returns TRUE if the file page block is immediately suitable for replacement, Returns TRUE if the file page block is immediately suitable for replacement,
......
...@@ -45,21 +45,20 @@ buf_flush_note_modification( ...@@ -45,21 +45,20 @@ buf_flush_note_modification(
ut_ad(mutex_own(&(buf_pool->mutex))); ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #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(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; block->newest_modification = mtr->end_lsn;
if (ut_dulint_is_zero(block->oldest_modification)) { if (!block->oldest_modification) {
block->oldest_modification = mtr->start_lsn; 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); buf_flush_insert_into_flush_list(block);
} else { } else {
ut_ad(ut_dulint_cmp(block->oldest_modification, ut_ad(block->oldest_modification <= mtr->start_lsn);
mtr->start_lsn) <= 0);
} }
++srv_buf_pool_write_requests; ++srv_buf_pool_write_requests;
...@@ -72,9 +71,9 @@ void ...@@ -72,9 +71,9 @@ void
buf_flush_recv_note_modification( buf_flush_recv_note_modification(
/*=============================*/ /*=============================*/
buf_block_t* block, /* in: block which is modified */ 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 */ 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 */ set of mtr's */
{ {
ut_ad(block); ut_ad(block);
...@@ -86,20 +85,19 @@ buf_flush_recv_note_modification( ...@@ -86,20 +85,19 @@ buf_flush_recv_note_modification(
mutex_enter(&(buf_pool->mutex)); 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; block->newest_modification = end_lsn;
if (ut_dulint_is_zero(block->oldest_modification)) { if (!block->oldest_modification) {
block->oldest_modification = start_lsn; 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); buf_flush_insert_sorted_into_flush_list(block);
} else { } else {
ut_ad(ut_dulint_cmp(block->oldest_modification, ut_ad(block->oldest_modification <= start_lsn);
start_lsn) <= 0);
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
......
...@@ -286,8 +286,9 @@ ulint ...@@ -286,8 +286,9 @@ ulint
fil_write_flushed_lsn_to_data_files( fil_write_flushed_lsn_to_data_files(
/*================================*/ /*================================*/
/* out: DB_SUCCESS or error number */ /* out: DB_SUCCESS or error number */
dulint lsn, /* in: lsn to write */ ib_ulonglong lsn, /* in: lsn to write */
ulint arch_log_no); /* in: latest archived log file number */ ulint arch_log_no); /* in: latest archived log
file number */
/*********************************************************************** /***********************************************************************
Reads the flushed lsn and arch no fields from a data file at database Reads the flushed lsn and arch no fields from a data file at database
startup. */ startup. */
...@@ -296,14 +297,15 @@ void ...@@ -296,14 +297,15 @@ void
fil_read_flushed_lsn_and_arch_log_no( fil_read_flushed_lsn_and_arch_log_no(
/*=================================*/ /*=================================*/
os_file_t data_file, /* in: open data file */ os_file_t data_file, /* in: open data file */
ibool one_read_already, /* in: TRUE if min and max parameters ibool one_read_already, /* in: TRUE if min and max
below already contain sensible data */ parameters below already
contain sensible data */
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no, /* in/out: */ ulint* min_arch_log_no, /* in/out: */
ulint* max_arch_log_no, /* in/out: */ ulint* max_arch_log_no, /* in/out: */
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
dulint* min_flushed_lsn, /* in/out: */ ib_ulonglong* min_flushed_lsn, /* in/out: */
dulint* max_flushed_lsn); /* in/out: */ ib_ulonglong* max_flushed_lsn); /* in/out: */
/*********************************************************************** /***********************************************************************
Increments the count of pending insert buffer page merges, if space is not Increments the count of pending insert buffer page merges, if space is not
being deleted. */ being deleted. */
...@@ -455,7 +457,7 @@ fil_reset_too_high_lsns( ...@@ -455,7 +457,7 @@ fil_reset_too_high_lsns(
/* out: TRUE if success */ /* out: TRUE if success */
const char* name, /* in: table name in the const char* name, /* in: table name in the
databasename/tablename format */ 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 to FIL_PAGE_FILE_FLUSH_LSN in the
first page is too high */ first page is too high */
/************************************************************************ /************************************************************************
......
This diff is collapsed.
...@@ -17,10 +17,11 @@ consistent. */ ...@@ -17,10 +17,11 @@ consistent. */
ibool ibool
log_check_log_recs( log_check_log_recs(
/*===============*/ /*===============*/
byte* buf, /* in: pointer to the start of the log segment byte* buf, /* in: pointer to the start of
in the log_sys->buf log buffer */ the log segment in the
log_sys->buf log buffer */
ulint len, /* in: segment length in bytes */ ulint len, /* in: segment length in bytes */
dulint buf_start_lsn); /* in: buffer start lsn */ ib_ulonglong buf_start_lsn); /* in: buffer start lsn */
/**************************************************************** /****************************************************************
Gets a log block flush bit. */ Gets a log block flush bit. */
...@@ -163,10 +164,9 @@ void ...@@ -163,10 +164,9 @@ void
log_block_set_checkpoint_no( log_block_set_checkpoint_no(
/*========================*/ /*========================*/
byte* log_block, /* in: log block */ byte* log_block, /* in: log block */
dulint no) /* in: checkpoint no */ ib_ulonglong no) /* in: checkpoint no */
{ {
mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO, mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO, (ulint) no);
ut_dulint_get_low(no));
} }
/**************************************************************** /****************************************************************
...@@ -175,18 +175,11 @@ UNIV_INLINE ...@@ -175,18 +175,11 @@ UNIV_INLINE
ulint ulint
log_block_convert_lsn_to_no( log_block_convert_lsn_to_no(
/*========================*/ /*========================*/
/* out: log block number, it is > 0 and <= 1G */ /* out: log block number,
dulint lsn) /* in: lsn of a byte within the block */ it is > 0 and <= 1G */
ib_ulonglong lsn) /* in: lsn of a byte within the block */
{ {
ulint no; return(((ulint) (lsn / OS_FILE_LOG_BLOCK_SIZE) & 0x3FFFFFFFUL) + 1);
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);
} }
/**************************************************************** /****************************************************************
...@@ -251,7 +244,7 @@ void ...@@ -251,7 +244,7 @@ void
log_block_init( log_block_init(
/*===========*/ /*===========*/
byte* log_block, /* in: pointer to the log buffer */ byte* log_block, /* in: pointer to the log buffer */
dulint lsn) /* in: lsn within the log block */ ib_ulonglong lsn) /* in: lsn within the log block */
{ {
ulint no; ulint no;
...@@ -275,7 +268,7 @@ void ...@@ -275,7 +268,7 @@ void
log_block_init_in_old_format( log_block_init_in_old_format(
/*=========================*/ /*=========================*/
byte* log_block, /* in: pointer to the log buffer */ byte* log_block, /* in: pointer to the log buffer */
dulint lsn) /* in: lsn within the log block */ ib_ulonglong lsn) /* in: lsn within the log block */
{ {
ulint no; ulint no;
...@@ -296,19 +289,19 @@ log_block_init_in_old_format( ...@@ -296,19 +289,19 @@ log_block_init_in_old_format(
Writes to the log the string given. The log must be released with Writes to the log the string given. The log must be released with
log_release. */ log_release. */
UNIV_INLINE UNIV_INLINE
dulint ib_ulonglong
log_reserve_and_write_fast( log_reserve_and_write_fast(
/*=======================*/ /*=======================*/
/* out: end lsn of the log record, ut_dulint_zero if /* out: end lsn of the log record,
did not succeed */ zero if did not succeed */
byte* str, /* in: string */ byte* str, /* in: string */
ulint len, /* in: string length */ ulint len, /* in: string length */
dulint* start_lsn,/* out: start lsn of the log record */ ib_ulonglong* start_lsn,/* out: start lsn of the log record */
ibool* success)/* out: TRUE if success */ ibool* success)/* out: TRUE if success */
{ {
log_t* log = log_sys; log_t* log = log_sys;
ulint data_len; ulint data_len;
dulint lsn; ib_ulonglong lsn;
*success = TRUE; *success = TRUE;
...@@ -325,7 +318,7 @@ log_reserve_and_write_fast( ...@@ -325,7 +318,7 @@ log_reserve_and_write_fast(
mutex_exit(&(log->mutex)); mutex_exit(&(log->mutex));
return(ut_dulint_zero); return(0);
} }
*start_lsn = log->lsn; *start_lsn = log->lsn;
...@@ -343,9 +336,7 @@ log_reserve_and_write_fast( ...@@ -343,9 +336,7 @@ log_reserve_and_write_fast(
ut_ad(log->buf_free <= log->buf_size); ut_ad(log->buf_free <= log->buf_size);
lsn = ut_dulint_add(log->lsn, len); lsn = log->lsn += len;
log->lsn = lsn;
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
log_check_log_recs(log->buf + log->old_buf_free, log_check_log_recs(log->buf + log->old_buf_free,
...@@ -367,12 +358,12 @@ log_release(void) ...@@ -367,12 +358,12 @@ log_release(void)
/**************************************************************** /****************************************************************
Gets the current lsn. */ Gets the current lsn. */
UNIV_INLINE UNIV_INLINE
dulint ib_ulonglong
log_get_lsn(void) log_get_lsn(void)
/*=============*/ /*=============*/
/* out: current lsn */ /* out: current lsn */
{ {
dulint lsn; ib_ulonglong lsn;
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
......
...@@ -26,14 +26,17 @@ ibool ...@@ -26,14 +26,17 @@ ibool
recv_read_cp_info_for_backup( recv_read_cp_info_for_backup(
/*=========================*/ /*=========================*/
/* out: TRUE if success */ /* out: TRUE if success */
byte* hdr, /* in: buffer containing the log group header */ byte* hdr, /* in: buffer containing the log group
dulint* lsn, /* out: checkpoint lsn */ header */
ib_ulonglong* lsn, /* out: checkpoint lsn */
ulint* offset, /* out: checkpoint offset in the log group */ ulint* offset, /* out: checkpoint offset in the log group */
ulint* fsp_limit,/* out: fsp limit of space 0, 1000000000 if the ulint* fsp_limit,/* out: fsp limit of space 0,
database is running with < version 3.23.50 of InnoDB */ 1000000000 if the database is running
dulint* cp_no, /* out: checkpoint number */ with < version 3.23.50 of InnoDB */
dulint* first_header_lsn); ib_ulonglong* cp_no, /* out: checkpoint number */
/* out: lsn of of the start of the first log file */ 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 Scans the log segment and n_bytes_scanned is set to the length of valid
log scanned. */ log scanned. */
...@@ -43,7 +46,7 @@ recv_scan_log_seg_for_backup( ...@@ -43,7 +46,7 @@ recv_scan_log_seg_for_backup(
/*=========================*/ /*=========================*/
byte* buf, /* in: buffer containing log data */ byte* buf, /* in: buffer containing log data */
ulint buf_len, /* in: data length in that buffer */ 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 */ we return scanned lsn */
ulint* scanned_checkpoint_no, ulint* scanned_checkpoint_no,
/* in/out: 4 lowest bytes of the /* in/out: 4 lowest bytes of the
...@@ -92,9 +95,12 @@ recv_recovery_from_checkpoint_start( ...@@ -92,9 +95,12 @@ recv_recovery_from_checkpoint_start(
/*================================*/ /*================================*/
/* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
ulint type, /* in: LOG_CHECKPOINT or LOG_ARCHIVE */ ulint type, /* in: LOG_CHECKPOINT or LOG_ARCHIVE */
dulint limit_lsn, /* in: recover up to this lsn if possible */ ib_ulonglong limit_lsn, /* in: recover up to this lsn
dulint min_flushed_lsn,/* in: min flushed lsn from data files */ if possible */
dulint max_flushed_lsn);/* in: max flushed lsn from data files */ 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. */ Completes recovery from a checkpoint. */
...@@ -108,40 +114,48 @@ and hashes the log records if new data found. */ ...@@ -108,40 +114,48 @@ and hashes the log records if new data found. */
ibool ibool
recv_scan_log_recs( recv_scan_log_recs(
/*===============*/ /*===============*/
/* out: TRUE if limit_lsn has been reached, or /* out: TRUE if limit_lsn has been
not able to scan any more in this log group */ reached, or not able to scan any more
ibool apply_automatically,/* in: TRUE if we want this function to in this log group */
apply log records automatically when the ibool apply_automatically,/* in: TRUE if we want this
hash table becomes full; in the hot backup tool function to apply log records
automatically when the hash table
becomes full; in the hot backup tool
the tool does the applying, not this the tool does the applying, not this
function */ function */
ulint available_memory,/* in: we let the hash table of recs to grow ulint available_memory,/* in: we let the hash table of recs
to this size, at the maximum */ to grow to this size, at the maximum */
ibool store_to_hash, /* in: TRUE if the records should be stored ibool store_to_hash, /* in: TRUE if the records should be
to the hash table; this is set to FALSE if just stored to the hash table; this is set
debug checking is needed */ to FALSE if just debug checking is
byte* buf, /* in: buffer containing a log segment or needed */
garbage */ byte* buf, /* in: buffer containing a log segment
or garbage */
ulint len, /* in: buffer length */ ulint len, /* in: buffer length */
dulint start_lsn, /* in: buffer start lsn */ ib_ulonglong start_lsn, /* in: buffer start lsn */
dulint* contiguous_lsn, /* in/out: it is known that all log groups ib_ulonglong* contiguous_lsn, /* in/out: it is known that all log
contain contiguous log data up to this lsn */ groups contain contiguous log data up
dulint* group_scanned_lsn);/* out: scanning succeeded up to this lsn */ 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! */ Resets the logs. The contents of log files will be lost! */
void void
recv_reset_logs( recv_reset_logs(
/*============*/ /*============*/
dulint lsn, /* in: reset to this lsn rounded up to ib_ulonglong lsn, /* in: reset to this lsn
be divisible by OS_FILE_LOG_BLOCK_SIZE, rounded up to be divisible by
after which we add LOG_BLOCK_HDR_SIZE */ OS_FILE_LOG_BLOCK_SIZE, after
which we add
LOG_BLOCK_HDR_SIZE */
#ifdef UNIV_LOG_ARCHIVE #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 */ #endif /* UNIV_LOG_ARCHIVE */
ibool new_logs_created);/* in: TRUE if resetting logs is done ibool new_logs_created);/* in: TRUE if resetting logs
at the log creation; FALSE if it is done is done at the log creation;
after archive recovery */ FALSE if it is done after
archive recovery */
#ifdef UNIV_HOTBACKUP #ifdef UNIV_HOTBACKUP
/********************************************************** /**********************************************************
Creates new log files after a backup has been restored. */ Creates new log files after a backup has been restored. */
...@@ -152,7 +166,7 @@ recv_reset_log_files_for_backup( ...@@ -152,7 +166,7 @@ recv_reset_log_files_for_backup(
const char* log_dir, /* in: log file directory path */ const char* log_dir, /* in: log file directory path */
ulint n_log_files, /* in: number of log files */ ulint n_log_files, /* in: number of log files */
ulint log_file_size, /* in: log file size */ 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 */ divisible by OS_FILE_LOG_BLOCK_SIZE */
#endif /* UNIV_HOTBACKUP */ #endif /* UNIV_HOTBACKUP */
/************************************************************ /************************************************************
...@@ -200,13 +214,15 @@ ulint ...@@ -200,13 +214,15 @@ ulint
recv_recovery_from_archive_start( recv_recovery_from_archive_start(
/*=============================*/ /*=============================*/
/* out: error code or DB_SUCCESS */ /* out: error code or DB_SUCCESS */
dulint min_flushed_lsn,/* in: min flushed lsn field from the ib_ulonglong min_flushed_lsn,/* in: min flushed lsn field from the
data files */ data files */
dulint limit_lsn, /* in: recover up to this lsn if possible */ ib_ulonglong limit_lsn, /* in: recover up to this lsn if
ulint first_log_no); /* in: number of the first archived log file possible */
to use in the recovery; the file will be ulint first_log_no); /* in: number of the first archived
searched from INNOBASE_LOG_ARCH_DIR specified log file to use in the recovery; the
in server config file */ file will be searched from
INNOBASE_LOG_ARCH_DIR specified in
server config file */
/************************************************************ /************************************************************
Completes recovery from archive. */ Completes recovery from archive. */
...@@ -231,11 +247,11 @@ struct recv_struct{ ...@@ -231,11 +247,11 @@ struct recv_struct{
ulint len; /* log record body length in bytes */ ulint len; /* log record body length in bytes */
recv_data_t* data; /* chain of blocks containing the log record recv_data_t* data; /* chain of blocks containing the log record
body */ 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 the mtr which generated this log record: NOTE
that this is not necessarily the start lsn of that this is not necessarily the start lsn of
this log record */ 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 the mtr which generated this log record: NOTE
that this is not necessarily the end lsn of that this is not necessarily the end lsn of
this log record */ this log record */
...@@ -269,7 +285,7 @@ struct recv_sys_struct{ ...@@ -269,7 +285,7 @@ struct recv_sys_struct{
ibool apply_batch_on; ibool apply_batch_on;
/* this is TRUE when a log rec application /* this is TRUE when a log rec application
batch is running */ batch is running */
dulint lsn; /* log sequence number */ ib_ulonglong lsn; /* log sequence number */
ulint last_log_buf_size; ulint last_log_buf_size;
/* size of the log buffer when the database /* size of the log buffer when the database
last time wrote to the log */ last time wrote to the log */
...@@ -281,12 +297,12 @@ struct recv_sys_struct{ ...@@ -281,12 +297,12 @@ struct recv_sys_struct{
preceding buffer */ preceding buffer */
byte* buf; /* buffer for parsing log records */ byte* buf; /* buffer for parsing log records */
ulint len; /* amount of data in buf */ 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 /* this is the lsn from which we were able to
start parsing log records and adding them 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 */ start point not found yet */
dulint scanned_lsn; ib_ulonglong scanned_lsn;
/* the log data has been scanned up to this /* the log data has been scanned up to this
lsn */ lsn */
ulint scanned_checkpoint_no; ulint scanned_checkpoint_no;
...@@ -295,10 +311,10 @@ struct recv_sys_struct{ ...@@ -295,10 +311,10 @@ struct recv_sys_struct{
ulint recovered_offset; ulint recovered_offset;
/* start offset of non-parsed log records in /* start offset of non-parsed log records in
buf */ buf */
dulint recovered_lsn; ib_ulonglong recovered_lsn;
/* the log records have been parsed up to /* the log records have been parsed up to
this lsn */ 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 */ lsn */
ibool found_corrupt_log; ibool found_corrupt_log;
/* this is set to TRUE if we during log /* this is set to TRUE if we during log
......
...@@ -179,6 +179,15 @@ mach_write_to_8( ...@@ -179,6 +179,15 @@ mach_write_to_8(
/*============*/ /*============*/
byte* b, /* in: pointer to 8 bytes where to store */ byte* b, /* in: pointer to 8 bytes where to store */
dulint n); /* in: dulint integer to be stored */ 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 The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */ bytes. The most significant byte is at the lowest address. */
...@@ -188,6 +197,15 @@ mach_read_from_8( ...@@ -188,6 +197,15 @@ mach_read_from_8(
/*=============*/ /*=============*/
/* out: dulint integer */ /* out: dulint integer */
const byte* b); /* in: pointer to 8 bytes */ 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). */ Writes a dulint in a compressed form (5..9 bytes). */
UNIV_INLINE UNIV_INLINE
......
...@@ -273,6 +273,22 @@ mach_write_to_8( ...@@ -273,6 +273,22 @@ mach_write_to_8(
mach_write_to_4(b + 4, ut_dulint_get_low(n)); 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 The following function is used to fetch data from 8 consecutive
bytes. The most significant byte is at the lowest address. */ bytes. The most significant byte is at the lowest address. */
...@@ -294,6 +310,24 @@ mach_read_from_8( ...@@ -294,6 +310,24 @@ mach_read_from_8(
return(ut_dulint_create(high, low)); 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 The following function is used to store data in 7 consecutive
bytes. We store the most significant byte to the lowest address. */ bytes. We store the most significant byte to the lowest address. */
......
...@@ -350,9 +350,9 @@ struct mtr_struct{ ...@@ -350,9 +350,9 @@ struct mtr_struct{
have been written to the mtr log */ have been written to the mtr log */
ulint log_mode; /* specifies which operations should be ulint log_mode; /* specifies which operations should be
logged; default value MTR_LOG_ALL */ 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 */ 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 */ this mtr */
ulint magic_n; ulint magic_n;
}; };
......
...@@ -78,8 +78,8 @@ int ...@@ -78,8 +78,8 @@ int
innobase_shutdown_for_mysql(void); innobase_shutdown_for_mysql(void);
/*=============================*/ /*=============================*/
/* out: DB_SUCCESS or error code */ /* out: DB_SUCCESS or error code */
extern dulint srv_shutdown_lsn; extern ib_ulonglong srv_shutdown_lsn;
extern dulint srv_start_lsn; extern ib_ulonglong srv_start_lsn;
#ifdef __NETWARE__ #ifdef __NETWARE__
void set_panic_flag_for_netware(void); void set_panic_flag_for_netware(void);
......
...@@ -446,7 +446,7 @@ struct trx_struct{ ...@@ -446,7 +446,7 @@ struct trx_struct{
were modifications by the transaction; were modifications by the transaction;
in that case we must flush the log in that case we must flush the log
in trx_commit_complete_for_mysql() */ 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 ibool dict_operation; /* TRUE if the trx is used to create
a table, create an index, or drop a a table, create an index, or drop a
table. This is a hint that the table table. This is a hint that the table
......
...@@ -202,8 +202,10 @@ typedef long int lint; ...@@ -202,8 +202,10 @@ typedef long int lint;
#ifdef __WIN__ #ifdef __WIN__
typedef __int64 ib_longlong; typedef __int64 ib_longlong;
typedef unsigned __int64 ib_ulonglong;
#else #else
typedef longlong ib_longlong; typedef longlong ib_longlong;
typedef ulonglong ib_ulonglong;
#endif #endif
#ifndef __WIN__ #ifndef __WIN__
...@@ -221,6 +223,9 @@ typedef longlong ib_longlong; ...@@ -221,6 +223,9 @@ typedef longlong ib_longlong;
/* Maximum value for a ulint */ /* Maximum value for a ulint */
#define ULINT_MAX ((ulint)(-2)) #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 /* This 'ibool' type is used within Innobase. Remember that different included
headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */ headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */
#define ibool ulint #define ibool ulint
......
...@@ -148,6 +148,26 @@ ut_dulint_align_up( ...@@ -148,6 +148,26 @@ ut_dulint_align_up(
dulint n, /* in: number to be rounded */ dulint n, /* in: number to be rounded */
ulint align_no); /* in: align by this number which must be a ulint align_no); /* in: align by this number which must be a
power of 2 */ 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. */ Increments a dulint variable by 1. */
#define UT_DULINT_INC(D)\ #define UT_DULINT_INC(D)\
......
...@@ -260,6 +260,42 @@ ut_dulint_align_up( ...@@ -260,6 +260,42 @@ ut_dulint_align_up(
return(ut_dulint_align_down(ut_dulint_add(n, align_no - 1), align_no)); 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 The following function calculates the value of an integer n rounded
to the least product of align_no which is >= n. align_no to the least product of align_no which is >= n. align_no
......
This diff is collapsed.
This diff is collapsed.
...@@ -2512,7 +2512,7 @@ row_import_tablespace_for_mysql( ...@@ -2512,7 +2512,7 @@ row_import_tablespace_for_mysql(
{ {
dict_table_t* table; dict_table_t* table;
ibool success; ibool success;
dulint current_lsn; ib_ulonglong current_lsn;
ulint err = DB_SUCCESS; ulint err = DB_SUCCESS;
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
......
...@@ -172,7 +172,7 @@ ulint srv_n_file_io_threads = ULINT_MAX; ...@@ -172,7 +172,7 @@ ulint srv_n_file_io_threads = ULINT_MAX;
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
ibool srv_log_archive_on = FALSE; ibool srv_log_archive_on = FALSE;
ibool srv_archive_recovery = 0; ibool srv_archive_recovery = 0;
dulint srv_archive_recovery_limit_lsn; ib_ulonglong srv_archive_recovery_limit_lsn;
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024; ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
...@@ -2017,8 +2017,8 @@ srv_error_monitor_thread( ...@@ -2017,8 +2017,8 @@ srv_error_monitor_thread(
{ {
/* number of successive fatal timeouts observed */ /* number of successive fatal timeouts observed */
ulint fatal_cnt = 0; ulint fatal_cnt = 0;
dulint old_lsn; ib_ulonglong old_lsn;
dulint new_lsn; ib_ulonglong new_lsn;
old_lsn = srv_start_lsn; old_lsn = srv_start_lsn;
...@@ -2034,18 +2034,15 @@ srv_error_monitor_thread( ...@@ -2034,18 +2034,15 @@ srv_error_monitor_thread(
new_lsn = log_get_lsn(); new_lsn = log_get_lsn();
if (ut_dulint_cmp(new_lsn, old_lsn) < 0) { if (new_lsn < old_lsn) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: old log sequence number %lu %lu" " InnoDB: Error: old log sequence number %llu"
" was greater\n" " was greater\n"
"InnoDB: than the new log sequence number %lu %lu!\n" "InnoDB: than the new log sequence number %llu!\n"
"InnoDB: Please submit a bug report" "InnoDB: Please submit a bug report"
" to http://bugs.mysql.com\n", " to http://bugs.mysql.com\n",
(ulong) ut_dulint_get_high(old_lsn), old_lsn, new_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 @@ srv_master_thread( ...@@ -2265,7 +2262,7 @@ srv_master_thread(
buffer pool under the limit wished by the user */ buffer pool under the limit wished by the user */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, 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 /* If we had to do the flush, it may have taken
even more than 1 second, and also, there may be more even more than 1 second, and also, there may be more
...@@ -2302,7 +2299,7 @@ srv_master_thread( ...@@ -2302,7 +2299,7 @@ srv_master_thread(
if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) { if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
srv_main_thread_op_info = "flushing buffer pool pages"; 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"; srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk(); log_buffer_flush_to_disk();
...@@ -2353,14 +2350,14 @@ srv_master_thread( ...@@ -2353,14 +2350,14 @@ srv_master_thread(
the time it requires to flush 100 pages */ the time it requires to flush 100 pages */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
ut_dulint_max); IB_ULONGLONG_MAX);
} else { } else {
/* Otherwise, we only flush a small number of pages so that /* Otherwise, we only flush a small number of pages so that
we do not unnecessarily use much disk i/o capacity from we do not unnecessarily use much disk i/o capacity from
other work */ other work */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10, n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10,
ut_dulint_max); IB_ULONGLONG_MAX);
} }
srv_main_thread_op_info = "making checkpoint"; srv_main_thread_op_info = "making checkpoint";
...@@ -2463,7 +2460,7 @@ srv_master_thread( ...@@ -2463,7 +2460,7 @@ srv_master_thread(
if (srv_fast_shutdown < 2) { if (srv_fast_shutdown < 2) {
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
ut_dulint_max); IB_ULONGLONG_MAX);
} else { } else {
/* In the fastest shutdown we do not flush the buffer pool /* In the fastest shutdown we do not flush the buffer pool
to data files: we set n_pages_flushed to 0 artificially. */ to data files: we set n_pages_flushed to 0 artificially. */
......
...@@ -57,9 +57,9 @@ Created 2/16/1996 Heikki Tuuri ...@@ -57,9 +57,9 @@ Created 2/16/1996 Heikki Tuuri
#include "que0que.h" #include "que0que.h"
/* Log sequence number immediately after startup */ /* Log sequence number immediately after startup */
dulint srv_start_lsn; ib_ulonglong srv_start_lsn;
/* Log sequence number at shutdown */ /* Log sequence number at shutdown */
dulint srv_shutdown_lsn; ib_ulonglong srv_shutdown_lsn;
#ifdef HAVE_DARWIN_THREADS #ifdef HAVE_DARWIN_THREADS
# include <sys/utsname.h> # include <sys/utsname.h>
...@@ -693,14 +693,17 @@ open_or_create_data_files( ...@@ -693,14 +693,17 @@ open_or_create_data_files(
ibool* create_new_db, /* out: TRUE if new database should be ibool* create_new_db, /* out: TRUE if new database should be
created */ created */
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no,/* out: min of archived log numbers in data ulint* min_arch_log_no,/* out: min of archived log
files */ numbers in data files */
ulint* max_arch_log_no,/* out: */ ulint* max_arch_log_no,/* out: max of archived log
numbers in data files */
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
dulint* min_flushed_lsn,/* out: min of flushed lsn values in data ib_ulonglong* min_flushed_lsn,/* out: min of flushed lsn
files */ values in data files */
dulint* max_flushed_lsn,/* out: */ ib_ulonglong* max_flushed_lsn,/* out: max of flushed lsn
ulint* sum_of_new_sizes)/* out: sum of sizes of the new files added */ values in data files */
ulint* sum_of_new_sizes)/* out: sum of sizes of the
new files added */
{ {
ibool ret; ibool ret;
ulint i; ulint i;
...@@ -967,8 +970,8 @@ innobase_start_or_create_for_mysql(void) ...@@ -967,8 +970,8 @@ innobase_start_or_create_for_mysql(void)
ibool log_file_created; ibool log_file_created;
ibool log_created = FALSE; ibool log_created = FALSE;
ibool log_opened = FALSE; ibool log_opened = FALSE;
dulint min_flushed_lsn; ib_ulonglong min_flushed_lsn;
dulint max_flushed_lsn; ib_ulonglong max_flushed_lsn;
#ifdef UNIV_LOG_ARCHIVE #ifdef UNIV_LOG_ARCHIVE
ulint min_arch_log_no; ulint min_arch_log_no;
ulint max_arch_log_no; ulint max_arch_log_no;
...@@ -978,7 +981,8 @@ innobase_start_or_create_for_mysql(void) ...@@ -978,7 +981,8 @@ innobase_start_or_create_for_mysql(void)
ulint tablespace_size_in_header; ulint tablespace_size_in_header;
ulint err; ulint err;
ulint i; ulint i;
ibool srv_file_per_table_original_value = srv_file_per_table; ibool srv_file_per_table_original_value
= srv_file_per_table;
mtr_t mtr; mtr_t mtr;
#ifdef HAVE_DARWIN_THREADS #ifdef HAVE_DARWIN_THREADS
# ifdef F_FULLFSYNC # ifdef F_FULLFSYNC
...@@ -1366,7 +1370,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1366,7 +1370,7 @@ innobase_start_or_create_for_mysql(void)
&& !srv_archive_recovery && !srv_archive_recovery
#endif /* UNIV_LOG_ARCHIVE */ #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 #ifdef UNIV_LOG_ARCHIVE
|| max_arch_log_no != min_arch_log_no || max_arch_log_no != min_arch_log_no
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
...@@ -1381,8 +1385,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1381,8 +1385,7 @@ innobase_start_or_create_for_mysql(void)
return(DB_ERROR); return(DB_ERROR);
} }
if (ut_dulint_cmp(max_flushed_lsn, ut_dulint_create(0, 1000)) if (max_flushed_lsn < (ib_ulonglong) 1000) {
< 0) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Cannot initialize created" "InnoDB: Cannot initialize created"
" log files because\n" " log files because\n"
...@@ -1450,7 +1453,7 @@ innobase_start_or_create_for_mysql(void) ...@@ -1450,7 +1453,7 @@ innobase_start_or_create_for_mysql(void)
been shut down normally: this is the normal startup path */ been shut down normally: this is the normal startup path */
err = recv_recovery_from_checkpoint_start(LOG_CHECKPOINT, err = recv_recovery_from_checkpoint_start(LOG_CHECKPOINT,
ut_dulint_max, IB_ULONGLONG_MAX,
min_flushed_lsn, min_flushed_lsn,
max_flushed_lsn); max_flushed_lsn);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
...@@ -1676,9 +1679,8 @@ innobase_start_or_create_for_mysql(void) ...@@ -1676,9 +1679,8 @@ innobase_start_or_create_for_mysql(void)
if (srv_print_verbose_log) { if (srv_print_verbose_log) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Started; log sequence number %lu %lu\n", " InnoDB: Started; log sequence number %llu\n",
(ulong) ut_dulint_get_high(srv_start_lsn), srv_start_lsn);
(ulong) ut_dulint_get_low(srv_start_lsn));
} }
if (srv_force_recovery > 0) { if (srv_force_recovery > 0) {
...@@ -1938,9 +1940,8 @@ innobase_shutdown_for_mysql(void) ...@@ -1938,9 +1940,8 @@ innobase_shutdown_for_mysql(void)
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Shutdown completed;" " InnoDB: Shutdown completed;"
" log sequence number %lu %lu\n", " log sequence number %llu\n",
(ulong) ut_dulint_get_high(srv_shutdown_lsn), srv_shutdown_lsn);
(ulong) ut_dulint_get_low(srv_shutdown_lsn));
} }
return((int) DB_SUCCESS); return((int) DB_SUCCESS);
......
...@@ -149,7 +149,7 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void) ...@@ -149,7 +149,7 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void)
mtr_commit(&mtr); mtr_commit(&mtr);
/* Flush the modified pages to disk and make a checkpoint */ /* 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; trx_sys_multiple_tablespace_format = TRUE;
} }
...@@ -322,7 +322,7 @@ trx_sys_create_doublewrite_buf(void) ...@@ -322,7 +322,7 @@ trx_sys_create_doublewrite_buf(void)
mtr_commit(&mtr); mtr_commit(&mtr);
/* Flush the modified pages to disk and make a checkpoint */ /* 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"); fprintf(stderr, "InnoDB: Doublewrite buffer created\n");
......
...@@ -743,7 +743,7 @@ trx_commit_off_kernel( ...@@ -743,7 +743,7 @@ trx_commit_off_kernel(
trx_t* trx) /* in: transaction */ trx_t* trx) /* in: transaction */
{ {
page_t* update_hdr_page; page_t* update_hdr_page;
dulint lsn; ib_ulonglong lsn;
trx_rseg_t* rseg; trx_rseg_t* rseg;
trx_undo_t* undo; trx_undo_t* undo;
ibool must_flush_log = FALSE; ibool must_flush_log = FALSE;
...@@ -1621,7 +1621,7 @@ trx_commit_complete_for_mysql( ...@@ -1621,7 +1621,7 @@ trx_commit_complete_for_mysql(
/* out: 0 or error number */ /* out: 0 or error number */
trx_t* trx) /* in: trx handle */ trx_t* trx) /* in: trx handle */
{ {
dulint lsn = trx->commit_lsn; ib_ulonglong lsn = trx->commit_lsn;
ut_a(trx); ut_a(trx);
...@@ -1799,7 +1799,7 @@ trx_prepare_off_kernel( ...@@ -1799,7 +1799,7 @@ trx_prepare_off_kernel(
page_t* update_hdr_page; page_t* update_hdr_page;
trx_rseg_t* rseg; trx_rseg_t* rseg;
ibool must_flush_log = FALSE; ibool must_flush_log = FALSE;
dulint lsn; ib_ulonglong lsn;
mtr_t mtr; mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment