summaryrefslogtreecommitdiff
path: root/innobase/log/log0recv.c
diff options
context:
space:
mode:
authormarko@hundin.mysql.fi <>2004-05-27 15:27:43 +0300
committermarko@hundin.mysql.fi <>2004-05-27 15:27:43 +0300
commitfc85c80b88c0717684184f22a91f8b027a8f8559 (patch)
tree566268309e7e64b4e2f6a23700e7b8623521cbbd /innobase/log/log0recv.c
parente27322d8264c56e2f86435c6f6b1f80dbb448f1c (diff)
downloadmariadb-git-fc85c80b88c0717684184f22a91f8b027a8f8559.tar.gz
InnoDB cleanup:
Disable log archiving code unless #ifdef UNIV_LOG_ARCHIVE Remove (char*) casts of string constants; add const qualifiers Remove some Hot Backup code unless #ifdef UNIV_HOTBACKUP
Diffstat (limited to 'innobase/log/log0recv.c')
-rw-r--r--innobase/log/log0recv.c70
1 files changed, 46 insertions, 24 deletions
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c
index ff92335188d..49d537d23db 100644
--- a/innobase/log/log0recv.c
+++ b/innobase/log/log0recv.c
@@ -34,10 +34,12 @@ Created 9/20/1997 Heikki Tuuri
#include "dict0boot.h"
#include "fil0fil.h"
+#ifdef UNIV_HOTBACKUP
/* This is set to FALSE if the backup was originally taken with the
ibbackup --include regexp option: then we do not want to create tables in
directories which were not included */
ibool recv_replay_file_ops = TRUE;
+#endif /* UNIV_HOTBACKUP */
/* Log records are stored in the hash table in chunks at most of this size;
this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
@@ -71,7 +73,11 @@ log scan */
ulint recv_scan_print_counter = 0;
ibool recv_is_from_backup = FALSE;
+#ifdef UNIV_HOTBACKUP
ibool recv_is_making_a_backup = FALSE;
+#else
+# define recv_is_making_a_backup FALSE
+#endif /* UNIV_HOTBACKUP */
ulint recv_previous_parsed_rec_type = 999999;
ulint recv_previous_parsed_rec_offset = 0;
@@ -1516,9 +1522,9 @@ skip_this_recv_addr:
recv_sys_empty_hash();
}
-#endif
+#endif /* UNIV_HOTBACKUP */
-#ifdef notdefined
+#ifdef UNIV_LOG_REPLICATE
/***********************************************************************
In the debug version, updates the replica of a file page, based on a log
record. */
@@ -1718,7 +1724,7 @@ recv_compare_spaces_low(
recv_compare_spaces(space1, space2, n_pages);
}
-#endif
+#endif /* UNIV_LOG_REPLICATE */
/***********************************************************************
Tries to parse a single log record and returns its length. */
@@ -2018,11 +2024,13 @@ loop:
becomes identical with the original page */
#ifdef UNIV_LOG_DEBUG
recv_check_incomplete_log_recs(ptr, len);
-#endif
-/* recv_update_replicate(type, space, page_no, body,
+#endif/* UNIV_LOG_DEBUG */
+#ifdef UNIV_LOG_REPLICATE
+ recv_update_replicate(type, space, page_no, body,
ptr + len);
recv_compare_replicate(space, page_no);
-*/
+#endif /* UNIV_LOG_REPLICATE */
+
}
} else {
/* Check that all the records associated with the single mtr
@@ -2055,11 +2063,11 @@ loop:
according to the log record */
#ifdef UNIV_LOG_DEBUG
recv_check_incomplete_log_recs(ptr, len);
-#endif
-/*
+#endif /* UNIV_LOG_DEBUG */
+#ifdef UNIV_LOG_REPLICATE
recv_update_replicate(type, space, page_no,
body, ptr + len);
-*/
+#endif /* UNIV_LOG_REPLICATE */
}
#ifdef UNIV_LOG_DEBUG
@@ -2127,12 +2135,13 @@ loop:
recv_add_to_hash_table(type, space, page_no,
body, ptr + len, old_lsn,
new_recovered_lsn);
+#ifdef UNIV_LOG_REPLICATE
} else {
/* In debug checking, check that the replicate
page has become identical with the original
page */
-
-/* recv_compare_replicate(space, page_no); */
+ recv_compare_replicate(space, page_no);
+#endif /* UNIV_LOG_REPLICATE */
}
ptr += len;
@@ -2576,15 +2585,16 @@ recv_recovery_from_checkpoint_start(
/* Wipe over the label now */
- ut_memcpy(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
- (char*)" ", 4);
+ memset(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
+ ' ', 4);
/* Write to the log file to wipe over the label */
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE,
max_cp_group->space_id,
0, 0, OS_FILE_LOG_BLOCK_SIZE,
log_hdr_buf, max_cp_group);
}
-
+
+#ifdef UNIV_LOG_ARCHIVE
group = UT_LIST_GET_FIRST(log_sys->log_groups);
while (group) {
@@ -2594,6 +2604,7 @@ recv_recovery_from_checkpoint_start(
group = UT_LIST_GET_NEXT(log_groups, group);
}
+#endif /* UNIV_LOG_ARCHIVE */
if (type == LOG_CHECKPOINT) {
/* Start reading the log groups from the checkpoint lsn up. The
@@ -2789,7 +2800,9 @@ recv_recovery_from_checkpoint_start(
log_sys->next_checkpoint_lsn = checkpoint_lsn;
log_sys->next_checkpoint_no = ut_dulint_add(checkpoint_no, 1);
+#ifdef UNIV_LOG_ARCHIVE
log_sys->archived_lsn = archived_lsn;
+#endif /* UNIV_LOG_ARCHIVE */
recv_synchronize_groups(up_to_date_group);
@@ -2822,10 +2835,12 @@ recv_recovery_from_checkpoint_start(
log_sys->next_checkpoint_no = ut_dulint_add(checkpoint_no, 1);
+#ifdef UNIV_LOG_ARCHIVE
if (ut_dulint_cmp(archived_lsn, ut_dulint_max) == 0) {
log_sys->archiving_state = LOG_ARCH_OFF;
}
+#endif /* UNIV_LOG_ARCHIVE */
mutex_enter(&(recv_sys->mutex));
@@ -2904,7 +2919,9 @@ 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 */
+#ifdef UNIV_LOG_ARCHIVE
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 */
@@ -2921,9 +2938,10 @@ recv_reset_logs(
while (group) {
group->lsn = log_sys->lsn;
group->lsn_offset = LOG_FILE_HDR_SIZE;
-
+#ifdef UNIV_LOG_ARCHIVE
group->archived_file_no = arch_log_no;
group->archived_offset = 0;
+#endif /* UNIV_LOG_ARCHIVE */
if (!new_logs_created) {
recv_truncate_group(group, group->lsn, group->lsn,
@@ -2940,7 +2958,9 @@ recv_reset_logs(
log_sys->next_checkpoint_no = ut_dulint_zero;
log_sys->last_checkpoint_lsn = ut_dulint_zero;
+#ifdef UNIV_LOG_ARCHIVE
log_sys->archived_lsn = log_sys->lsn;
+#endif /* UNIV_LOG_ARCHIVE */
log_block_init(log_sys->buf, log_sys->lsn);
log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);
@@ -2958,17 +2978,18 @@ recv_reset_logs(
mutex_enter(&(log_sys->mutex));
}
+#ifdef UNIV_HOTBACKUP
/**********************************************************
Creates new log files after a backup has been restored. */
void
recv_reset_log_files_for_backup(
/*============================*/
- 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 divisible by
- OS_FILE_LOG_BLOCK_SIZE */
+ 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
+ divisible by OS_FILE_LOG_BLOCK_SIZE */
{
os_file_t log_file;
ibool success;
@@ -2976,8 +2997,8 @@ recv_reset_log_files_for_backup(
ulint i;
ulint log_dir_len;
char* name;
- static
- char logfilename[] = "ib_logfile";
+ static const
+ char logfilename[] = "ib_logfile";
log_dir_len = strlen(log_dir);
/* reserve space for log_dir, "ib_logfile" and a number */
@@ -3047,7 +3068,9 @@ recv_reset_log_files_for_backup(
mem_free(name);
ut_free(buf);
}
+#endif /* UNIV_HOTBACKUP */
+#ifdef UNIV_LOG_ARCHIVE
/**********************************************************
Reads from the archive of a log group and performs recovery. */
static
@@ -3353,9 +3376,8 @@ void
recv_recovery_from_archive_finish(void)
/*===================================*/
{
- ut_a(0);
-
recv_recovery_from_checkpoint_finish();
recv_recovery_from_backup_on = FALSE;
}
+#endif /* UNIV_LOG_ARCHIVE */