Commit 963d2d43 authored by Satya B's avatar Satya B

Applying InnoDB Plugin 1.0.5 snapshot, part 6

From revision r5748 to r5783

Detailed revision comments:

r5748 | marko | 2009-09-03 06:05:44 -0500 (Thu, 03 Sep 2009) | 1 line
branches/zip: MLOG_MULTI_REC_END: Correct the comment.
r5751 | marko | 2009-09-03 09:36:15 -0500 (Thu, 03 Sep 2009) | 7 lines
branches/zip: row_merge(): Remove a bogus debug assertion
that was triggered when creating an index on an empty table.

row_merge_sort(): Add debug assertions and comments that justify
the loop termination condition.

The bogus assertion ut_ad(ihalf > 0) was reported by Michael.
r5752 | marko | 2009-09-03 09:55:51 -0500 (Thu, 03 Sep 2009) | 10 lines
branches/zip: recv_recover_page_func(): Write the log sequence number
to the compressed page, if there is one.  Previously, the function only
wrote the LSN to the uncompressed page.

It is not clear why recv_recover_page_func() is updating FIL_PAGE_LSN
in the buffer pool.  The log sequence number will be stamped on the
page when it is flushed to disk, in buf_flush_init_for_writing().
I noticed this inconsistency when analyzing Issue #313, but this patch
does not fix it.  That is no surprise, since FIL_PAGE_LSN should only
matter on disk files, not in the buffer pool.
r5775 | calvin | 2009-09-07 16:15:05 -0500 (Mon, 07 Sep 2009) | 13 lines
branches/zip: Build InnoDB on Windows with UNIV_HOTBACKUP

The changes are non-functional changes for normal InnoDB,
but needed for building the Hot Backup on Windows (with
UNIV_HOTBACKUP defined).

- Define os_aio_use_native_aio for HB.
- Do not acquire seek mutexes for backup since HB is single threaded.
- Do not use srv_flush_log_at_trx_commit for HB build

rb://155

