Commit 97c78130 authored by marko's avatar marko

branches/zip: Add parameter zip_size to fil_io().

fil_read(), fil_write(): Make these inlined functions in fil0fil.c.

fil_write_lsn_and_arch_no_to_file(): Remove the parameter space_id and
note that this function is to be called on the system tablespace, which
is uncompressed.
parent 11fefe4d
...@@ -305,7 +305,7 @@ corrupted_page: ...@@ -305,7 +305,7 @@ corrupted_page:
write_buf = trx_doublewrite->write_buf; write_buf = trx_doublewrite->write_buf;
i = 0; i = 0;
fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, 0,
trx_doublewrite->block1, 0, len, trx_doublewrite->block1, 0, len,
(void*) write_buf, NULL); (void*) write_buf, NULL);
...@@ -335,7 +335,7 @@ corrupted_page: ...@@ -335,7 +335,7 @@ corrupted_page:
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE; + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
ut_ad(i == TRX_SYS_DOUBLEWRITE_BLOCK_SIZE); ut_ad(i == TRX_SYS_DOUBLEWRITE_BLOCK_SIZE);
fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, 0,
trx_doublewrite->block2, 0, len, trx_doublewrite->block2, 0, len,
(void*) write_buf, NULL); (void*) write_buf, NULL);
...@@ -367,14 +367,10 @@ flush: ...@@ -367,14 +367,10 @@ flush:
block = trx_doublewrite->buf_block_arr[i]; block = trx_doublewrite->buf_block_arr[i];
ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (UNIV_UNLIKELY(block->page_zip.size)) { if (UNIV_UNLIKELY(block->page_zip.size)) {
ulint blk_size
= UNIV_PAGE_SIZE / block->page_zip.size;
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, FALSE, block->space,
block->offset / blk_size, block->page_zip.size,
(block->offset % blk_size) block->offset, 0,
* block->page_zip.size,
block->page_zip.size, block->page_zip.size,
(void*)block->page_zip.data, (void*)block->page_zip.data,
(void*)block); (void*)block);
...@@ -395,8 +391,9 @@ flush: ...@@ -395,8 +391,9 @@ flush:
} }
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE, FALSE, block->space, 0,
(void*)block->frame, (void*)block); block->offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
} }
/* Wake possible simulated aio thread to actually post the /* Wake possible simulated aio thread to actually post the
...@@ -605,8 +602,10 @@ buf_flush_write_block_low( ...@@ -605,8 +602,10 @@ buf_flush_write_block_low(
block->space, block->offset); block->space, block->offset);
if (!srv_use_doublewrite_buf || !trx_doublewrite) { if (!srv_use_doublewrite_buf || !trx_doublewrite) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE, FALSE, block->space, block->page_zip.size,
(void*)block->frame, (void*)block); block->offset, 0, block->page_zip.size
? block->page_zip.size : UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block);
} else { } else {
buf_flush_post_to_doublewrite_buf(block); buf_flush_post_to_doublewrite_buf(block);
} }
......
...@@ -142,17 +142,12 @@ buf_read_page_low( ...@@ -142,17 +142,12 @@ buf_read_page_low(
ut_a(block->state == BUF_BLOCK_FILE_PAGE); ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (zip_size) { if (zip_size) {
ulint zip_blk = UNIV_PAGE_SIZE / zip_size;
*err = fil_io(OS_FILE_READ | wake_later, *err = fil_io(OS_FILE_READ | wake_later,
sync, space, sync, space, zip_size, offset, 0, zip_size,
offset / zip_blk, (offset % zip_blk)
* zip_size, zip_size,
(void*)block->page_zip.data, (void*)block); (void*)block->page_zip.data, (void*)block);
} else { } else {
*err = fil_io(OS_FILE_READ | wake_later, *err = fil_io(OS_FILE_READ | wake_later,
sync, space, sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
offset, 0, UNIV_PAGE_SIZE,
(void*)block->frame, (void*)block); (void*)block->frame, (void*)block);
} }
ut_a(*err == DB_SUCCESS); ut_a(*err == DB_SUCCESS);
......
...@@ -294,6 +294,65 @@ fil_get_space_id_for_table( ...@@ -294,6 +294,65 @@ fil_get_space_id_for_table(
found */ found */
const char* name); /* in: table name in the standard const char* name); /* in: table name in the standard
'databasename/tablename' format */ 'databasename/tablename' format */
/************************************************************************
Reads data from a space to a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
calculating the byte offset within a space. */
UNIV_INLINE
ulint
fil_read(
/*=====*/
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace
which does not exist */
ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in aio
this must be divisible by the OS block size */
ulint len, /* in: how many bytes to read; this must not
cross a file boundary; in aio this must be a
block size multiple */
void* buf, /* in/out: buffer where to store data read;
in aio this must be appropriately aligned */
void* message) /* in: message for aio handler if non-sync
aio used, else ignored */
{
return(fil_io(OS_FILE_READ, sync, space_id, zip_size, block_offset,
byte_offset, len, buf, message));
}
/************************************************************************
Writes data to a space from a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
calculating the byte offset within a space. */
UNIV_INLINE
ulint
fil_write(
/*======*/
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace
which does not exist */
ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in aio
this must be divisible by the OS block size */
ulint len, /* in: how many bytes to write; this must
not cross a file boundary; in aio this must
be a block size multiple */
void* buf, /* in: buffer from which to write; in aio
this must be appropriately aligned */
void* message) /* in: message for aio handler if non-sync
aio used, else ignored */
{
return(fil_io(OS_FILE_WRITE, sync, space_id, zip_size, block_offset,
byte_offset, len, buf, message));
}
/*********************************************************************** /***********************************************************************
...@@ -1526,12 +1585,12 @@ fil_ibuf_init_at_db_start(void) ...@@ -1526,12 +1585,12 @@ fil_ibuf_init_at_db_start(void)
/******************************************************************** /********************************************************************
Writes the flushed lsn and the latest archived log number to the page header Writes the flushed lsn and the latest archived log number to the page header
of the first page of a data file. */ of the first page of a data file of the system tablespace (space 0),
which is uncompressed. */
static static
ulint ulint
fil_write_lsn_and_arch_no_to_file( fil_write_lsn_and_arch_no_to_file(
/*==============================*/ /*==============================*/
ulint space_id, /* in: space number */
ulint sum_of_sizes, /* in: combined size of previous files in ulint sum_of_sizes, /* in: combined size of previous files in
space, in database pages */ space, in database pages */
dulint lsn, /* in: lsn to write */ dulint lsn, /* in: lsn to write */
...@@ -1544,11 +1603,11 @@ fil_write_lsn_and_arch_no_to_file( ...@@ -1544,11 +1603,11 @@ fil_write_lsn_and_arch_no_to_file(
buf1 = mem_alloc(2 * UNIV_PAGE_SIZE); buf1 = mem_alloc(2 * UNIV_PAGE_SIZE);
buf = ut_align(buf1, UNIV_PAGE_SIZE); buf = ut_align(buf1, UNIV_PAGE_SIZE);
fil_read(TRUE, space_id, 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_to_8(buf + FIL_PAGE_FILE_FLUSH_LSN, lsn);
fil_write(TRUE, space_id, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL); fil_write(TRUE, 0, 0, sum_of_sizes, 0, UNIV_PAGE_SIZE, buf, NULL);
return(DB_SUCCESS); return(DB_SUCCESS);
} }
...@@ -1589,7 +1648,7 @@ fil_write_flushed_lsn_to_data_files( ...@@ -1589,7 +1648,7 @@ fil_write_flushed_lsn_to_data_files(
mutex_exit(&(fil_system->mutex)); mutex_exit(&(fil_system->mutex));
err = fil_write_lsn_and_arch_no_to_file( err = fil_write_lsn_and_arch_no_to_file(
space->id, sum_of_sizes, sum_of_sizes,
lsn, arch_log_no); lsn, arch_log_no);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
...@@ -3993,6 +4052,8 @@ fil_io( ...@@ -3993,6 +4052,8 @@ fil_io(
caution! */ caution! */
ibool sync, /* in: TRUE if synchronous aio is desired */ ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */ ulint space_id, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint block_offset, /* in: offset in number of blocks */ ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in ulint byte_offset, /* in: remainder of offset in bytes; in
aio this must be divisible by the OS block aio this must be divisible by the OS block
...@@ -4023,15 +4084,19 @@ fil_io( ...@@ -4023,15 +4084,19 @@ fil_io(
type = type & ~OS_AIO_SIMULATED_WAKE_LATER; type = type & ~OS_AIO_SIMULATED_WAKE_LATER;
ut_ad(byte_offset < UNIV_PAGE_SIZE); ut_ad(byte_offset < UNIV_PAGE_SIZE);
ut_ad(!zip_size || !byte_offset);
ut_ad(ut_is_2pow(zip_size));
ut_ad(buf); ut_ad(buf);
ut_ad(len > 0); ut_ad(len > 0);
ut_a((1 << UNIV_PAGE_SIZE_SHIFT) == UNIV_PAGE_SIZE); #if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
#endif
ut_ad(fil_validate()); ut_ad(fil_validate());
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
/* ibuf bitmap pages must be read in the sync aio mode: */ /* ibuf bitmap pages must be read in the sync aio mode: */
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE) ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
|| !ibuf_bitmap_page(fil_space_get_zip_size(space_id), || !ibuf_bitmap_page(zip_size, block_offset)
block_offset) || sync || is_log); || sync || is_log);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE) ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
|| ibuf_page(space_id, block_offset)); || ibuf_page(space_id, block_offset));
...@@ -4121,12 +4186,30 @@ fil_io( ...@@ -4121,12 +4186,30 @@ fil_io(
/* Calculate the low 32 bits and the high 32 bits of the file offset */ /* Calculate the low 32 bits and the high 32 bits of the file offset */
offset_high = (block_offset >> (32 - UNIV_PAGE_SIZE_SHIFT)); if (!zip_size) {
offset_low = ((block_offset << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL) offset_high = (block_offset >> (32 - UNIV_PAGE_SIZE_SHIFT));
+ byte_offset; offset_low = ((block_offset << UNIV_PAGE_SIZE_SHIFT)
& 0xFFFFFFFFUL) + byte_offset;
ut_a(node->size - block_offset >= ut_a(node->size - block_offset
(byte_offset + len + (UNIV_PAGE_SIZE - 1)) / UNIV_PAGE_SIZE); >= (byte_offset + len + (UNIV_PAGE_SIZE - 1))
/ UNIV_PAGE_SIZE);
} else {
ulint zip_size_shift;
switch (zip_size) {
case 1024: zip_size_shift = 10; break;
case 2048: zip_size_shift = 11; break;
case 4096: zip_size_shift = 12; break;
case 8192: zip_size_shift = 13; break;
case 16384: zip_size_shift = 14; break;
default: ut_error;
}
offset_high = block_offset >> (32 - zip_size_shift);
offset_low = (block_offset << zip_size_shift & 0xFFFFFFFFUL)
+ byte_offset;
ut_a(node->size - block_offset
>= (len + (zip_size - 1)) / zip_size);
}
/* Do aio */ /* Do aio */
...@@ -4165,62 +4248,6 @@ fil_io( ...@@ -4165,62 +4248,6 @@ fil_io(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/************************************************************************
Reads data from a space to a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
calculating the byte offset within a space. */
ulint
fil_read(
/*=====*/
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace
which does not exist */
ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */
ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in aio
this must be divisible by the OS block size */
ulint len, /* in: how many bytes to read; this must not
cross a file boundary; in aio this must be a
block size multiple */
void* buf, /* in/out: buffer where to store data read;
in aio this must be appropriately aligned */
void* message) /* in: message for aio handler if non-sync
aio used, else ignored */
{
return(fil_io(OS_FILE_READ, sync, space_id, block_offset,
byte_offset, len, buf, message));
}
/************************************************************************
Writes data to a space from a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
calculating the byte offset within a space. */
ulint
fil_write(
/*======*/
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace
which does not exist */
ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */
ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in aio
this must be divisible by the OS block size */
ulint len, /* in: how many bytes to write; this must
not cross a file boundary; in aio this must
be a block size multiple */
void* buf, /* in: buffer from which to write; in aio
this must be appropriately aligned */
void* message) /* in: message for aio handler if non-sync
aio used, else ignored */
{
return(fil_io(OS_FILE_WRITE, sync, space_id, block_offset,
byte_offset, len, buf, message));
}
/************************************************************************** /**************************************************************************
Waits for an aio operation to complete. This function is used to write the Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided handler for completed requests. The aio array of pending requests is divided
......
...@@ -603,6 +603,8 @@ fil_io( ...@@ -603,6 +603,8 @@ fil_io(
caution! */ caution! */
ibool sync, /* in: TRUE if synchronous aio is desired */ ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */ ulint space_id, /* in: space id */
ulint zip_size, /* in: compressed page size in bytes;
0 for uncompressed pages */
ulint block_offset, /* in: offset in number of blocks */ ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in ulint byte_offset, /* in: remainder of offset in bytes; in
aio this must be divisible by the OS block aio this must be divisible by the OS block
...@@ -615,52 +617,6 @@ fil_io( ...@@ -615,52 +617,6 @@ fil_io(
appropriately aligned */ appropriately aligned */
void* message); /* in: message for aio handler if non-sync void* message); /* in: message for aio handler if non-sync
aio used, else ignored */ aio used, else ignored */
/************************************************************************
Reads data from a space to a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
calculating the byte offset within a space. */
ulint
fil_read(
/*=====*/
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace
which does not exist */
ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */
ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in aio
this must be divisible by the OS block size */
ulint len, /* in: how many bytes to read; this must not
cross a file boundary; in aio this must be a
block size multiple */
void* buf, /* in/out: buffer where to store data read;
in aio this must be appropriately aligned */
void* message); /* in: message for aio handler if non-sync
aio used, else ignored */
/************************************************************************
Writes data to a space from a buffer. Remember that the possible incomplete
blocks at the end of file are ignored: they are not taken into account when
calculating the byte offset within a space. */
ulint
fil_write(
/*======*/
/* out: DB_SUCCESS, or DB_TABLESPACE_DELETED
if we are trying to do i/o on a tablespace
which does not exist */
ibool sync, /* in: TRUE if synchronous aio is desired */
ulint space_id, /* in: space id */
ulint block_offset, /* in: offset in number of blocks */
ulint byte_offset, /* in: remainder of offset in bytes; in aio
this must be divisible by the OS block size */
ulint len, /* in: how many bytes to write; this must
not cross a file boundary; in aio this must
be a block size multiple */
void* buf, /* in: buffer from which to write; in aio
this must be appropriately aligned */
void* message); /* in: message for aio handler if non-sync
aio used, else ignored */
/************************************************************************** /**************************************************************************
Waits for an aio operation to complete. This function is used to write the Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided handler for completed requests. The aio array of pending requests is divided
......
...@@ -1146,7 +1146,7 @@ log_group_file_header_flush( ...@@ -1146,7 +1146,7 @@ log_group_file_header_flush(
srv_os_log_pending_writes++; srv_os_log_pending_writes++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id, fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id, 0,
dest_offset / UNIV_PAGE_SIZE, dest_offset / UNIV_PAGE_SIZE,
dest_offset % UNIV_PAGE_SIZE, dest_offset % UNIV_PAGE_SIZE,
OS_FILE_LOG_BLOCK_SIZE, OS_FILE_LOG_BLOCK_SIZE,
...@@ -1266,7 +1266,7 @@ loop: ...@@ -1266,7 +1266,7 @@ loop:
srv_os_log_pending_writes++; srv_os_log_pending_writes++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id, fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id, 0,
next_offset / UNIV_PAGE_SIZE, next_offset / UNIV_PAGE_SIZE,
next_offset % UNIV_PAGE_SIZE, write_len, buf, group); next_offset % UNIV_PAGE_SIZE, write_len, buf, group);
...@@ -1791,7 +1791,7 @@ log_group_checkpoint( ...@@ -1791,7 +1791,7 @@ log_group_checkpoint(
added with 1, as we want to distinguish between a normal log added with 1, as we want to distinguish between a normal log
file write and a checkpoint field write */ file write and a checkpoint field write */
fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->space_id, fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->space_id, 0,
write_offset / UNIV_PAGE_SIZE, write_offset / UNIV_PAGE_SIZE,
write_offset % UNIV_PAGE_SIZE, write_offset % UNIV_PAGE_SIZE,
OS_FILE_LOG_BLOCK_SIZE, OS_FILE_LOG_BLOCK_SIZE,
...@@ -1868,7 +1868,7 @@ log_group_read_checkpoint_info( ...@@ -1868,7 +1868,7 @@ log_group_read_checkpoint_info(
log_sys->n_log_ios++; log_sys->n_log_ios++;
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->space_id, fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->space_id, 0,
field / UNIV_PAGE_SIZE, field % UNIV_PAGE_SIZE, field / UNIV_PAGE_SIZE, field % UNIV_PAGE_SIZE,
OS_FILE_LOG_BLOCK_SIZE, log_sys->checkpoint_buf, NULL); OS_FILE_LOG_BLOCK_SIZE, log_sys->checkpoint_buf, NULL);
} }
...@@ -2172,7 +2172,7 @@ loop: ...@@ -2172,7 +2172,7 @@ loop:
log_sys->n_log_ios++; log_sys->n_log_ios++;
fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0,
source_offset / UNIV_PAGE_SIZE, source_offset % UNIV_PAGE_SIZE, source_offset / UNIV_PAGE_SIZE, source_offset % UNIV_PAGE_SIZE,
len, buf, NULL); len, buf, NULL);
......
...@@ -2670,7 +2670,7 @@ recv_recovery_from_checkpoint_start( ...@@ -2670,7 +2670,7 @@ recv_recovery_from_checkpoint_start(
/* Read the first log file header to print a note if this is /* Read the first log file header to print a note if this is
a recovery from a restored InnoDB Hot Backup */ a recovery from a restored InnoDB Hot Backup */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, max_cp_group->space_id, fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, max_cp_group->space_id, 0,
0, 0, LOG_FILE_HDR_SIZE, 0, 0, LOG_FILE_HDR_SIZE,
log_hdr_buf, max_cp_group); log_hdr_buf, max_cp_group);
...@@ -2691,7 +2691,7 @@ recv_recovery_from_checkpoint_start( ...@@ -2691,7 +2691,7 @@ recv_recovery_from_checkpoint_start(
' ', 4); ' ', 4);
/* Write to the log file to wipe over the label */ /* Write to the log file to wipe over the label */
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE,
max_cp_group->space_id, max_cp_group->space_id, 0,
0, 0, OS_FILE_LOG_BLOCK_SIZE, 0, 0, OS_FILE_LOG_BLOCK_SIZE,
log_hdr_buf, max_cp_group); log_hdr_buf, max_cp_group);
} }
......
...@@ -360,7 +360,7 @@ trx_sys_doublewrite_init_or_restore_pages( ...@@ -360,7 +360,7 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Read the trx sys header to check if we are using the doublewrite /* Read the trx sys header to check if we are using the doublewrite
buffer */ buffer */
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, TRX_SYS_PAGE_NO, 0, fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, 0,
UNIV_PAGE_SIZE, read_buf, NULL); UNIV_PAGE_SIZE, read_buf, NULL);
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE; doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
...@@ -397,10 +397,10 @@ trx_sys_doublewrite_init_or_restore_pages( ...@@ -397,10 +397,10 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Read the pages from the doublewrite buffer to memory */ /* Read the pages from the doublewrite buffer to memory */
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, block1, 0, fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block1, 0,
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
buf, NULL); buf, NULL);
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, block2, 0, fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block2, 0,
TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE, buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
NULL); NULL);
...@@ -429,7 +429,7 @@ trx_sys_doublewrite_init_or_restore_pages( ...@@ -429,7 +429,7 @@ trx_sys_doublewrite_init_or_restore_pages(
+ i - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE; + i - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE;
} }
fil_io(OS_FILE_WRITE, TRUE, 0, source_page_no, 0, fil_io(OS_FILE_WRITE, TRUE, 0, 0, source_page_no, 0,
UNIV_PAGE_SIZE, page, NULL); UNIV_PAGE_SIZE, page, NULL);
/* printf("Resetting space id in page %lu\n", /* printf("Resetting space id in page %lu\n",
source_page_no); */ source_page_no); */
...@@ -464,28 +464,13 @@ trx_sys_doublewrite_init_or_restore_pages( ...@@ -464,28 +464,13 @@ trx_sys_doublewrite_init_or_restore_pages(
/* It is an unwritten doublewrite buffer page: /* It is an unwritten doublewrite buffer page:
do nothing */ do nothing */
} else { } else {
ulint zip_size; ulint zip_size = fil_space_get_zip_size(space_id);
ulint zip_blk;
if (space_id) { /* Read in the actual page from the file */
zip_size = fil_space_get_zip_size(space_id); fil_io(OS_FILE_READ, TRUE, space_id, zip_size,
if (UNIV_LIKELY(!zip_size)) { page_no, 0, zip_size
goto read_uncompressed; ? zip_size : UNIV_PAGE_SIZE,
} read_buf, NULL);
zip_blk = UNIV_PAGE_SIZE / zip_size;
/* Read in the actual page from the file */
fil_io(OS_FILE_READ, TRUE, space_id,
page_no / zip_blk,
(page_no % zip_blk)
* zip_size, zip_size, read_buf, NULL);
} else {
read_uncompressed:
zip_size = 0;
zip_blk = 1;
/* Read in the actual page from the file */
fil_io(OS_FILE_READ, TRUE, space_id, page_no,
0, UNIV_PAGE_SIZE, read_buf, NULL);
}
/* Check if the page is corrupt */ /* Check if the page is corrupt */
...@@ -519,17 +504,10 @@ read_uncompressed: ...@@ -519,17 +504,10 @@ read_uncompressed:
doublewrite buffer to the intended doublewrite buffer to the intended
position */ position */
if (zip_size) { fil_io(OS_FILE_WRITE, TRUE, space_id, zip_size,
fil_io(OS_FILE_WRITE, TRUE, space_id, page_no, 0, zip_size
page_no / zip_blk, ? zip_size : UNIV_PAGE_SIZE,
(page_no % zip_blk)
* zip_size, zip_size,
page, NULL); page, NULL);
} else {
fil_io(OS_FILE_WRITE, TRUE, space_id,
page_no, 0,
UNIV_PAGE_SIZE, page, NULL);
}
fprintf(stderr, fprintf(stderr,
"InnoDB: Recovered the page from the doublewrite buffer.\n"); "InnoDB: Recovered the page from the doublewrite buffer.\n");
} }
......
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