Commit d1ee3926 authored by unknown's avatar unknown

Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria

into  desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-readonly


storage/maria/ha_maria.cc:
  Auto merged
storage/maria/ma_create.c:
  Auto merged
storage/maria/ma_open.c:
  Auto merged
storage/maria/ma_test1.c:
  Auto merged
storage/maria/ma_test2.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Auto merged
storage/maria/ma_check.c:
  Merge.
storage/maria/ma_loghandler.c:
  Merge.
storage/maria/ma_loghandler.h:
  Merge.
storage/maria/maria_read_log.c:
  Merge.
storage/maria/unittest/Makefile.am:
  Merge.
parents 474cfbe8 3a913bdf
...@@ -2572,7 +2572,7 @@ static int ha_maria_init(void *p) ...@@ -2572,7 +2572,7 @@ static int ha_maria_init(void *p)
TRANSLOG_PAGE_SIZE, 0) || TRANSLOG_PAGE_SIZE, 0) ||
translog_init(maria_data_root, log_file_size, translog_init(maria_data_root, log_file_size,
MYSQL_VERSION_ID, server_id, maria_log_pagecache, MYSQL_VERSION_ID, server_id, maria_log_pagecache,
TRANSLOG_DEFAULT_FLAGS) || TRANSLOG_DEFAULT_FLAGS, 0) ||
maria_recover() || maria_recover() ||
ma_checkpoint_init(checkpoint_interval); ma_checkpoint_init(checkpoint_interval);
maria_multi_threaded= TRUE; maria_multi_threaded= TRUE;
......
...@@ -5829,7 +5829,7 @@ static int write_log_record_for_repair(const HA_CHECK *param, MARIA_HA *info) ...@@ -5829,7 +5829,7 @@ static int write_log_record_for_repair(const HA_CHECK *param, MARIA_HA *info)
{ {
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
/* in case this is maria_chk or recovery... */ /* in case this is maria_chk or recovery... */
if (translog_inited && !maria_in_recovery && if (translog_status == TRANSLOG_OK && !maria_in_recovery &&
share->base.born_transactional) share->base.born_transactional)
{ {
my_bool save_now_transactional= share->now_transactional; my_bool save_now_transactional= share->now_transactional;
......
...@@ -727,7 +727,8 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -727,7 +727,8 @@ int maria_create(const char *name, enum data_file_type datafile_type,
/* max_data_file_length and max_key_file_length are recalculated on open */ /* max_data_file_length and max_key_file_length are recalculated on open */
if (tmp_table) if (tmp_table)
share.base.max_data_file_length= (my_off_t) ci->data_file_length; share.base.max_data_file_length= (my_off_t) ci->data_file_length;
else if (ci->transactional && translog_inited && !maria_in_recovery) else if (ci->transactional && translog_status == TRANSLOG_OK &&
!maria_in_recovery)
{ {
/* /*
we have checked translog_inited above, because maria_chk may call us we have checked translog_inited above, because maria_chk may call us
......
This diff is collapsed.
...@@ -255,9 +255,18 @@ C_MODE_START ...@@ -255,9 +255,18 @@ C_MODE_START
#define LOGREC_FIXED_RECORD_2LSN_EXAMPLE 5 #define LOGREC_FIXED_RECORD_2LSN_EXAMPLE 5
#define LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE 6 #define LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE 6
extern my_bool translog_init(const char *directory, uint32 log_file_max_size, extern void translog_example_table_init();
uint32 server_version, uint32 server_id, extern void translog_table_init();
PAGECACHE *pagecache, uint flags); #define translog_init(D,M,V,I,C,F,R) \
translog_init_with_table(D,M,V,I,C,F,R,&translog_table_init)
extern my_bool translog_init_with_table(const char *directory,
uint32 log_file_max_size,
uint32 server_version,
uint32 server_id,
PAGECACHE *pagecache,
uint flags,
my_bool readonly,
void (*init_table_func)());
extern my_bool extern my_bool
translog_write_record(LSN *lsn, enum translog_record_type type, TRN *trn, translog_write_record(LSN *lsn, enum translog_record_type type, TRN *trn,
...@@ -303,7 +312,13 @@ extern void translog_deassign_id_from_share(struct st_maria_share *share); ...@@ -303,7 +312,13 @@ extern void translog_deassign_id_from_share(struct st_maria_share *share);
extern void extern void
translog_assign_id_to_share_from_recovery(struct st_maria_share *share, translog_assign_id_to_share_from_recovery(struct st_maria_share *share,
uint16 id); uint16 id);
extern my_bool translog_inited; enum enum_translog_status
{
TRANSLOG_UNINITED, /* no initialization done or error during initialization */
TRANSLOG_OK, /* transaction log is functioning */
TRANSLOG_READONLY /* read only mode due to write errors */
};
extern enum enum_translog_status translog_status;
/* /*
all the rest added because of recovery; should we make all the rest added because of recovery; should we make
......
...@@ -1062,7 +1062,7 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite) ...@@ -1062,7 +1062,7 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite)
{ {
safe_mutex_assert_owner(&share->intern_lock); safe_mutex_assert_owner(&share->intern_lock);
} }
if (share->base.born_transactional && translog_inited && if (share->base.born_transactional && translog_status == TRANSLOG_OK &&
!maria_in_recovery) !maria_in_recovery)
{ {
/* /*
......
...@@ -83,7 +83,7 @@ int main(int argc,char *argv[]) ...@@ -83,7 +83,7 @@ int main(int argc,char *argv[])
TRANSLOG_PAGE_SIZE, MY_WME) == 0) || TRANSLOG_PAGE_SIZE, MY_WME) == 0) ||
translog_init(maria_data_root, TRANSLOG_FILE_SIZE, translog_init(maria_data_root, TRANSLOG_FILE_SIZE,
0, 0, maria_log_pagecache, 0, 0, maria_log_pagecache,
TRANSLOG_DEFAULT_FLAGS) || TRANSLOG_DEFAULT_FLAGS, 0) ||
(transactional && (trnman_init(0) || ma_checkpoint_init(0)))) (transactional && (trnman_init(0) || ma_checkpoint_init(0))))
{ {
fprintf(stderr, "Error in initialization\n"); fprintf(stderr, "Error in initialization\n");
......
...@@ -96,7 +96,7 @@ int main(int argc, char *argv[]) ...@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
TRANSLOG_PAGE_SIZE, MY_WME) == 0) || TRANSLOG_PAGE_SIZE, MY_WME) == 0) ||
translog_init(maria_data_root, TRANSLOG_FILE_SIZE, translog_init(maria_data_root, TRANSLOG_FILE_SIZE,
0, 0, maria_log_pagecache, 0, 0, maria_log_pagecache,
TRANSLOG_DEFAULT_FLAGS) || TRANSLOG_DEFAULT_FLAGS, 0) ||
(transactional && (trnman_init(0) || ma_checkpoint_init(0)))) (transactional && (trnman_init(0) || ma_checkpoint_init(0))))
{ {
fprintf(stderr, "Error in initialization"); fprintf(stderr, "Error in initialization");
......
...@@ -82,7 +82,8 @@ int main(int argc, char **argv) ...@@ -82,7 +82,8 @@ int main(int argc, char **argv)
TRANSLOG_PAGECACHE_SIZE, 0, 0, TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, MY_WME) == 0 || TRANSLOG_PAGE_SIZE, MY_WME) == 0 ||
translog_init(maria_data_root, TRANSLOG_FILE_SIZE, translog_init(maria_data_root, TRANSLOG_FILE_SIZE,
0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS)) 0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS,
opt_only_display))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
goto err; goto err;
......
...@@ -46,7 +46,8 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \ ...@@ -46,7 +46,8 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler_noflush-t \ ma_test_loghandler_noflush-t \
ma_test_loghandler_first_lsn-t \ ma_test_loghandler_first_lsn-t \
ma_test_loghandler_max_lsn-t \ ma_test_loghandler_max_lsn-t \
ma_test_loghandler_purge-t ma_test_loghandler_purge-t \
ma_test_loghandler_readonly-t
ma_test_loghandler_t_SOURCES = ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c ma_test_loghandler_t_SOURCES = ma_test_loghandler-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_multigroup_t_SOURCES = ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c ma_test_loghandler_multigroup_t_SOURCES = ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
...@@ -58,6 +59,8 @@ ma_test_loghandler_noflush_t_SOURCES = ma_test_loghandler_noflush-t.c ma_maria_l ...@@ -58,6 +59,8 @@ ma_test_loghandler_noflush_t_SOURCES = ma_test_loghandler_noflush-t.c ma_maria_l
ma_test_loghandler_first_lsn_t_SOURCES = ma_test_loghandler_first_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c ma_test_loghandler_first_lsn_t_SOURCES = ma_test_loghandler_first_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_max_lsn_t_SOURCES = ma_test_loghandler_max_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c ma_test_loghandler_max_lsn_t_SOURCES = ma_test_loghandler_max_lsn-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_purge_t_SOURCES = ma_test_loghandler_purge-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c ma_test_loghandler_purge_t_SOURCES = ma_test_loghandler_purge-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_readonly_t_SOURCES = ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c ma_loghandler_examples.c
ma_test_loghandler_readonly_t_CPPFLAGS = -DREADONLY_TEST
ma_pagecache_single_src = ma_pagecache_single.c test_file.c test_file.h ma_pagecache_single_src = ma_pagecache_single.c test_file.c test_file.h
ma_pagecache_consist_src = ma_pagecache_consist.c test_file.c test_file.h ma_pagecache_consist_src = ma_pagecache_consist.c test_file.c test_file.h
......
...@@ -176,13 +176,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -176,13 +176,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
trn->first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; trn->first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
...@@ -66,13 +66,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -66,13 +66,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
...@@ -60,13 +60,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -60,13 +60,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
...@@ -12,15 +12,27 @@ static const char *default_dbug_option; ...@@ -12,15 +12,27 @@ static const char *default_dbug_option;
#endif #endif
static TRN *trn= &dummy_transaction_object; static TRN *trn= &dummy_transaction_object;
#define PCACHE_SIZE (1024*1024*10)
#define LONG_BUFFER_SIZE ((1024L*1024L*1024L) + (1024L*1024L*512)) #ifndef READONLY_TEST
#define PCACHE_SIZE (1024*1024*10)
#define LONG_BUFFER_SIZE ((1024L*1024L*1024L) + (1024L*1024L*512))
#define MIN_REC_LENGTH (1024L*1024L + 1024L*512L + 1) #define MIN_REC_LENGTH (1024L*1024L + 1024L*512L + 1)
#define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512)
#define ITERATIONS 2
#define READONLY 0
#else
#define PCACHE_SIZE (1024*1024*10)
#define LONG_BUFFER_SIZE (1024L*1024L)
#define MIN_REC_LENGTH (1024L)
#define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512) #define LOG_FILE_SIZE (1024L*1024L*1024L + 1024L*1024L*512)
#define ITERATIONS 2 #define ITERATIONS 2
/*#define ITERATIONS 63 */ #define READONLY 1
#endif /*READONLY_TEST*/
/* /*
#define LOG_FILE_SIZE 1024L*1024L*3L #define LOG_FILE_SIZE 1024L*1024L*3L
...@@ -173,13 +185,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -173,13 +185,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, 0)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
0, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
trn->first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; trn->first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
...@@ -338,13 +350,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -338,13 +350,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "pass2: Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "pass2: Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, 0)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
0, READONLY, &translog_example_table_init))
{ {
fprintf(stderr, "pass2: Can't init loghandler (%d)\n", errno); fprintf(stderr, "pass2: Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
srandom(122334817L); srandom(122334817L);
......
...@@ -283,13 +283,13 @@ int main(int argc __attribute__((unused)), ...@@ -283,13 +283,13 @@ int main(int argc __attribute__((unused)),
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
...@@ -68,13 +68,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -68,13 +68,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
...@@ -68,13 +68,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -68,13 +68,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
...@@ -63,13 +63,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -63,13 +63,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno); fprintf(stderr, "Got error: init_pagecache() (errno: %d)\n", errno);
exit(1); exit(1);
} }
if (translog_init(".", LOG_FILE_SIZE, 50112, 0, &pagecache, LOG_FLAGS)) if (translog_init_with_table(".", LOG_FILE_SIZE, 50112, 0, &pagecache,
LOG_FLAGS, 0, &translog_example_table_init))
{ {
fprintf(stderr, "Can't init loghandler (%d)\n", errno); fprintf(stderr, "Can't init loghandler (%d)\n", errno);
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
/* Suppressing of automatic record writing */ /* Suppressing of automatic record writing */
dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID; dummy_transaction_object.first_undo_lsn|= TRANSACTION_LOGGED_LONG_ID;
......
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