Approved by: Marko
r5777 | marko | 2009-09-08 10:50:25 -0500 (Tue, 08 Sep 2009) | 2 lines
branches/zip: Remove BUF_LRU_INITIAL_RATIO, which should have been removed
together with buf_LRU_get_recent_limit().
r5779 | marko | 2009-09-09 01:17:19 -0500 (Wed, 09 Sep 2009) | 2 lines
branches/zip: buf_page_peek_if_too_old(): Make the bitmasking work when
buf_pool->freed_page_clock is wider than 32 bits.
r5780 | marko | 2009-09-09 01:50:50 -0500 (Wed, 09 Sep 2009) | 1 line
branches/zip: ut_time_ms(): Return ulint, not uint.
r5782 | marko | 2009-09-09 02:00:59 -0500 (Wed, 09 Sep 2009) | 2 lines
branches/zip: buf_page_peek_if_too_old(): Silence a compiler warning
that was introduced in r5779 on 32-bit systems.
r5783 | marko | 2009-09-09 02:25:00 -0500 (Wed, 09 Sep 2009) | 1 line
branches/zip: buf_page_is_accessed(): Correct the function comment.
parent d0b61c03
...@@ -66,11 +66,6 @@ allowed to point to either end of the LRU list. */ ...@@ -66,11 +66,6 @@ allowed to point to either end of the LRU list. */
# error "BUF_LRU_NON_OLD_MIN_LEN >= BUF_LRU_OLD_MIN_LEN" # error "BUF_LRU_NON_OLD_MIN_LEN >= BUF_LRU_OLD_MIN_LEN"
#endif #endif
/** The whole LRU list length is divided by this number to determine an
initial segment in buf_LRU_get_recent_limit */
#define BUF_LRU_INITIAL_RATIO 8
/** When dropping the search hash index entries before deleting an ibd /** When dropping the search hash index entries before deleting an ibd
file, we build a local array of pages belonging to that tablespace file, we build a local array of pages belonging to that tablespace
in the buffer pool. Following is the size of that array. */ in the buffer pool. Following is the size of that array. */
......
...@@ -807,8 +807,8 @@ buf_page_set_old( ...@@ -807,8 +807,8 @@ buf_page_set_old(
buf_page_t* bpage, /*!< in/out: control block */ buf_page_t* bpage, /*!< in/out: control block */
ibool old); /*!< in: old */ ibool old); /*!< in: old */
/*********************************************************************//** /*********************************************************************//**
Determine the time of last access a block in the buffer pool. Determine the time of first access of a block in the buffer pool.
@return ut_time_ms() at the time of last access, 0 if not accessed */ @return ut_time_ms() at the time of first access, 0 if not accessed */
UNIV_INLINE UNIV_INLINE
unsigned unsigned
buf_page_is_accessed( buf_page_is_accessed(
......
...@@ -84,7 +84,7 @@ buf_page_peek_if_too_old( ...@@ -84,7 +84,7 @@ buf_page_peek_if_too_old(
return(FALSE); return(FALSE);
} else { } else {
/* FIXME: bpage->freed_page_clock is 31 bits */ /* FIXME: bpage->freed_page_clock is 31 bits */
return((buf_pool->freed_page_clock & ~(1 << 31)) return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
> bpage->freed_page_clock > bpage->freed_page_clock
+ (buf_pool->curr_size + (buf_pool->curr_size
* (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio) * (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio)
...@@ -471,8 +471,8 @@ buf_page_set_old( ...@@ -471,8 +471,8 @@ buf_page_set_old(
} }
/*********************************************************************//** /*********************************************************************//**
Determine the time of last access a block in the buffer pool. Determine the time of first access of a block in the buffer pool.
@return ut_time_ms() at the time of last access, 0 if not accessed */ @return ut_time_ms() at the time of first access, 0 if not accessed */
UNIV_INLINE UNIV_INLINE
unsigned unsigned
buf_page_is_accessed( buf_page_is_accessed(
......
...@@ -118,7 +118,7 @@ For 1 - 8 bytes, the flag value must give the length also! @{ */ ...@@ -118,7 +118,7 @@ For 1 - 8 bytes, the flag value must give the length also! @{ */
#define MLOG_WRITE_STRING ((byte)30) /*!< write a string to #define MLOG_WRITE_STRING ((byte)30) /*!< write a string to
a page */ a page */
#define MLOG_MULTI_REC_END ((byte)31) /*!< if a single mtr writes #define MLOG_MULTI_REC_END ((byte)31) /*!< if a single mtr writes
log records for several pages, several log records,
this log record ends the this log record ends the
sequence of these records */ sequence of these records */
#define MLOG_DUMMY_RECORD ((byte)32) /*!< dummy log record used to #define MLOG_DUMMY_RECORD ((byte)32) /*!< dummy log record used to
......
...@@ -246,7 +246,7 @@ value may wrap around. It should only be used for heuristic ...@@ -246,7 +246,7 @@ value may wrap around. It should only be used for heuristic
purposes. purposes.
@return ms since epoch */ @return ms since epoch */
UNIV_INTERN UNIV_INTERN
uint ulint
ut_time_ms(void); ut_time_ms(void);
/*============*/ /*============*/
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
......
...@@ -1327,6 +1327,7 @@ recv_recover_page_func( ...@@ -1327,6 +1327,7 @@ recv_recover_page_func(
buf_block_t* block) /*!< in/out: buffer block */ buf_block_t* block) /*!< in/out: buffer block */
{ {
page_t* page; page_t* page;
page_zip_des_t* page_zip;
recv_addr_t* recv_addr; recv_addr_t* recv_addr;
recv_t* recv; recv_t* recv;
byte* buf; byte* buf;
...@@ -1376,6 +1377,7 @@ recv_recover_page_func( ...@@ -1376,6 +1377,7 @@ recv_recover_page_func(
mtr_set_log_mode(&mtr, MTR_LOG_NONE); mtr_set_log_mode(&mtr, MTR_LOG_NONE);
page = block->frame; page = block->frame;
page_zip = buf_block_get_page_zip(block);
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
if (just_read_in) { if (just_read_in) {
...@@ -1436,13 +1438,19 @@ recv_recover_page_func( ...@@ -1436,13 +1438,19 @@ recv_recover_page_func(
if (recv->type == MLOG_INIT_FILE_PAGE) { if (recv->type == MLOG_INIT_FILE_PAGE) {
page_lsn = page_newest_lsn; page_lsn = page_newest_lsn;
mach_write_ull(page + UNIV_PAGE_SIZE memset(FIL_PAGE_LSN + page, 0, 8);
- FIL_PAGE_END_LSN_OLD_CHKSUM, 0); memset(UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM
mach_write_ull(page + FIL_PAGE_LSN, 0); + page, 0, 8);
if (page_zip) {
memset(FIL_PAGE_LSN + page_zip->data, 0, 8);
}
} }
if (recv->start_lsn >= page_lsn) { if (recv->start_lsn >= page_lsn) {
ib_uint64_t end_lsn;
if (!modification_to_page) { if (!modification_to_page) {
modification_to_page = TRUE; modification_to_page = TRUE;
...@@ -1464,11 +1472,17 @@ recv_recover_page_func( ...@@ -1464,11 +1472,17 @@ recv_recover_page_func(
recv_parse_or_apply_log_rec_body(recv->type, buf, recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len, buf + recv->len,
block, &mtr); block, &mtr);
mach_write_ull(page + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM, end_lsn = recv->start_lsn + recv->len;
recv->start_lsn + recv->len); mach_write_ull(FIL_PAGE_LSN + page, end_lsn);
mach_write_ull(page + FIL_PAGE_LSN, mach_write_ull(UNIV_PAGE_SIZE
recv->start_lsn + recv->len); - FIL_PAGE_END_LSN_OLD_CHKSUM
+ page, end_lsn);
if (page_zip) {
mach_write_ull(FIL_PAGE_LSN
+ page_zip->data, end_lsn);
}
} }
if (recv->len > RECV_DATA_BLOCK_SIZE) { if (recv->len > RECV_DATA_BLOCK_SIZE) {
......
...@@ -88,7 +88,9 @@ UNIV_INTERN ibool os_do_not_call_flush_at_each_write = FALSE; ...@@ -88,7 +88,9 @@ UNIV_INTERN ibool os_do_not_call_flush_at_each_write = FALSE;
/* We do not call os_file_flush in every os_file_write. */ /* We do not call os_file_flush in every os_file_write. */
#endif /* UNIV_DO_FLUSH */ #endif /* UNIV_DO_FLUSH */
#ifndef UNIV_HOTBACKUP #ifdef UNIV_HOTBACKUP
# define os_aio_use_native_aio FALSE
#else /* UNIV_HOTBACKUP */
/* We use these mutexes to protect lseek + file i/o operation, if the /* We use these mutexes to protect lseek + file i/o operation, if the
OS does not provide an atomic pread or pwrite, or similar */ OS does not provide an atomic pread or pwrite, or similar */
#define OS_FILE_N_SEEK_MUTEXES 16 #define OS_FILE_N_SEEK_MUTEXES 16
...@@ -198,7 +200,7 @@ static ulint os_aio_n_segments = ULINT_UNDEFINED; ...@@ -198,7 +200,7 @@ static ulint os_aio_n_segments = ULINT_UNDEFINED;
/** If the following is TRUE, read i/o handler threads try to /** If the following is TRUE, read i/o handler threads try to
wait until a batch of new read requests have been posted */ wait until a batch of new read requests have been posted */
static ibool os_aio_recommend_sleep_for_read_threads = FALSE; static ibool os_aio_recommend_sleep_for_read_threads = FALSE;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_HOTBACKUP */
UNIV_INTERN ulint os_n_file_reads = 0; UNIV_INTERN ulint os_n_file_reads = 0;
UNIV_INTERN ulint os_bytes_read_since_printout = 0; UNIV_INTERN ulint os_bytes_read_since_printout = 0;
...@@ -1245,6 +1247,7 @@ os_file_create( ...@@ -1245,6 +1247,7 @@ os_file_create(
} }
#endif #endif
#ifdef UNIV_NON_BUFFERED_IO #ifdef UNIV_NON_BUFFERED_IO
# ifndef UNIV_HOTBACKUP
if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) { if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
/* Do not use unbuffered i/o to log files because /* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every value 2 denotes that we do not flush the log at every
...@@ -1253,10 +1256,14 @@ os_file_create( ...@@ -1253,10 +1256,14 @@ os_file_create(
== SRV_WIN_IO_UNBUFFERED) { == SRV_WIN_IO_UNBUFFERED) {
attributes = attributes | FILE_FLAG_NO_BUFFERING; attributes = attributes | FILE_FLAG_NO_BUFFERING;
} }
#endif # else /* !UNIV_HOTBACKUP */
attributes = attributes | FILE_FLAG_NO_BUFFERING;
# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_NON_BUFFERED_IO */
} else if (purpose == OS_FILE_NORMAL) { } else if (purpose == OS_FILE_NORMAL) {
attributes = 0; attributes = 0;
#ifdef UNIV_NON_BUFFERED_IO #ifdef UNIV_NON_BUFFERED_IO
# ifndef UNIV_HOTBACKUP
if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) { if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
/* Do not use unbuffered i/o to log files because /* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every value 2 denotes that we do not flush the log at every
...@@ -1265,7 +1272,10 @@ os_file_create( ...@@ -1265,7 +1272,10 @@ os_file_create(
== SRV_WIN_IO_UNBUFFERED) { == SRV_WIN_IO_UNBUFFERED) {
attributes = attributes | FILE_FLAG_NO_BUFFERING; attributes = attributes | FILE_FLAG_NO_BUFFERING;
} }
#endif # else /* !UNIV_HOTBACKUP */
attributes = attributes | FILE_FLAG_NO_BUFFERING;
# endif /* !UNIV_HOTBACKUP */
#endif /* UNIV_NON_BUFFERED_IO */
} else { } else {
attributes = 0; attributes = 0;
ut_error; ut_error;
...@@ -2227,7 +2237,9 @@ os_file_read( ...@@ -2227,7 +2237,9 @@ os_file_read(
DWORD low; DWORD low;
DWORD high; DWORD high;
ibool retry; ibool retry;
#ifndef UNIV_HOTBACKUP
ulint i; ulint i;
#endif /* !UNIV_HOTBACKUP */
ut_a((offset & 0xFFFFFFFFUL) == offset); ut_a((offset & 0xFFFFFFFFUL) == offset);
...@@ -2246,16 +2258,20 @@ os_file_read( ...@@ -2246,16 +2258,20 @@ os_file_read(
os_n_pending_reads++; os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex); os_mutex_exit(os_file_count_mutex);
#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */ /* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES; i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]); os_mutex_enter(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
ret2 = SetFilePointer(file, low, &high, FILE_BEGIN); ret2 = SetFilePointer(file, low, &high, FILE_BEGIN);
if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) { if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex); os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--; os_n_pending_reads--;
...@@ -2266,7 +2282,9 @@ os_file_read( ...@@ -2266,7 +2282,9 @@ os_file_read(
ret = ReadFile(file, buf, (DWORD) n, &len, NULL); ret = ReadFile(file, buf, (DWORD) n, &len, NULL);
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex); os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--; os_n_pending_reads--;
...@@ -2275,7 +2293,7 @@ os_file_read( ...@@ -2275,7 +2293,7 @@ os_file_read(
if (ret && len == n) { if (ret && len == n) {
return(TRUE); return(TRUE);
} }
#else #else /* __WIN__ */
ibool retry; ibool retry;
ssize_t ret; ssize_t ret;
...@@ -2294,7 +2312,7 @@ os_file_read( ...@@ -2294,7 +2312,7 @@ os_file_read(
"InnoDB: Was only able to read %ld.\n", "InnoDB: Was only able to read %ld.\n",
(ulong)n, (ulong)offset_high, (ulong)n, (ulong)offset_high,
(ulong)offset, (long)ret); (ulong)offset, (long)ret);
#endif #endif /* __WIN__ */
#ifdef __WIN__ #ifdef __WIN__
error_handling: error_handling:
#endif #endif
...@@ -2343,7 +2361,9 @@ os_file_read_no_error_handling( ...@@ -2343,7 +2361,9 @@ os_file_read_no_error_handling(
DWORD low; DWORD low;
DWORD high; DWORD high;
ibool retry; ibool retry;
#ifndef UNIV_HOTBACKUP
ulint i; ulint i;
#endif /* !UNIV_HOTBACKUP */
ut_a((offset & 0xFFFFFFFFUL) == offset); ut_a((offset & 0xFFFFFFFFUL) == offset);
...@@ -2362,16 +2382,20 @@ os_file_read_no_error_handling( ...@@ -2362,16 +2382,20 @@ os_file_read_no_error_handling(
os_n_pending_reads++; os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex); os_mutex_exit(os_file_count_mutex);
#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */ /* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES; i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]); os_mutex_enter(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
ret2 = SetFilePointer(file, low, &high, FILE_BEGIN); ret2 = SetFilePointer(file, low, &high, FILE_BEGIN);
if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) { if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex); os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--; os_n_pending_reads--;
...@@ -2382,7 +2406,9 @@ os_file_read_no_error_handling( ...@@ -2382,7 +2406,9 @@ os_file_read_no_error_handling(
ret = ReadFile(file, buf, (DWORD) n, &len, NULL); ret = ReadFile(file, buf, (DWORD) n, &len, NULL);
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex); os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--; os_n_pending_reads--;
...@@ -2391,7 +2417,7 @@ os_file_read_no_error_handling( ...@@ -2391,7 +2417,7 @@ os_file_read_no_error_handling(
if (ret && len == n) { if (ret && len == n) {
return(TRUE); return(TRUE);
} }
#else #else /* __WIN__ */
ibool retry; ibool retry;
ssize_t ret; ssize_t ret;
...@@ -2404,7 +2430,7 @@ os_file_read_no_error_handling( ...@@ -2404,7 +2430,7 @@ os_file_read_no_error_handling(
return(TRUE); return(TRUE);
} }
#endif #endif /* __WIN__ */
#ifdef __WIN__ #ifdef __WIN__
error_handling: error_handling:
#endif #endif
...@@ -2463,9 +2489,11 @@ os_file_write( ...@@ -2463,9 +2489,11 @@ os_file_write(
DWORD ret2; DWORD ret2;
DWORD low; DWORD low;
DWORD high; DWORD high;
ulint i;
ulint n_retries = 0; ulint n_retries = 0;
ulint err; ulint err;
#ifndef UNIV_HOTBACKUP
ulint i;
#endif /* !UNIV_HOTBACKUP */
ut_a((offset & 0xFFFFFFFF) == offset); ut_a((offset & 0xFFFFFFFF) == offset);
...@@ -2482,16 +2510,20 @@ os_file_write( ...@@ -2482,16 +2510,20 @@ os_file_write(
os_n_pending_writes++; os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex); os_mutex_exit(os_file_count_mutex);
#ifndef UNIV_HOTBACKUP
/* Protect the seek / write operation with a mutex */ /* Protect the seek / write operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES; i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]); os_mutex_enter(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
ret2 = SetFilePointer(file, low, &high, FILE_BEGIN); ret2 = SetFilePointer(file, low, &high, FILE_BEGIN);
if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) { if (ret2 == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex); os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--; os_n_pending_writes--;
...@@ -2525,7 +2557,9 @@ os_file_write( ...@@ -2525,7 +2557,9 @@ os_file_write(
} }
# endif /* UNIV_DO_FLUSH */ # endif /* UNIV_DO_FLUSH */
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex); os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--; os_n_pending_writes--;
......
...@@ -1576,7 +1576,6 @@ row_merge( ...@@ -1576,7 +1576,6 @@ row_merge(
ulint ohalf; /*!< half the output file */ ulint ohalf; /*!< half the output file */
UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]); UNIV_MEM_ASSERT_W(block[0], 3 * sizeof block[0]);
ut_ad(ihalf > 0);
ut_ad(ihalf < file->offset); ut_ad(ihalf < file->offset);
of.fd = *tmpfd; of.fd = *tmpfd;
...@@ -1665,6 +1664,10 @@ row_merge_sort( ...@@ -1665,6 +1664,10 @@ row_merge_sort(
{ {
ulint half = file->offset / 2; ulint half = file->offset / 2;
/* The file should always contain at least one byte (the end
of file marker). Thus, it must be at least one block. */
ut_ad(file->offset > 0);
do { do {
ulint error; ulint error;
...@@ -1673,6 +1676,10 @@ row_merge_sort( ...@@ -1673,6 +1676,10 @@ row_merge_sort(
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
return(error); return(error);
} }
/* half > 0 should hold except when the file consists
of one block. No need to merge further then. */
ut_ad(half > 0 || file->offset == 1);
} while (half < file->offset && half > 0); } while (half < file->offset && half > 0);
return(DB_SUCCESS); return(DB_SUCCESS);
......
...@@ -206,7 +206,7 @@ value may wrap around. It should only be used for heuristic ...@@ -206,7 +206,7 @@ value may wrap around. It should only be used for heuristic
purposes. purposes.
@return ms since epoch */ @return ms since epoch */
UNIV_INTERN UNIV_INTERN
uint ulint
ut_time_ms(void) ut_time_ms(void)
/*============*/ /*============*/
{ {
...@@ -214,7 +214,7 @@ ut_time_ms(void) ...@@ -214,7 +214,7 @@ ut_time_ms(void)
ut_gettimeofday(&tv, NULL); ut_gettimeofday(&tv, NULL);
return((uint) tv.tv_sec * 1000 + tv.tv_usec / 1000); return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000);
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
......
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