Commit c548715c authored by unknown's avatar unknown

Fixed LSN codding to allow code all

  relative LSN independed on "distance".
Added support for test record descriptors to avoid
  interfere woth real record descriptors.
Fixed descriptor of pseudofixed length record length,
  now it is length of record passed from/to client of
  the loghandler.


BitKeeper/etc/ignore:
  Added storage/maria/unittest/ma_test_loghandler_long-t-big to the ignore list
storage/maria/ma_init.c:
  Removed loghandler_init call because it is present in translog_init()
storage/maria/ma_loghandler.c:
  Fixed LSN codding to allow code all
    relative LSN independed on "distance".
  Added support for test record descriptors to avoid
    interfere woth real record descriptors.
  Fixed length of LOGREC_REDO_INSERT_ROW_TAIL.
  Fixed descriptor of pseudofixed length record length,
    now it is length of record passed from/to client of
    the loghandler.
storage/maria/ma_loghandler.h:
  Added support for test record descriptors to avoid
    interfere woth real record descriptors.
storage/maria/unittest/Makefile.am:
  Made new test for log with reference over 63 files.
  Layout fixed.
storage/maria/unittest/ma_test_loghandler-t.c:
  Added support for test record descriptors to avoid
    interfere woth real record descriptors.
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Added support for test record descriptors to avoid
    interfere woth real record descriptors.
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Added support for test record descriptors to avoid
    interfere woth real record descriptors.
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Added support for test record descriptors to avoid
    interfere woth real record descriptors.
parent 2170c73e
......@@ -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 */
......@@ -184,7 +184,16 @@ struct st_translog_reader_data
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
......
......@@ -131,11 +131,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,
num, NULL, 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);
......@@ -147,7 +147,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,
num, NULL, NULL,
len, TRANSLOG_INTERNAL_PARTS + 1,
parts))
......@@ -283,6 +283,7 @@ int main(int argc __attribute__((unused)),
translog_destroy();
exit(1);
}
example_loghandler_init();
srandom(122334817L);
{
......@@ -295,7 +296,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,
0, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1,
parts))
{
......@@ -393,13 +394,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,
......@@ -416,19 +418,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]),
......@@ -442,8 +446,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);
......
......@@ -72,6 +72,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)
{
......@@ -89,7 +90,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,
0, NULL, 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