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
......@@ -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"
" %lu %lu\n"
" %llu\n"
"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 "
"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++;
}
......
......@@ -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);
}
}
......
......@@ -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);
}
......
......@@ -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 %lu %lu, which exceeds current"
" system lsn %lu %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);
......
......@@ -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!
......
......@@ -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
......
......@@ -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 */
......
......@@ -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,
......
......@@ -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));
......
......@@ -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 */
/************************************************************************
......
This diff is collapsed.
......@@ -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));
......
......@@ -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
......
......@@ -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
......
......@@ -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. */
......
......@@ -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;
};
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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)\
......
......@@ -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
......
This diff is collapsed.
This diff is collapsed.
......@@ -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());
......
......@@ -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 %lu %lu"
" InnoDB: Error: old log sequence number %llu"
" 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"
" 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. */
......
......@@ -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);
......
......@@ -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");
......
......@@ -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
......
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