mirror of
https://github.com/MariaDB/server.git
synced 2025-12-13 20:03:16 +03:00
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.
This commit is contained in:
@@ -1600,6 +1600,8 @@ buf_page_init_for_backup_restore(
|
|||||||
ulint space, /* in: space id */
|
ulint space, /* in: space id */
|
||||||
ulint offset, /* in: offset of the page within space
|
ulint offset, /* in: offset of the page within space
|
||||||
in units of a page */
|
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 */
|
buf_block_t* block) /* in: block to init */
|
||||||
{
|
{
|
||||||
/* Set the state of the block */
|
/* Set the state of the block */
|
||||||
@@ -1627,7 +1629,11 @@ buf_page_init_for_backup_restore(
|
|||||||
block->n_bytes = 0;
|
block->n_bytes = 0;
|
||||||
block->left_side = TRUE;
|
block->left_side = TRUE;
|
||||||
page_zip_des_init(&block->page_zip);
|
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;
|
block->file_page_was_freed = FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -919,7 +919,7 @@ err_exit:
|
|||||||
dict_table_add_to_cache(table);
|
dict_table_add_to_cache(table);
|
||||||
|
|
||||||
dict_load_indexes(table, heap);
|
dict_load_indexes(table, heap);
|
||||||
|
#ifndef UNIV_HOTBACKUP
|
||||||
err = dict_load_foreigns(table->name, TRUE);
|
err = dict_load_foreigns(table->name, TRUE);
|
||||||
# if 0
|
# if 0
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
@@ -945,6 +945,7 @@ err_exit:
|
|||||||
mutex_exit(&dict_foreign_err_mutex);
|
mutex_exit(&dict_foreign_err_mutex);
|
||||||
}
|
}
|
||||||
# endif /* 0 */
|
# endif /* 0 */
|
||||||
|
#endif /* !UNIV_HOTBACKUP */
|
||||||
mem_heap_free(heap);
|
mem_heap_free(heap);
|
||||||
|
|
||||||
return(table);
|
return(table);
|
||||||
@@ -1066,6 +1067,7 @@ dict_load_sys_table(
|
|||||||
mem_heap_free(heap);
|
mem_heap_free(heap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef UNIV_HOTBACKUP
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Loads foreign key constraint col names (also for the referenced table). */
|
Loads foreign key constraint col names (also for the referenced table). */
|
||||||
static
|
static
|
||||||
@@ -1414,3 +1416,4 @@ load_next_index:
|
|||||||
|
|
||||||
return(DB_SUCCESS);
|
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_exit(&(system->mutex)); /* no need to protect with a
|
||||||
mutex, because this is a
|
mutex, because this is a
|
||||||
single-threaded operation */
|
single-threaded operation */
|
||||||
error = fil_read(TRUE, space->id, 0, 0, UNIV_PAGE_SIZE, buf,
|
error = fil_read(TRUE, space->id, space->zip_size,
|
||||||
NULL);
|
0, 0, UNIV_PAGE_SIZE, buf, NULL);
|
||||||
ut_a(error == DB_SUCCESS);
|
ut_a(error == DB_SUCCESS);
|
||||||
|
|
||||||
size_in_header = fsp_get_size_low(buf);
|
size_in_header = fsp_get_size_low(buf);
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ buf_page_create(
|
|||||||
a page */
|
a page */
|
||||||
ulint zip_size,/* in: compressed page size, or 0 */
|
ulint zip_size,/* in: compressed page size, or 0 */
|
||||||
mtr_t* mtr); /* in: mini-transaction handle */
|
mtr_t* mtr); /* in: mini-transaction handle */
|
||||||
|
#ifdef UNIV_HOTBACKUP
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
|
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 space, /* in: space id */
|
||||||
ulint offset, /* in: offset of the page within space
|
ulint offset, /* in: offset of the page within space
|
||||||
in units of a page */
|
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 */
|
buf_block_t* block); /* in: block to init */
|
||||||
|
#endif /* UNIV_HOTBACKUP */
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Decrements the bufferfix count of a buffer control block and releases
|
Decrements the bufferfix count of a buffer control block and releases
|
||||||
a latch, if specified. */
|
a latch, if specified. */
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void
|
|||||||
dict_load_sys_table(
|
dict_load_sys_table(
|
||||||
/*================*/
|
/*================*/
|
||||||
dict_table_t* table); /* in: system table */
|
dict_table_t* table); /* in: system table */
|
||||||
|
#ifndef UNIV_HOTBACKUP
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Loads foreign key constraints where the table is either the foreign key
|
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
|
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 */
|
const char* table_name, /* in: table name */
|
||||||
ibool check_charsets);/* in: TRUE=check charsets
|
ibool check_charsets);/* in: TRUE=check charsets
|
||||||
compatibility */
|
compatibility */
|
||||||
|
#endif /* !UNIV_HOTBACKUP */
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Prints to the standard output information on all tables found in the data
|
Prints to the standard output information on all tables found in the data
|
||||||
dictionary system table. */
|
dictionary system table. */
|
||||||
|
|||||||
@@ -1541,11 +1541,6 @@ loop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_HOTBACKUP
|
#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. */
|
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;
|
recv_addr_t* recv_addr;
|
||||||
ulint n_hash_cells;
|
ulint n_hash_cells;
|
||||||
byte* page;
|
buf_block_t* block;
|
||||||
ulint actual_size;
|
ulint actual_size;
|
||||||
ibool success;
|
ibool success;
|
||||||
ulint error;
|
ulint error;
|
||||||
@@ -1564,11 +1559,7 @@ recv_apply_log_recs_for_backup(void)
|
|||||||
recv_sys->apply_log_recs = TRUE;
|
recv_sys->apply_log_recs = TRUE;
|
||||||
recv_sys->apply_batch_on = TRUE;
|
recv_sys->apply_batch_on = TRUE;
|
||||||
|
|
||||||
if (recv_backup_application_page == NULL) {
|
block = buf_block_alloc(UNIV_PAGE_SIZE);
|
||||||
recv_backup_application_page = buf_frame_alloc();
|
|
||||||
}
|
|
||||||
|
|
||||||
page = recv_backup_application_page;
|
|
||||||
|
|
||||||
fputs("InnoDB: Starting an apply batch of log records"
|
fputs("InnoDB: Starting an apply batch of log records"
|
||||||
" to the database...\n"
|
" to the database...\n"
|
||||||
@@ -1582,7 +1573,10 @@ recv_apply_log_recs_for_backup(void)
|
|||||||
|
|
||||||
while (recv_addr != NULL) {
|
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
|
#if 0
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Warning: cannot apply"
|
"InnoDB: Warning: cannot apply"
|
||||||
@@ -1608,7 +1602,7 @@ recv_apply_log_recs_for_backup(void)
|
|||||||
|
|
||||||
buf_page_init_for_backup_restore(
|
buf_page_init_for_backup_restore(
|
||||||
recv_addr->space, recv_addr->page_no,
|
recv_addr->space, recv_addr->page_no,
|
||||||
buf_block_align(page));
|
zip_size, block);
|
||||||
|
|
||||||
/* Extend the tablespace's last file if the page_no
|
/* Extend the tablespace's last file if the page_no
|
||||||
does not fall inside its bounds; we assume the last
|
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
|
/* Read the page from the tablespace file using the
|
||||||
fil0fil.c routines */
|
fil0fil.c routines */
|
||||||
|
|
||||||
error = fil_io(OS_FILE_READ, TRUE, recv_addr->space,
|
if (zip_size) {
|
||||||
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
|
error = fil_io(OS_FILE_READ, TRUE,
|
||||||
page, NULL);
|
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) {
|
if (error != DB_SUCCESS) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Fatal error: cannot read"
|
"InnoDB: Fatal error: cannot read"
|
||||||
@@ -1645,20 +1649,31 @@ recv_apply_log_recs_for_backup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the log records to this page */
|
/* 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);
|
recv_addr->page_no);
|
||||||
|
|
||||||
/* Write the page back to the tablespace file using the
|
/* Write the page back to the tablespace file using the
|
||||||
fil0fil.c routines */
|
fil0fil.c routines */
|
||||||
|
|
||||||
buf_flush_init_for_writing(
|
buf_flush_init_for_writing(
|
||||||
page, NULL,/* TODO: page_zip */
|
block->frame, buf_block_get_page_zip(block),
|
||||||
mach_read_from_8(page + FIL_PAGE_LSN),
|
mach_read_from_8(block->frame + FIL_PAGE_LSN),
|
||||||
recv_addr->space, recv_addr->page_no);
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
error = fil_io(OS_FILE_WRITE, TRUE, recv_addr->space,
|
if (zip_size) {
|
||||||
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
|
error = fil_io(OS_FILE_WRITE, TRUE,
|
||||||
page, NULL);
|
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:
|
skip_this_recv_addr:
|
||||||
recv_addr = HASH_GET_NEXT(addr_hash, 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();
|
recv_sys_empty_hash();
|
||||||
}
|
}
|
||||||
#endif /* UNIV_HOTBACKUP */
|
#endif /* UNIV_HOTBACKUP */
|
||||||
|
|||||||
Reference in New Issue
Block a user