Commit 8d7f10ad 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-lsn


storage/maria/ma_loghandler.h:
  Auto merged
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Auto merged
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Auto merged
storage/maria/ma_loghandler.c:
  merge
storage/maria/unittest/ma_test_loghandler-t.c:
  merge
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  merge
parents 61e4cb48 cfe18321
......@@ -3000,3 +3000,4 @@ storage/maria/unittest/ma_pagecache_consist_64kWR-t-big
storage/maria/unittest/ma_pagecache_single_64k-t-big
storage/maria/maria_control
storage/maria/maria_log.*
storage/maria/unittest/ma_test_loghandler_long-t-big
......@@ -44,7 +44,6 @@ int maria_init(void)
maria_inited= TRUE;
pthread_mutex_init(&THR_LOCK_maria,MY_MUTEX_INIT_SLOW);
_ma_init_block_record_data();
loghandler_init();
}
return 0;
}
......
This diff is collapsed.
......@@ -55,7 +55,7 @@ struct st_maria_share;
#define LOG_INTERNAL_PARTS 1
/* position reserved in an array of parts of a log record */
#define TRANSLOG_INTERNAL_PARTS 1
#define TRANSLOG_INTERNAL_PARTS 2
/* types of records in the transaction log */
/* Todo: Set numbers for these when we have all entries figured out */
......@@ -140,7 +140,7 @@ typedef struct st_translog_header_buffer
/*
Real compressed LSN(s) size economy (<number of LSN(s)>*7 - <real_size>)
*/
uint16 compressed_LSN_economy;
int16 compressed_LSN_economy;
/* short transaction ID or 0 if it has no sense for the record */
uint16 non_header_data_start_offset;
/* non read body data length in this first chunk */
......@@ -185,7 +185,16 @@ struct st_transaction;
extern "C" {
#endif
extern void loghandler_init();
/* Records types for unittests */
#define LOGREC_FIXED_RECORD_0LSN_EXAMPLE 1
#define LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE 2
#define LOGREC_FIXED_RECORD_1LSN_EXAMPLE 3
#define LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE 4
#define LOGREC_FIXED_RECORD_2LSN_EXAMPLE 5
#define LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE 6
extern void example_loghandler_init();
extern my_bool translog_init(const char *directory, uint32 log_file_max_size,
uint32 server_version, uint32 server_id,
PAGECACHE *pagecache, uint flags);
......
......@@ -41,12 +41,15 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler-t \
ma_test_loghandler_multigroup-t \
ma_test_loghandler_multithread-t \
ma_test_loghandler_pagecache-t
ma_test_loghandler_pagecache-t \
ma_test_loghandler_long-t-big
ma_test_loghandler_t_SOURCES= ma_test_loghandler-t.c ma_maria_log_cleanup.c
ma_test_loghandler_multigroup_t_SOURCES= ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c
ma_test_loghandler_multithread_t_SOURCES= ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c
ma_test_loghandler_pagecache_t_SOURCES= ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c
ma_test_loghandler_t_SOURCES = ma_test_loghandler-t.c ma_maria_log_cleanup.c
ma_test_loghandler_multigroup_t_SOURCES = ma_test_loghandler_multigroup-t.c ma_maria_log_cleanup.c
ma_test_loghandler_multithread_t_SOURCES = ma_test_loghandler_multithread-t.c ma_maria_log_cleanup.c
ma_test_loghandler_pagecache_t_SOURCES = ma_test_loghandler_pagecache-t.c ma_maria_log_cleanup.c
ma_test_loghandler_long_t_big_SOURCES = ma_test_loghandler-t.c ma_maria_log_cleanup.c
ma_test_loghandler_long_t_big_CPPFLAGS = -DLONG_LOG_TEST
ma_pagecache_single_src = ma_pagecache_single.c test_file.c
ma_pagecache_consist_src = ma_pagecache_consist.c test_file.c
......
......@@ -135,11 +135,11 @@ void writer(int num)
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID,
LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
&trn, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1,
parts))
{
fprintf(stderr, "Can't write LOGREC_LONG_TRANSACTION_ID record #%lu "
fprintf(stderr, "Can't write LOGREC_FIXED_RECORD_0LSN_EXAMPLE record #%lu "
"thread %i\n", (ulong) i, num);
translog_destroy();
pthread_mutex_lock(&LOCK_thread_count);
......@@ -151,7 +151,7 @@ void writer(int num)
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= len;
if (translog_write_record(&lsn,
LOGREC_REDO_INSERT_ROW_HEAD,
LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE,
&trn, NULL,
len, TRANSLOG_INTERNAL_PARTS + 1,
parts))
......@@ -287,6 +287,7 @@ int main(int argc __attribute__((unused)),
translog_destroy();
exit(1);
}
example_loghandler_init();
srandom(122334817L);
{
......@@ -299,7 +300,7 @@ int main(int argc __attribute__((unused)),
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&first_lsn,
LOGREC_LONG_TRANSACTION_ID,
LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
&dummy_transaction_object, NULL, 6,
TRANSLOG_INTERNAL_PARTS + 1,
parts))
......@@ -398,13 +399,14 @@ int main(int argc __attribute__((unused)),
stage= indeces[rec.short_trid] % 2;
if (stage == 0)
{
if (rec.type !=LOGREC_LONG_TRANSACTION_ID ||
if (rec.type !=LOGREC_FIXED_RECORD_0LSN_EXAMPLE ||
rec.record_length != 6 ||
uint2korr(rec.header) != rec.short_trid ||
index != uint4korr(rec.header + 2) ||
cmp_translog_addr(lsns1[rec.short_trid][index], rec.lsn) != 0)
{
fprintf(stderr, "Incorrect LOGREC_LONG_TRANSACTION_ID data read(%d)\n"
fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_0LSN_EXAMPLE "
"data read(%d)\n"
"type %u, strid %u %u, len %u, i: %u %u, "
"lsn(%lu,0x%lx) (%lu,0x%lx)\n",
i, (uint) rec.type,
......@@ -421,19 +423,21 @@ int main(int argc __attribute__((unused)),
}
else
{
if (rec.type !=LOGREC_REDO_INSERT_ROW_HEAD ||
if (rec.type != LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE ||
len != 9 ||
rec.record_length != lens[rec.short_trid][index] ||
cmp_translog_addr(lsns2[rec.short_trid][index], rec.lsn) != 0 ||
check_content(rec.header, len))
{
fprintf(stderr,
"Incorrect LOGREC_REDO_INSERT_ROW_HEAD data read(%d) "
" thread: %d, iteration %d, stage %d\n"
"Incorrect LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE "
"data read(%d) "
"thread: %d, iteration %d, stage %d\n"
"type %u (%d), len %u, length %lu %lu (%d) "
"lsn(%lu,0x%lx) (%lu,0x%lx)\n",
i, (uint) rec.short_trid, index, stage,
(uint) rec.type, (rec.type !=LOGREC_REDO_INSERT_ROW_HEAD),
(uint) rec.type, (rec.type !=
LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE),
(uint) len,
(ulong) rec.record_length, lens[rec.short_trid][index],
(rec.record_length != lens[rec.short_trid][index]),
......@@ -447,8 +451,8 @@ int main(int argc __attribute__((unused)),
if (read_and_check_content(&rec, long_buffer, 0))
{
fprintf(stderr,
"Incorrect LOGREC_REDO_INSERT_ROW_HEAD in whole rec read "
"lsn(%lu,0x%lx)\n",
"Incorrect LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE "
"in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn),
(ulong) LSN_OFFSET(rec.lsn));
translog_free_record_header(&rec);
......
......@@ -73,6 +73,7 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_destroy();
exit(1);
}
example_loghandler_init();
if ((stat= my_stat(first_translog_file, &st, MYF(0))) == 0)
{
......@@ -90,7 +91,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID,
LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
&dummy_transaction_object, NULL, 6,
TRANSLOG_INTERNAL_PARTS + 1,
parts))
......
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