Commit 7c9bda2e authored by unknown's avatar unknown

Support of moving logs in other directory then data root.

Fixed typo in maria_read_log "help" output.
Compilation warning on Mac OS fixed.


mysql-test/include/maria_empty_logs.inc:
  Added support of moving maria log relatively
    to master data directory.
mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc:
  Added support of moving maria log relatively
    to master data directory.
mysql-test/include/maria_verify_recovery.inc:
  Added support of moving maria log relatively
    to master data directory.
mysql-test/t/maria-recovery-master.opt:
  Check of recovery with logs in other place.
mysql-test/t/maria-recovery.test:
  Check of recovery with logs in other place.
storage/maria/ha_maria.cc:
  Support of moving logs in other directory then data root.
storage/maria/ma_loghandler.c:
  Compilation warning on Mac OS fixed.
storage/maria/ma_static.c:
  Support of moving logs in other directory then data root.
storage/maria/ma_test1.c:
  Support of moving logs in other directory then data root.
storage/maria/maria_def.h:
  Support of moving logs in other directory then data root.
storage/maria/maria_read_log.c:
  Support of moving logs in other directory then data root.
  Fixed typo in maria_read_log "help" output.
parent d2992ecb
......@@ -15,48 +15,48 @@ EOF
if (!$mel_keep_control_file)
{
remove_file $MYSQLTEST_VARDIR/master-data/maria_log_control;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control;
}
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000001;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000001;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000002;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000002;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000003;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000003;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000004;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000004;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000005;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000005;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000006;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000006;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000007;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000007;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000008;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000008;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000009;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000009;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000010;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000010;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000011;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000011;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000012;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000012;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000013;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000013;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000014;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000014;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000015;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000015;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000016;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000016;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000017;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000017;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000018;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000018;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000019;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000019;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log.00000020;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log.00000020;
# hope there are not more than these logs...
-- error 0,1
......
......@@ -30,6 +30,6 @@ let $mms_copy=0;
-- error 0,1
remove_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control;
copy_file $MYSQLTEST_VARDIR/master-data/maria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control;
copy_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control;
connection default;
......@@ -55,8 +55,8 @@ if ($mvr_restore_old_snapshot)
# also copy back control file, to force recovery to start from an early
# point, ignoring further checkpoints.
-- error 0,1
remove_file $MYSQLTEST_VARDIR/master-data/maria_log_control;
copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control $MYSQLTEST_VARDIR/master-data/maria_log_control;
remove_file $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control;
copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.maria_log_control $MYSQLTEST_VARDIR/master-data/$MARIA_LOG/maria_log_control;
}
--echo * recovery happens
......
--skip-stack-trace --skip-core-file --loose-debug-on=1
--skip-stack-trace --skip-core-file --loose-debug-on=1 --maria-log-dir-path=../tmp
......@@ -6,6 +6,7 @@
--source include/have_maria.inc
set global maria_log_file_size=4294967295;
let $MARIA_LOG=../tmp;
--disable_warnings
drop database if exists mysqltest;
......
......@@ -128,6 +128,13 @@ static MYSQL_SYSVAR_BOOL(page_checksum, maria_page_checksums, 0,
"Maintain page checksums (can be overridden per table "
"with PAGE_CHECKSUM clause in CREATE TABLE)", 0, 0, 1);
/* It is only command line argument */
static MYSQL_SYSVAR_STR(log_dir_path, maria_data_root,
PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_RQCMDARG,
"Path to the directory where to store transactional log",
NULL, NULL, mysql_real_data_home);
static MYSQL_SYSVAR_ULONG(log_file_size, log_file_size,
PLUGIN_VAR_RQCMDARG,
"Limit for transaction log size",
......@@ -2756,7 +2763,6 @@ static int ha_maria_init(void *p)
/* TODO: decide if we support Maria being used for log tables */
maria_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
bzero(maria_log_pagecache, sizeof(*maria_log_pagecache));
maria_data_root= mysql_real_data_home;
maria_tmpdir= &mysql_tmpdir_list; /* For REDO */
res= maria_init() || ma_control_file_create_or_open() ||
!init_pagecache(maria_pagecache,
......@@ -2856,6 +2862,7 @@ static struct st_mysql_sys_var* system_variables[]= {
MYSQL_SYSVAR(block_size),
MYSQL_SYSVAR(checkpoint_interval),
MYSQL_SYSVAR(page_checksum),
MYSQL_SYSVAR(log_dir_path),
MYSQL_SYSVAR(log_file_size),
MYSQL_SYSVAR(log_purge_type),
MYSQL_SYSVAR(max_sort_file_size),
......@@ -2895,6 +2902,7 @@ static void update_log_file_size(MYSQL_THD thd,
*(ulong *)var_ptr= size;
}
static SHOW_VAR status_variables[]= {
{"Maria_pagecache_blocks_not_flushed", (char*) &maria_pagecache_var.global_blocks_changed, SHOW_LONG_NOFLUSH},
{"Maria_pagecache_blocks_unused", (char*) &maria_pagecache_var.blocks_unused, SHOW_LONG_NOFLUSH},
......
......@@ -2444,7 +2444,7 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
}
}
file->is_sync= 0;
if (my_pwrite(file->handler.file, (char*) buffer->buffer,
if (my_pwrite(file->handler.file, buffer->buffer,
buffer->size, LSN_OFFSET(buffer->offset),
log_write_flags))
{
......@@ -2905,7 +2905,7 @@ static uchar *translog_get_page(TRANSLOG_VALIDATOR_DATA *data, uchar *buffer,
buffer=
(uchar*) pagecache_read(log_descriptor.pagecache, &file->handler,
LSN_OFFSET(addr) / TRANSLOG_PAGE_SIZE,
3, (direct_link ? NULL : (char*) buffer),
3, (direct_link ? NULL : buffer),
PAGECACHE_PLAIN_PAGE,
(direct_link ?
PAGECACHE_LOCK_READ :
......@@ -5024,7 +5024,7 @@ static void translog_relative_LSN_encode(struct st_translog_parts *parts,
We write the result in backward direction with no special sense or
tricks both directions are equal in complicity
*/
for (src_ptr= buffer + lsns_len - LSN_STORE_SIZE;
for (src_ptr= ((uchar*) buffer) + lsns_len - LSN_STORE_SIZE;
src_ptr >= (uchar*) buffer;
src_ptr-= LSN_STORE_SIZE)
{
......@@ -8300,7 +8300,7 @@ static void dump_datapage(uchar *buffer)
static void dump_page(uchar *buffer)
{
printf("Page by offset %lld\n", opt_offset);
if (strncmp(maria_trans_file_magic, buffer,
if (strncmp((char*)maria_trans_file_magic, (char*)buffer,
sizeof(maria_trans_file_magic)) == 0)
{
dump_header_page(buffer);
......
......@@ -51,7 +51,7 @@ PAGECACHE *maria_pagecache= &maria_pagecache_var;
PAGECACHE maria_log_pagecache_var;
PAGECACHE *maria_log_pagecache= &maria_log_pagecache_var;
MY_TMPDIR *maria_tmpdir; /* Tempdir for redo */
const char *maria_data_root;
char *maria_data_root;
/**
@brief when transactionality does not matter we can use this transaction
......
......@@ -24,7 +24,7 @@
#include "trnman.h"
extern PAGECACHE *maria_log_pagecache;
extern const char *maria_data_root;
extern char *maria_data_root;
#define MAX_REC_LENGTH 1024
......
......@@ -725,7 +725,7 @@ extern uchar maria_file_magic[], maria_pack_file_magic[];
extern uchar maria_uuid[MY_UUID_SIZE];
extern uint maria_read_vec[], maria_readnext_vec[];
extern uint maria_quick_table_bits;
extern const char *maria_data_root;
extern char *maria_data_root;
extern uchar maria_zero_string[];
extern my_bool maria_inited;
......
......@@ -45,9 +45,9 @@ int main(int argc, char **argv)
load_defaults("my", load_default_groups, &argc, &argv);
default_argv= argv;
maria_data_root= (char *)".";
get_options(&argc, &argv);
maria_data_root= ".";
maria_in_recovery= TRUE;
if (maria_init())
......@@ -171,6 +171,10 @@ static struct my_option my_long_options[] =
{"display-only", 'd', "display brief info read from records' header",
(uchar **) &opt_display_only, (uchar **) &opt_display_only, 0, GET_BOOL,
NO_ARG,0, 0, 0, 0, 0, 0},
{"maria_log_dir_path", 'l',
"Path to the directory where to store transactional log",
(uchar **) &maria_data_root, (uchar **) &maria_data_root, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "page_buffer_size", 'P', "",
(uchar**) &opt_page_buffer_size, (uchar**) &opt_page_buffer_size, 0,
GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT,
......@@ -224,7 +228,7 @@ static void usage(void)
"test scripts that tries to compare files before and after recovery.");
#endif
VOID(printf("\nUsage: %s OPTIONS\n", my_progname_short));
puts("You need to use one of -o or -a");
puts("You need to use one of -d or -a");
my_print_help(my_long_options);
print_defaults("my", load_default_groups);
my_print_variables(my_long_options);
......
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