Commit 679d6e82 authored by marko's avatar marko

branches/zip: Remove compilation errors with -DUNIV_HOTBACKUP.

dict_load_foreigns(): Enclose in #ifndef UNIV_HOTBACKUP.

fil_extend_tablespaces_to_stored_len(): Pass zip_size to fil_read().

buf_page_init_for_backup_restore(): Add parameter zip_size.
Enclose the declaration in buf0buf.h in #ifdef UNIV_HOTBACKUP.

recv_apply_log_recs_for_backup(): Replace the local variable "page"
with the local variable "block".  Add local variable zip_size.
parent 8dfdfa40
......@@ -1600,6 +1600,8 @@ buf_page_init_for_backup_restore(
ulint space, /* in: space id */
ulint offset, /* in: offset of the page within space
in units of a page */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
buf_block_t* block) /* in: block to init */
{
/* Set the state of the block */
......@@ -1627,7 +1629,11 @@ buf_page_init_for_backup_restore(
block->n_bytes = 0;
block->left_side = TRUE;
page_zip_des_init(&block->page_zip);
/* TODO: allocate page_zip->data? */
/* We assume that block->page_zip.data has been allocated
with zip_size == UNIV_PAGE_SIZE. */
ut_ad(zip_size <= UNIV_PAGE_SIZE);
ut_ad(ut_is_2pow(zip_size));
block->page_zip.size = zip_size;
block->file_page_was_freed = FALSE;
}
......
......@@ -919,9 +919,9 @@ err_exit:
dict_table_add_to_cache(table);
dict_load_indexes(table, heap);
#ifndef UNIV_HOTBACKUP
err = dict_load_foreigns(table->name, TRUE);
#if 0
# if 0
if (err != DB_SUCCESS) {
mutex_enter(&dict_foreign_err_mutex);
......@@ -944,7 +944,8 @@ err_exit:
mutex_exit(&dict_foreign_err_mutex);
}
#endif /* 0 */
# endif /* 0 */
#endif /* !UNIV_HOTBACKUP */
mem_heap_free(heap);
return(table);
......@@ -1066,6 +1067,7 @@ dict_load_sys_table(
mem_heap_free(heap);
}
#ifndef UNIV_HOTBACKUP
/************************************************************************
Loads foreign key constraint col names (also for the referenced table). */
static
......@@ -1414,3 +1416,4 @@ load_next_index:
return(DB_SUCCESS);
}
#endif /* !UNIV_HOTBACKUP */
......@@ -3932,8 +3932,8 @@ fil_extend_tablespaces_to_stored_len(void)
mutex_exit(&(system->mutex)); /* no need to protect with a
mutex, because this is a
single-threaded operation */
error = fil_read(TRUE, space->id, 0, 0, UNIV_PAGE_SIZE, buf,
NULL);
error = fil_read(TRUE, space->id, space->zip_size,
0, 0, UNIV_PAGE_SIZE, buf, NULL);
ut_a(error == DB_SUCCESS);
size_in_header = fsp_get_size_low(buf);
......
......@@ -258,6 +258,7 @@ buf_page_create(
a page */
ulint zip_size,/* in: compressed page size, or 0 */
mtr_t* mtr); /* in: mini-transaction handle */
#ifdef UNIV_HOTBACKUP
/************************************************************************
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
......@@ -267,7 +268,10 @@ buf_page_init_for_backup_restore(
ulint space, /* in: space id */
ulint offset, /* in: offset of the page within space
in units of a page */
ulint zip_size,/* in: compressed page size in bytes
or 0 for uncompressed pages */
buf_block_t* block); /* in: block to init */
#endif /* UNIV_HOTBACKUP */
/************************************************************************
Decrements the bufferfix count of a buffer control block and releases
a latch, if specified. */
......
......@@ -70,6 +70,7 @@ void
dict_load_sys_table(
/*================*/
dict_table_t* table); /* in: system table */
#ifndef UNIV_HOTBACKUP
/***************************************************************************
Loads foreign key constraints where the table is either the foreign key
holder or where the table is referenced by a foreign key. Adds these
......@@ -84,6 +85,7 @@ dict_load_foreigns(
const char* table_name, /* in: table name */
ibool check_charsets);/* in: TRUE=check charsets
compatibility */
#endif /* !UNIV_HOTBACKUP */
/************************************************************************
Prints to the standard output information on all tables found in the data
dictionary system table. */
......
......@@ -1541,11 +1541,6 @@ loop:
}
#ifdef UNIV_HOTBACKUP
/* This page is allocated from the buffer pool and used in the function
below */
static page_t* recv_backup_application_page = NULL;
TODO: define recv_backup_application_page_zip;
/***********************************************************************
Applies log records in the hash table to a backup. */
......@@ -1555,7 +1550,7 @@ recv_apply_log_recs_for_backup(void)
{
recv_addr_t* recv_addr;
ulint n_hash_cells;
byte* page;
buf_block_t* block;
ulint actual_size;
ibool success;
ulint error;
......@@ -1564,11 +1559,7 @@ recv_apply_log_recs_for_backup(void)
recv_sys->apply_log_recs = TRUE;
recv_sys->apply_batch_on = TRUE;
if (recv_backup_application_page == NULL) {
recv_backup_application_page = buf_frame_alloc();
}
page = recv_backup_application_page;
block = buf_block_alloc(UNIV_PAGE_SIZE);
fputs("InnoDB: Starting an apply batch of log records"
" to the database...\n"
......@@ -1582,7 +1573,10 @@ recv_apply_log_recs_for_backup(void)
while (recv_addr != NULL) {
if (!fil_tablespace_exists_in_mem(recv_addr->space)) {
ulint zip_size
= fil_space_get_zip_size(recv_addr->space);
if (zip_size == ULINT_UNDEFINED) {
#if 0
fprintf(stderr,
"InnoDB: Warning: cannot apply"
......@@ -1608,7 +1602,7 @@ recv_apply_log_recs_for_backup(void)
buf_page_init_for_backup_restore(
recv_addr->space, recv_addr->page_no,
buf_block_align(page));
zip_size, block);
/* Extend the tablespace's last file if the page_no
does not fall inside its bounds; we assume the last
......@@ -1630,9 +1624,19 @@ recv_apply_log_recs_for_backup(void)
/* Read the page from the tablespace file using the
fil0fil.c routines */
error = fil_io(OS_FILE_READ, TRUE, recv_addr->space,
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
page, NULL);
if (zip_size) {
error = fil_io(OS_FILE_READ, TRUE,
recv_addr->space, zip_size,
recv_addr->page_no, 0, zip_size,
block->page_zip.data, NULL);
} else {
error = fil_io(OS_FILE_READ, TRUE,
recv_addr->space, 0,
recv_addr->page_no, 0,
UNIV_PAGE_SIZE,
block->frame, NULL);
}
if (error != DB_SUCCESS) {
fprintf(stderr,
"InnoDB: Fatal error: cannot read"
......@@ -1645,20 +1649,31 @@ recv_apply_log_recs_for_backup(void)
}
/* Apply the log records to this page */
recv_recover_page(TRUE, FALSE, page, recv_addr->space,
recv_recover_page(TRUE, FALSE, block->frame,
recv_addr->space,
recv_addr->page_no);
/* Write the page back to the tablespace file using the
fil0fil.c routines */
buf_flush_init_for_writing(
page, NULL,/* TODO: page_zip */
mach_read_from_8(page + FIL_PAGE_LSN),
block->frame, buf_block_get_page_zip(block),
mach_read_from_8(block->frame + FIL_PAGE_LSN),
recv_addr->space, recv_addr->page_no);
error = fil_io(OS_FILE_WRITE, TRUE, recv_addr->space,
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
page, NULL);
if (zip_size) {
error = fil_io(OS_FILE_WRITE, TRUE,
recv_addr->space, zip_size,
recv_addr->page_no, 0,
zip_size,
block->page_zip.data, NULL);
} else {
error = fil_io(OS_FILE_WRITE, TRUE,
recv_addr->space, 0,
recv_addr->page_no, 0,
UNIV_PAGE_SIZE,
block->frame, NULL);
}
skip_this_recv_addr:
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
}
......@@ -1671,6 +1686,7 @@ skip_this_recv_addr:
}
}
buf_block_free(block);
recv_sys_empty_hash();
}
#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