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 ...@@ -3000,3 +3000,4 @@ storage/maria/unittest/ma_pagecache_consist_64kWR-t-big
storage/maria/unittest/ma_pagecache_single_64k-t-big storage/maria/unittest/ma_pagecache_single_64k-t-big
storage/maria/maria_control storage/maria/maria_control
storage/maria/maria_log.* storage/maria/maria_log.*
storage/maria/unittest/ma_test_loghandler_long-t-big
...@@ -44,7 +44,6 @@ int maria_init(void) ...@@ -44,7 +44,6 @@ int maria_init(void)
maria_inited= TRUE; maria_inited= TRUE;
pthread_mutex_init(&THR_LOCK_maria,MY_MUTEX_INIT_SLOW); pthread_mutex_init(&THR_LOCK_maria,MY_MUTEX_INIT_SLOW);
_ma_init_block_record_data(); _ma_init_block_record_data();
loghandler_init();
} }
return 0; return 0;
} }
......
...@@ -48,7 +48,9 @@ ...@@ -48,7 +48,9 @@
putchar('\n'); \ putchar('\n'); \
} while(0); } while(0);
/* Maximum length of compressed LSNs (the worst case of whole LSN storing) */
#define COMPRESSED_LSN_MAX_STORE_SIZE (2 + LSN_STORE_SIZE)
#define MAX_NUMBER_OF_LSNS_PER_RECORD 2
/* record parts descriptor */ /* record parts descriptor */
struct st_translog_parts struct st_translog_parts
...@@ -184,7 +186,6 @@ enum record_class ...@@ -184,7 +186,6 @@ enum record_class
/* compressed (relative) LSN constants */ /* compressed (relative) LSN constants */
#define TRANSLOG_CLSN_LEN_BITS 0xC0 /* Mask to get compressed LSN length */ #define TRANSLOG_CLSN_LEN_BITS 0xC0 /* Mask to get compressed LSN length */
#define TRANSLOG_CLSN_MAX_LEN 5 /* Maximum length of compressed LSN */
typedef my_bool(*prewrite_rec_hook) (enum translog_record_type type, typedef my_bool(*prewrite_rec_hook) (enum translog_record_type type,
void *tcb, struct st_maria_share *share, void *tcb, struct st_maria_share *share,
...@@ -207,7 +208,10 @@ struct st_log_record_type_descriptor ...@@ -207,7 +208,10 @@ struct st_log_record_type_descriptor
{ {
/* internal class of the record */ /* internal class of the record */
enum record_class class; enum record_class class;
/* length for fixed-size record, or maximum length of pseudo-fixed */ /*
length for fixed-size record, pseudo-fixed record
length with uncompressed LSNs
*/
uint16 fixed_length; uint16 fixed_length;
/* how much record body (belonged to headers too) read with headers */ /* how much record body (belonged to headers too) read with headers */
uint16 read_header_len; uint16 read_header_len;
...@@ -230,20 +234,55 @@ struct st_log_record_type_descriptor ...@@ -230,20 +234,55 @@ struct st_log_record_type_descriptor
NOTE that after first public Maria release, these can NOT be changed NOTE that after first public Maria release, these can NOT be changed
*/ */
typedef struct st_log_record_type_descriptor LOG_DESC; typedef struct st_log_record_type_descriptor LOG_DESC;
static LOG_DESC log_record_type_descriptor[LOGREC_NUMBER_OF_TYPES]; static LOG_DESC log_record_type_descriptor[LOGREC_NUMBER_OF_TYPES];
static LOG_DESC INIT_LOGREC_FIXED_RECORD_0LSN_EXAMPLE=
{LOGRECTYPE_FIXEDLENGTH, 6, 6, NULL, NULL, NULL, 0};
static LOG_DESC INIT_LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE=
{LOGRECTYPE_VARIABLE_LENGTH, 0, 9, NULL, NULL, NULL, 0};
static LOG_DESC INIT_LOGREC_FIXED_RECORD_1LSN_EXAMPLE=
{LOGRECTYPE_PSEUDOFIXEDLENGTH, 7, 7, NULL, NULL, NULL, 1};
static LOG_DESC INIT_LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE=
{LOGRECTYPE_VARIABLE_LENGTH, 0, 12, NULL, NULL, NULL, 1};
static LOG_DESC INIT_LOGREC_FIXED_RECORD_2LSN_EXAMPLE=
{LOGRECTYPE_PSEUDOFIXEDLENGTH, 23, 23, NULL, NULL, NULL, 2};
static LOG_DESC INIT_LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE=
{LOGRECTYPE_VARIABLE_LENGTH, 0, 19, NULL, NULL, NULL, 2};
void example_loghandler_init()
{
log_record_type_descriptor[LOGREC_FIXED_RECORD_0LSN_EXAMPLE]=
INIT_LOGREC_FIXED_RECORD_0LSN_EXAMPLE;
log_record_type_descriptor[LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE]=
INIT_LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE;
log_record_type_descriptor[LOGREC_FIXED_RECORD_1LSN_EXAMPLE]=
INIT_LOGREC_FIXED_RECORD_1LSN_EXAMPLE;
log_record_type_descriptor[LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE]=
INIT_LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE;
log_record_type_descriptor[LOGREC_FIXED_RECORD_2LSN_EXAMPLE]=
INIT_LOGREC_FIXED_RECORD_2LSN_EXAMPLE;
log_record_type_descriptor[LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE]=
INIT_LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE;
}
static LOG_DESC INIT_LOGREC_RESERVED_FOR_CHUNKS23= static LOG_DESC INIT_LOGREC_RESERVED_FOR_CHUNKS23=
{ LOGRECTYPE_NOT_ALLOWED, 0, 0, NULL, NULL, NULL, 0 }; {LOGRECTYPE_NOT_ALLOWED, 0, 0, NULL, NULL, NULL, 0 };
static LOG_DESC INIT_LOGREC_REDO_INSERT_ROW_HEAD= static LOG_DESC INIT_LOGREC_REDO_INSERT_ROW_HEAD=
{LOGRECTYPE_VARIABLE_LENGTH, 0, {LOGRECTYPE_VARIABLE_LENGTH, 0,
FILEID_STORE_SIZE + PAGE_STORE_SIZE + DIRPOS_STORE_SIZE, NULL, NULL, NULL, 0}; FILEID_STORE_SIZE + PAGE_STORE_SIZE + DIRPOS_STORE_SIZE, NULL, NULL, NULL, 0};
static LOG_DESC INIT_LOGREC_REDO_INSERT_ROW_TAIL= static LOG_DESC INIT_LOGREC_REDO_INSERT_ROW_TAIL=
{LOGRECTYPE_VARIABLE_LENGTH, 0, 9, NULL, NULL, NULL, 0}; {LOGRECTYPE_VARIABLE_LENGTH, 0, 8, NULL, NULL, NULL, 0};
static LOG_DESC INIT_LOGREC_REDO_INSERT_ROW_BLOB= static LOG_DESC INIT_LOGREC_REDO_INSERT_ROW_BLOB=
{LOGRECTYPE_VARIABLE_LENGTH, 0, 8, NULL, NULL, NULL, 0}; {LOGRECTYPE_VARIABLE_LENGTH, 0, 8, NULL, NULL, NULL, 0};
...@@ -356,7 +395,7 @@ static LOG_DESC INIT_LOGREC_LONG_TRANSACTION_ID= ...@@ -356,7 +395,7 @@ static LOG_DESC INIT_LOGREC_LONG_TRANSACTION_ID=
{LOGRECTYPE_FIXEDLENGTH, 6, 6, NULL, NULL, NULL, 0}; {LOGRECTYPE_FIXEDLENGTH, 6, 6, NULL, NULL, NULL, 0};
void loghandler_init() static void loghandler_init()
{ {
log_record_type_descriptor[LOGREC_RESERVED_FOR_CHUNKS23]= log_record_type_descriptor[LOGREC_RESERVED_FOR_CHUNKS23]=
INIT_LOGREC_RESERVED_FOR_CHUNKS23; INIT_LOGREC_RESERVED_FOR_CHUNKS23;
...@@ -1378,9 +1417,11 @@ static uint16 translog_get_total_chunk_length(byte *page, uint16 offset) ...@@ -1378,9 +1417,11 @@ static uint16 translog_get_total_chunk_length(byte *page, uint16 offset)
{ {
/* first 2 bits is length - 2 */ /* first 2 bits is length - 2 */
uint len= ((((uint8) (*ptr)) & TRANSLOG_CLSN_LEN_BITS) >> 6) + 2; uint len= ((((uint8) (*ptr)) & TRANSLOG_CLSN_LEN_BITS) >> 6) + 2;
if (ptr[0] == 0 && ((uint8) ptr[1]) == 1)
len+= LSN_STORE_SIZE; /* case of full LSN storing */
ptr+= len; ptr+= len;
/* subtract economized bytes */ /* subtract economized bytes */
length-= (TRANSLOG_CLSN_MAX_LEN - len); length-= (LSN_STORE_SIZE - len);
} }
DBUG_PRINT("info", ("Pseudo-fixed length: %u", length)); DBUG_PRINT("info", ("Pseudo-fixed length: %u", length));
DBUG_RETURN(length); DBUG_RETURN(length);
...@@ -3215,13 +3256,21 @@ static byte *translog_put_LSN_diff(LSN base_lsn, LSN lsn, byte *dst) ...@@ -3215,13 +3256,21 @@ static byte *translog_put_LSN_diff(LSN base_lsn, LSN lsn, byte *dst)
offset_diff= base_offset - LSN_OFFSET(lsn); offset_diff= base_offset - LSN_OFFSET(lsn);
if (diff > 0x3f) if (diff > 0x3f)
{ {
/*TODO: error - too long transaction - panic!!! */ /*
UNRECOVERABLE_ERROR(("Too big file diff: %lu", (ulong) diff)); It is full LSN after special 1 diff (which is impossible
DBUG_RETURN(NULL); in real life)
*/
dst-= 2 + LSN_STORE_SIZE;
dst[0]= 0;
dst[1]= 1;
lsn_store(dst + 2, lsn);
}
else
{
dst-= 5;
*dst= (0xC0 | diff);
int4store(dst + 1, offset_diff);
} }
dst-= 5;
*dst= (0xC0 | diff);
int4store(dst + 1, offset_diff);
} }
DBUG_PRINT("info", ("new dst: 0x%lx", (ulong) dst)); DBUG_PRINT("info", ("new dst: 0x%lx", (ulong) dst));
DBUG_RETURN(dst); DBUG_RETURN(dst);
...@@ -3275,6 +3324,17 @@ static byte *translog_get_LSN_from_diff(LSN base_lsn, byte *src, byte *dst) ...@@ -3275,6 +3324,17 @@ static byte *translog_get_LSN_from_diff(LSN base_lsn, byte *src, byte *dst)
(uint) code, (ulong) first_byte)); (uint) code, (ulong) first_byte));
switch (code) { switch (code) {
case 0: case 0:
if (first_byte == 0 && *((uint8*)src) == 1)
{
/*
It is full LSN after special 1 diff (which is impossible
in real life)
*/
memcpy(dst, src + 1, LSN_STORE_SIZE);
DBUG_PRINT("info", ("Special case of full LSN, new src: 0x%lx",
(ulong) (src + 1 + LSN_STORE_SIZE)));
DBUG_RETURN(src + 1 + LSN_STORE_SIZE);
}
rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) + *((uint8*)src)); rec_offset= LSN_OFFSET(base_lsn) - ((first_byte << 8) + *((uint8*)src));
break; break;
case 1: case 1:
...@@ -3306,7 +3366,7 @@ static byte *translog_get_LSN_from_diff(LSN base_lsn, byte *src, byte *dst) ...@@ -3306,7 +3366,7 @@ static byte *translog_get_LSN_from_diff(LSN base_lsn, byte *src, byte *dst)
lsn= MAKE_LSN(file_no, rec_offset); lsn= MAKE_LSN(file_no, rec_offset);
src+= code + 1; src+= code + 1;
lsn_store(dst, lsn); lsn_store(dst, lsn);
DBUG_PRINT("info", ("new src: 0x%lx", (ulong) dst)); DBUG_PRINT("info", ("new src: 0x%lx", (ulong) src));
DBUG_RETURN(src); DBUG_RETURN(src);
} }
...@@ -3332,59 +3392,77 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts, ...@@ -3332,59 +3392,77 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts,
{ {
LEX_STRING *part; LEX_STRING *part;
uint lsns_len= lsns * LSN_STORE_SIZE; uint lsns_len= lsns * LSN_STORE_SIZE;
char buffer_src[MAX_NUMBER_OF_LSNS_PER_RECORD * LSN_STORE_SIZE];
char *buffer= buffer_src;
DBUG_ENTER("translog_relative_LSN_encode"); DBUG_ENTER("translog_relative_LSN_encode");
DBUG_ASSERT(parts->current != 0);
part= parts->parts + parts->current; part= parts->parts + parts->current;
/* collect all LSN(s) in one chunk if it (they) is (are) divided */ /* collect all LSN(s) in one chunk if it (they) is (are) divided */
if (part->length < lsns_len) if (part->length < lsns_len)
{ {
uint copied= part->length; uint copied= part->length;
LEX_STRING *next_part; LEX_STRING *next_part;
DBUG_PRINT("info", ("Using buffer: 0x%lx", (ulong) compressed_LSNs)); DBUG_PRINT("info", ("Using buffer: 0x%lx", (ulong) compressed_LSNs));
memcpy(compressed_LSNs, (byte*)part->str, part->length); memcpy(buffer, (byte*)part->str, part->length);
next_part= parts->parts + parts->current + 1; next_part= parts->parts + parts->current + 1;
do do
{ {
DBUG_ASSERT(next_part < parts->parts + parts->elements); DBUG_ASSERT(next_part < parts->parts + parts->elements);
if ((next_part->length + copied) < lsns_len) if ((next_part->length + copied) < lsns_len)
{ {
memcpy(compressed_LSNs + copied, (byte*)next_part->str, memcpy(buffer + copied, (byte*)next_part->str,
next_part->length); next_part->length);
copied+= next_part->length; copied+= next_part->length;
next_part->length= 0; next_part->str= 0; next_part->length= 0; next_part->str= 0;
/* delete_dynamic_element(&parts->parts, parts->current + 1); */ /* delete_dynamic_element(&parts->parts, parts->current + 1); */
next_part++; next_part++;
parts->current++;
part= parts->parts + parts->current;
} }
else else
{ {
uint len= lsns_len - copied; uint len= lsns_len - copied;
memcpy(compressed_LSNs + copied, (byte*)next_part->str, len); memcpy(buffer + copied, (byte*)next_part->str, len);
copied= lsns_len; copied= lsns_len;
next_part->str+= len; next_part->str+= len;
next_part->length-= len; next_part->length-= len;
} }
} while (copied < lsns_len); } while (copied < lsns_len);
part->length= lsns_len;
part->str= (char*)compressed_LSNs;
} }
else
{
buffer= part->str;
part->str+= lsns_len;
part->length-= lsns_len;
parts->current--;
part= parts->parts + parts->current;
}
{ {
/* Compress */ /* Compress */
LSN ref; LSN ref;
uint economy; int economy;
byte *ref_ptr= (byte*)part->str + lsns_len - LSN_STORE_SIZE; byte *src_ptr;
byte *dst_ptr= (byte*)part->str + lsns_len; byte *dst_ptr= compressed_LSNs + (MAX_NUMBER_OF_LSNS_PER_RECORD *
for (; ref_ptr >= (byte*)part->str ; ref_ptr-= LSN_STORE_SIZE) COMPRESSED_LSN_MAX_STORE_SIZE);
for (src_ptr= buffer + lsns_len - LSN_STORE_SIZE;
src_ptr >= buffer;
src_ptr-= LSN_STORE_SIZE)
{ {
ref= lsn_korr(ref_ptr); ref= lsn_korr(src_ptr);
if ((dst_ptr= translog_put_LSN_diff(base_lsn, ref, dst_ptr)) == NULL) if ((dst_ptr= translog_put_LSN_diff(base_lsn, ref, dst_ptr)) == NULL)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* Note that dst_ptr did grow downward ! */ part->length= (uint)((compressed_LSNs +
economy= (uint) (dst_ptr - (byte*)part->str); (MAX_NUMBER_OF_LSNS_PER_RECORD *
DBUG_PRINT("info", ("Economy: %u", economy)); COMPRESSED_LSN_MAX_STORE_SIZE)) -
part->length-= economy; dst_ptr);
parts->record_length-= economy; parts->record_length-= (economy= lsns_len - part->length);
DBUG_PRINT("info", ("new length of LSNs: %u economy: %d",
part->length, economy));
parts->total_record_length-= economy; parts->total_record_length-= economy;
part->str= (char*)dst_ptr; part->str= (char*)dst_ptr;
} }
...@@ -3853,7 +3931,8 @@ static my_bool translog_write_variable_record(LSN *lsn, ...@@ -3853,7 +3931,8 @@ static my_bool translog_write_variable_record(LSN *lsn,
ulong buffer_rest; ulong buffer_rest;
uint page_rest; uint page_rest;
/* Max number of such LSNs per record is 2 */ /* Max number of such LSNs per record is 2 */
byte compressed_LSNs[2 * LSN_STORE_SIZE]; byte compressed_LSNs[MAX_NUMBER_OF_LSNS_PER_RECORD *
COMPRESSED_LSN_MAX_STORE_SIZE];
DBUG_ENTER("translog_write_variable_record"); DBUG_ENTER("translog_write_variable_record");
translog_lock(); translog_lock();
...@@ -3966,7 +4045,8 @@ static my_bool translog_write_fixed_record(LSN *lsn, ...@@ -3966,7 +4045,8 @@ static my_bool translog_write_fixed_record(LSN *lsn,
struct st_translog_buffer *buffer_to_flush= NULL; struct st_translog_buffer *buffer_to_flush= NULL;
byte chunk1_header[1 + 2]; byte chunk1_header[1 + 2];
/* Max number of such LSNs per record is 2 */ /* Max number of such LSNs per record is 2 */
byte compressed_LSNs[2 * LSN_STORE_SIZE]; byte compressed_LSNs[MAX_NUMBER_OF_LSNS_PER_RECORD *
COMPRESSED_LSN_MAX_STORE_SIZE];
LEX_STRING *part; LEX_STRING *part;
int rc; int rc;
DBUG_ENTER("translog_write_fixed_record"); DBUG_ENTER("translog_write_fixed_record");
...@@ -3976,8 +4056,7 @@ static my_bool translog_write_fixed_record(LSN *lsn, ...@@ -3976,8 +4056,7 @@ static my_bool translog_write_fixed_record(LSN *lsn,
log_record_type_descriptor[type].fixed_length) || log_record_type_descriptor[type].fixed_length) ||
(log_record_type_descriptor[type].class == (log_record_type_descriptor[type].class ==
LOGRECTYPE_PSEUDOFIXEDLENGTH && LOGRECTYPE_PSEUDOFIXEDLENGTH &&
(parts->record_length - parts->record_length ==
log_record_type_descriptor[type].compressed_LSN * 2) <=
log_record_type_descriptor[type].fixed_length)); log_record_type_descriptor[type].fixed_length));
translog_lock(); translog_lock();
...@@ -3989,19 +4068,18 @@ static my_bool translog_write_fixed_record(LSN *lsn, ...@@ -3989,19 +4068,18 @@ static my_bool translog_write_fixed_record(LSN *lsn,
DBUG_PRINT("info", DBUG_PRINT("info",
("Page size: %u record: %u next cond: %d", ("Page size: %u record: %u next cond: %d",
log_descriptor.bc.current_page_fill, log_descriptor.bc.current_page_fill,
(parts->record_length - (parts->record_length +
log_record_type_descriptor[type].compressed_LSN * 2 + 3), log_record_type_descriptor[type].compressed_LSN * 2 + 3),
((((uint) log_descriptor.bc.current_page_fill) + ((((uint) log_descriptor.bc.current_page_fill) +
(parts->record_length - (parts->record_length +
log_record_type_descriptor[type].compressed_LSN * 2 + 3)) > log_record_type_descriptor[type].compressed_LSN * 2 + 3)) >
TRANSLOG_PAGE_SIZE))); TRANSLOG_PAGE_SIZE)));
/* /*
check that there is enough place on current page: check that there is enough place on current page.
(log_record_type_descriptor[type].fixed_length - economized on compressed NOTE: compressing may increase page LSN size on two bytes for every LSN
LSNs) bytes
*/ */
if ((((uint) log_descriptor.bc.current_page_fill) + if ((((uint) log_descriptor.bc.current_page_fill) +
(parts->record_length - (parts->record_length +
log_record_type_descriptor[type].compressed_LSN * 2 + 3)) > log_record_type_descriptor[type].compressed_LSN * 2 + 3)) >
TRANSLOG_PAGE_SIZE) TRANSLOG_PAGE_SIZE)
{ {
...@@ -4123,7 +4201,7 @@ my_bool translog_write_record(LSN *lsn, ...@@ -4123,7 +4201,7 @@ my_bool translog_write_record(LSN *lsn,
parts.current= TRANSLOG_INTERNAL_PARTS; parts.current= TRANSLOG_INTERNAL_PARTS;
/* clear TRANSLOG_INTERNAL_PARTS */ /* clear TRANSLOG_INTERNAL_PARTS */
DBUG_ASSERT(TRANSLOG_INTERNAL_PARTS == 1); DBUG_ASSERT(TRANSLOG_INTERNAL_PARTS != 0);
parts_data[0].str= 0; parts_data[0].str= 0;
parts_data[0].length= 0; parts_data[0].length= 0;
...@@ -4243,7 +4321,7 @@ translog_size_t translog_fixed_length_header(byte *page, ...@@ -4243,7 +4321,7 @@ translog_size_t translog_fixed_length_header(byte *page,
byte *dst= buff->header; byte *dst= buff->header;
byte *start= src; byte *start= src;
uint lsns= desc->compressed_LSN; uint lsns= desc->compressed_LSN;
uint length= desc->fixed_length + (lsns * 2); uint length= desc->fixed_length;
DBUG_ENTER("translog_fixed_length_header"); DBUG_ENTER("translog_fixed_length_header");
...@@ -4256,7 +4334,7 @@ translog_size_t translog_fixed_length_header(byte *page, ...@@ -4256,7 +4334,7 @@ translog_size_t translog_fixed_length_header(byte *page,
lsns*= LSN_STORE_SIZE; lsns*= LSN_STORE_SIZE;
dst+= lsns; dst+= lsns;
length-= lsns; length-= lsns;
buff->compressed_LSN_economy= (uint16) (lsns - (src - start)); buff->compressed_LSN_economy= (lsns - (src - start));
} }
else else
buff->compressed_LSN_economy= 0; buff->compressed_LSN_economy= 0;
...@@ -4575,7 +4653,7 @@ translog_size_t translog_variable_length_header(byte *page, ...@@ -4575,7 +4653,7 @@ translog_size_t translog_variable_length_header(byte *page,
LSN base_lsn; LSN base_lsn;
uint lsns= desc->compressed_LSN; uint lsns= desc->compressed_LSN;
uint16 chunk_len; uint16 chunk_len;
uint16 length= desc->read_header_len + (lsns * 2); uint16 length= desc->read_header_len;
uint16 buffer_length= length; uint16 buffer_length= length;
uint16 body_len; uint16 body_len;
TRANSLOG_SCANNER_DATA internal_scanner; TRANSLOG_SCANNER_DATA internal_scanner;
...@@ -4697,10 +4775,10 @@ translog_size_t translog_variable_length_header(byte *page, ...@@ -4697,10 +4775,10 @@ translog_size_t translog_variable_length_header(byte *page,
dst+= lsns; dst+= lsns;
length-= lsns; length-= lsns;
buff->record_length+= (buff->compressed_LSN_economy= buff->record_length+= (buff->compressed_LSN_economy=
(uint16) (lsns - (src - start))); (lsns - (src - start)));
DBUG_PRINT("info", ("lsns: %u length: %u economy: %u new length: %lu", DBUG_PRINT("info", ("lsns: %u length: %u economy: %d new length: %lu",
lsns / LSN_STORE_SIZE, (uint) length, lsns / LSN_STORE_SIZE, (uint) length,
(uint) buff->compressed_LSN_economy, (int) buff->compressed_LSN_economy,
(ulong) buff->record_length)); (ulong) buff->record_length));
body_len-= (src - start); body_len-= (src - start);
} }
......
...@@ -55,7 +55,7 @@ struct st_maria_share; ...@@ -55,7 +55,7 @@ struct st_maria_share;
#define LOG_INTERNAL_PARTS 1 #define LOG_INTERNAL_PARTS 1
/* position reserved in an array of parts of a log record */ /* 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 */ /* types of records in the transaction log */
/* Todo: Set numbers for these when we have all entries figured out */ /* Todo: Set numbers for these when we have all entries figured out */
...@@ -140,7 +140,7 @@ typedef struct st_translog_header_buffer ...@@ -140,7 +140,7 @@ typedef struct st_translog_header_buffer
/* /*
Real compressed LSN(s) size economy (<number of LSN(s)>*7 - <real_size>) 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 */ /* short transaction ID or 0 if it has no sense for the record */
uint16 non_header_data_start_offset; uint16 non_header_data_start_offset;
/* non read body data length in this first chunk */ /* non read body data length in this first chunk */
...@@ -184,7 +184,16 @@ struct st_translog_reader_data ...@@ -184,7 +184,16 @@ struct st_translog_reader_data
extern "C" { extern "C" {
#endif #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, extern my_bool translog_init(const char *directory, uint32 log_file_max_size,
uint32 server_version, uint32 server_id, uint32 server_version, uint32 server_id,
PAGECACHE *pagecache, uint flags); PAGECACHE *pagecache, uint flags);
......
...@@ -41,12 +41,15 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \ ...@@ -41,12 +41,15 @@ noinst_PROGRAMS = ma_control_file-t trnman-t lockman2-t \
ma_test_loghandler-t \ ma_test_loghandler-t \
ma_test_loghandler_multigroup-t \ ma_test_loghandler_multigroup-t \
ma_test_loghandler_multithread-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_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_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_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_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_single_src = ma_pagecache_single.c test_file.c
ma_pagecache_consist_src = ma_pagecache_consist.c test_file.c ma_pagecache_consist_src = ma_pagecache_consist.c test_file.c
......
...@@ -13,10 +13,15 @@ static const char *default_dbug_option; ...@@ -13,10 +13,15 @@ static const char *default_dbug_option;
#define LONG_BUFFER_SIZE (100 * 1024) #define LONG_BUFFER_SIZE (100 * 1024)
#ifdef LONG_LOG_TEST
#define LOG_FLAGS 0
#define LOG_FILE_SIZE (1024L*1024L)
#define ITERATIONS (1600*4)
#else
#define LOG_FLAGS TRANSLOG_SECTOR_PROTECTION | TRANSLOG_PAGE_CRC #define LOG_FLAGS TRANSLOG_SECTOR_PROTECTION | TRANSLOG_PAGE_CRC
#define LOG_FILE_SIZE 1024L*1024L*3L #define LOG_FILE_SIZE (1024L*1024L*3L)
#define ITERATIONS 1600 #define ITERATIONS 1600
#endif
/* /*
#define LOG_FLAGS 0 #define LOG_FLAGS 0
...@@ -68,6 +73,23 @@ static my_bool check_content(byte *ptr, ulong length) ...@@ -68,6 +73,23 @@ static my_bool check_content(byte *ptr, ulong length)
} }
/*
Report OK for read operation
SYNOPSIS
read_ok()
rec the record header
*/
void read_ok(TRANSLOG_HEADER_BUFFER *rec)
{
char buff[80];
snprintf(buff, sizeof(buff), "read record type: %u LSN: (%lu,0x%lx)",
rec->type, (ulong) LSN_FILE_NO(rec->lsn),
(ulong) LSN_OFFSET(rec->lsn));
ok(1, buff);
}
/* /*
Read whole record content, and check content (put with offset) Read whole record content, and check content (put with offset)
...@@ -92,6 +114,7 @@ static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec, ...@@ -92,6 +114,7 @@ static my_bool read_and_check_content(TRANSLOG_HEADER_BUFFER *rec,
return check_content(buffer + skip, rec->record_length - skip); return check_content(buffer + skip, rec->record_length - skip);
} }
int main(int argc __attribute__((unused)), char *argv[]) int main(int argc __attribute__((unused)), char *argv[])
{ {
uint32 i; uint32 i;
...@@ -156,6 +179,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -156,6 +179,7 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
plan(((ITERATIONS - 1) * 4 + 1)*2 + ITERATIONS - 1); plan(((ITERATIONS - 1) * 4 + 1)*2 + ITERATIONS - 1);
...@@ -167,16 +191,16 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -167,16 +191,16 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
0, NULL, NULL, 0, NULL, NULL,
6, TRANSLOG_INTERNAL_PARTS + 1, parts)) 6, TRANSLOG_INTERNAL_PARTS + 1, parts))
{ {
fprintf(stderr, "Can't write record #%lu\n", (ulong) 0); fprintf(stderr, "Can't write record #%lu\n", (ulong) 0);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_LONG_TRANSACTION_ID"); ok(0, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_LONG_TRANSACTION_ID"); ok(1, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
lsn_base= first_lsn= lsn; lsn_base= first_lsn= lsn;
for (i= 1; i < ITERATIONS; i++) for (i= 1; i < ITERATIONS; i++)
...@@ -189,16 +213,17 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -189,16 +213,17 @@ int main(int argc __attribute__((unused)), char *argv[])
/* check auto-count feature */ /* check auto-count feature */
parts[TRANSLOG_INTERNAL_PARTS + 1].str= NULL; parts[TRANSLOG_INTERNAL_PARTS + 1].str= NULL;
parts[TRANSLOG_INTERNAL_PARTS + 1].length= 0; parts[TRANSLOG_INTERNAL_PARTS + 1].length= 0;
if (translog_write_record(&lsn, LOGREC_CLR_END, (i % 0xFFFF), NULL, if (translog_write_record(&lsn, LOGREC_FIXED_RECORD_1LSN_EXAMPLE,
(i % 0xFFFF), NULL,
NULL, LSN_STORE_SIZE, 0, parts)) NULL, LSN_STORE_SIZE, 0, parts))
{ {
fprintf(stderr, "1 Can't write reference defore record #%lu\n", fprintf(stderr, "1 Can't write reference defore record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_CLR_END"); ok(0, "write LOGREC_FIXED_RECORD_1LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_CLR_END"); ok(1, "write LOGREC_FIXED_RECORD_1LSN_EXAMPLE");
lsn_store(lsn_buff, lsn_base); lsn_store(lsn_buff, lsn_base);
if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 12) if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 12)
rec_len= 12; rec_len= 12;
...@@ -208,7 +233,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -208,7 +233,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len; parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
/* check record length auto-counting */ /* check record length auto-counting */
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_UNDO_KEY_INSERT, LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE,
(i % 0xFFFF), (i % 0xFFFF),
NULL, NULL, 0, TRANSLOG_INTERNAL_PARTS + 2, NULL, NULL, 0, TRANSLOG_INTERNAL_PARTS + 2,
parts)) parts))
...@@ -216,10 +241,10 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -216,10 +241,10 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "1 Can't write var reference defore record #%lu\n", fprintf(stderr, "1 Can't write var reference defore record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_UNDO_KEY_INSERT"); ok(0, "write LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_UNDO_KEY_INSERT"); ok(1, "write LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE");
} }
else else
{ {
...@@ -228,17 +253,17 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -228,17 +253,17 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 23; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 23;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_UNDO_ROW_DELETE, LOGREC_FIXED_RECORD_2LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, (i % 0xFFFF), NULL, NULL,
23, TRANSLOG_INTERNAL_PARTS + 1, parts)) 23, TRANSLOG_INTERNAL_PARTS + 1, parts))
{ {
fprintf(stderr, "0 Can't write reference defore record #%lu\n", fprintf(stderr, "0 Can't write reference defore record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_UNDO_ROW_DELETE"); ok(0, "write LOGREC_FIXED_RECORD_2LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_UNDO_ROW_DELETE"); ok(1, "write LOGREC_FIXED_RECORD_2LSN_EXAMPLE");
lsn_store(lsn_buff, lsn_base); lsn_store(lsn_buff, lsn_base);
lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn); lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn);
if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 19) if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 19)
...@@ -248,7 +273,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -248,7 +273,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer; parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len; parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_UNDO_KEY_DELETE, LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE,
(i % 0xFFFF), (i % 0xFFFF),
NULL, NULL, 14 + rec_len, NULL, NULL, 14 + rec_len,
TRANSLOG_INTERNAL_PARTS + 2, parts)) TRANSLOG_INTERNAL_PARTS + 2, parts))
...@@ -256,26 +281,26 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -256,26 +281,26 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "0 Can't write var reference defore record #%lu\n", fprintf(stderr, "0 Can't write var reference defore record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_UNDO_KEY_DELETE"); ok(0, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_UNDO_KEY_DELETE"); ok(1, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
} }
int4store(long_tr_id, i); int4store(long_tr_id, i);
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, 6, (i % 0xFFFF), NULL, NULL, 6,
TRANSLOG_INTERNAL_PARTS + 1, TRANSLOG_INTERNAL_PARTS + 1,
parts)) parts))
{ {
fprintf(stderr, "Can't write record #%lu\n", (ulong) i); fprintf(stderr, "Can't write record #%lu\n", (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_LONG_TRANSACTION_ID"); ok(0, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_LONG_TRANSACTION_ID"); ok(1, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
lsn_base= lsn; lsn_base= lsn;
...@@ -284,17 +309,17 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -284,17 +309,17 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= rec_len; parts[TRANSLOG_INTERNAL_PARTS + 0].length= rec_len;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_REDO_INSERT_ROW_HEAD, LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, rec_len, (i % 0xFFFF), NULL, NULL, rec_len,
TRANSLOG_INTERNAL_PARTS + 1, TRANSLOG_INTERNAL_PARTS + 1,
parts)) parts))
{ {
fprintf(stderr, "Can't write variable record #%lu\n", (ulong) i); fprintf(stderr, "Can't write variable record #%lu\n", (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_REDO_INSERT_ROW_HEAD"); ok(0, "write LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_REDO_INSERT_ROW_HEAD"); ok(1, "write LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE");
if (translog_flush(lsn)) if (translog_flush(lsn))
{ {
fprintf(stderr, "Can't flush #%lu\n", (ulong) i); fprintf(stderr, "Can't flush #%lu\n", (ulong) i);
...@@ -327,6 +352,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -327,6 +352,7 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
srandom(122334817L); srandom(122334817L);
...@@ -339,12 +365,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -339,12 +365,13 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "translog_read_record_header failed (%d)\n", errno); fprintf(stderr, "translog_read_record_header failed (%d)\n", errno);
goto err; goto err;
} }
if (rec.type !=LOGREC_LONG_TRANSACTION_ID || rec.short_trid != 0 || if (rec.type !=LOGREC_FIXED_RECORD_0LSN_EXAMPLE || rec.short_trid != 0 ||
rec.record_length != 6 || uint4korr(rec.header) != 0 || rec.record_length != 6 || uint4korr(rec.header) != 0 ||
((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF || ((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF ||
first_lsn != rec.lsn) first_lsn != rec.lsn)
{ {
fprintf(stderr, "Incorrect LOGREC_LONG_TRANSACTION_ID data read(0)\n" fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_0LSN_EXAMPLE "
"data read(0)\n"
"type %u, strid %u, len %u, i: %u, 4: %u 5: %u, " "type %u, strid %u, len %u, i: %u, 4: %u 5: %u, "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
(uint) rec.type, (uint) rec.short_trid, (uint) rec.record_length, (uint) rec.type, (uint) rec.short_trid, (uint) rec.record_length,
...@@ -353,7 +380,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -353,7 +380,7 @@ int main(int argc __attribute__((unused)), char *argv[])
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
goto err; goto err;
} }
ok(1, "read record"); read_ok(&rec);
translog_free_record_header(&rec); translog_free_record_header(&rec);
lsn= first_lsn; lsn= first_lsn;
if (translog_init_scanner(first_lsn, 1, &scanner)) if (translog_init_scanner(first_lsn, 1, &scanner))
...@@ -384,10 +411,12 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -384,10 +411,12 @@ int main(int argc __attribute__((unused)), char *argv[])
{ {
LSN ref; LSN ref;
ref= lsn_korr(rec.header); ref= lsn_korr(rec.header);
if (rec.type !=LOGREC_CLR_END || rec.short_trid != (i % 0xFFFF) || if (rec.type != LOGREC_FIXED_RECORD_1LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) ||
rec.record_length != 7 || ref != lsn) rec.record_length != 7 || ref != lsn)
{ {
fprintf(stderr, "Incorrect LOGREC_CLR_END data read(%d) " fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_1LSN_EXAMPLE "
"data read(%d) "
"type: %u strid: %u len: %u" "type: %u strid: %u len: %u"
"ref: (%lu,0x%lx) (%lu,0x%lx) " "ref: (%lu,0x%lx) (%lu,0x%lx) "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
...@@ -404,7 +433,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -404,7 +433,7 @@ int main(int argc __attribute__((unused)), char *argv[])
LSN ref1, ref2; LSN ref1, ref2;
ref1= lsn_korr(rec.header); ref1= lsn_korr(rec.header);
ref2= lsn_korr(rec.header + LSN_STORE_SIZE); ref2= lsn_korr(rec.header + LSN_STORE_SIZE);
if (rec.type != LOGREC_UNDO_ROW_DELETE || if (rec.type != LOGREC_FIXED_RECORD_2LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != 23 || rec.record_length != 23 ||
ref1 != lsn || ref1 != lsn ||
...@@ -419,7 +448,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -419,7 +448,8 @@ int main(int argc __attribute__((unused)), char *argv[])
((uchar)rec.header[15]) != 0xAA || ((uchar)rec.header[15]) != 0xAA ||
((uchar)rec.header[14]) != 0x55) ((uchar)rec.header[14]) != 0x55)
{ {
fprintf(stderr, "Incorrect LOGREC_UNDO_ROW_DELETE data read(%d)" fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_2LSN_EXAMPLE "
"data read(%d) "
"type %u, strid %u, len %u, ref1(%lu,0x%lx), " "type %u, strid %u, len %u, ref1(%lu,0x%lx), "
"ref2(%lu,0x%lx) %x%x%x%x%x%x%x%x%x " "ref2(%lu,0x%lx) %x%x%x%x%x%x%x%x%x "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
...@@ -436,7 +466,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -436,7 +466,7 @@ int main(int argc __attribute__((unused)), char *argv[])
goto err; goto err;
} }
} }
ok(1, "read record"); read_ok(&rec);
translog_free_record_header(&rec); translog_free_record_header(&rec);
len= translog_read_next_record_header(&scanner, &rec); len= translog_read_next_record_header(&scanner, &rec);
...@@ -458,18 +488,19 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -458,18 +488,19 @@ int main(int argc __attribute__((unused)), char *argv[])
ref= lsn_korr(rec.header); ref= lsn_korr(rec.header);
if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 12) if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 12)
rec_len= 12; rec_len= 12;
if (rec.type !=LOGREC_UNDO_KEY_INSERT || if (rec.type != LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != rec_len + LSN_STORE_SIZE || rec.record_length != rec_len + LSN_STORE_SIZE ||
len != 12 || ref != lsn || len != 12 || ref != lsn ||
check_content(rec.header + LSN_STORE_SIZE, len - LSN_STORE_SIZE)) check_content(rec.header + LSN_STORE_SIZE, len - LSN_STORE_SIZE))
{ {
fprintf(stderr, "Incorrect LOGREC_UNDO_KEY_INSERT data read(%d)" fprintf(stderr, "Incorrect LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE "
"data read(%d)"
"type %u (%d), strid %u (%d), len %lu, %lu + 7 (%d), " "type %u (%d), strid %u (%d), len %lu, %lu + 7 (%d), "
"hdr len: %u (%d), " "hdr len: %u (%d), "
"ref(%lu,0x%lx), lsn(%lu,0x%lx) (%d), content: %d\n", "ref(%lu,0x%lx), lsn(%lu,0x%lx) (%d), content: %d\n",
i, (uint) rec.type, i, (uint) rec.type,
rec.type !=LOGREC_UNDO_KEY_INSERT, rec.type != LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE,
(uint) rec.short_trid, (uint) rec.short_trid,
rec.short_trid != (i % 0xFFFF), rec.short_trid != (i % 0xFFFF),
(ulong) rec.record_length, (ulong) rec_len, (ulong) rec.record_length, (ulong) rec_len,
...@@ -486,8 +517,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -486,8 +517,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE)) if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_UNDO_KEY_INSERT in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
goto err; goto err;
} }
...@@ -499,7 +530,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -499,7 +530,7 @@ int main(int argc __attribute__((unused)), char *argv[])
ref2= lsn_korr(rec.header + LSN_STORE_SIZE); ref2= lsn_korr(rec.header + LSN_STORE_SIZE);
if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 19) if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 19)
rec_len= 19; rec_len= 19;
if (rec.type !=LOGREC_UNDO_KEY_DELETE || if (rec.type != LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != rec_len + LSN_STORE_SIZE * 2 || rec.record_length != rec_len + LSN_STORE_SIZE * 2 ||
len != 19 || len != 19 ||
...@@ -508,7 +539,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -508,7 +539,8 @@ int main(int argc __attribute__((unused)), char *argv[])
check_content(rec.header + LSN_STORE_SIZE * 2, check_content(rec.header + LSN_STORE_SIZE * 2,
len - LSN_STORE_SIZE * 2)) len - LSN_STORE_SIZE * 2))
{ {
fprintf(stderr, "Incorrect LOGREC_UNDO_KEY_DELETE data read(%d)" fprintf(stderr, "Incorrect LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE "
"data read(%d) "
"type %u, strid %u, len %lu != %lu + 14, hdr len: %u, " "type %u, strid %u, len %lu != %lu + 14, hdr len: %u, "
"ref1(%lu,0x%lx), ref2(%lu,0x%lx), " "ref1(%lu,0x%lx), ref2(%lu,0x%lx), "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
...@@ -523,13 +555,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -523,13 +555,13 @@ int main(int argc __attribute__((unused)), char *argv[])
if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE * 2)) if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE * 2))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_UNDO_KEY_DELETE in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
goto err; goto err;
} }
} }
ok(1, "read record"); read_ok(&rec);
translog_free_record_header(&rec); translog_free_record_header(&rec);
len= translog_read_next_record_header(&scanner, &rec); len= translog_read_next_record_header(&scanner, &rec);
...@@ -545,12 +577,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -545,12 +577,13 @@ int main(int argc __attribute__((unused)), char *argv[])
"instead of beginning of %u\n", i, ITERATIONS); "instead of beginning of %u\n", i, ITERATIONS);
goto err; goto err;
} }
if (rec.type !=LOGREC_LONG_TRANSACTION_ID || if (rec.type != LOGREC_FIXED_RECORD_0LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != 6 || uint4korr(rec.header) != i || rec.record_length != 6 || uint4korr(rec.header) != i ||
((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF) ((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF)
{ {
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, len %u, i: %u, 4: %u 5: %u " "type %u, strid %u, len %u, i: %u, 4: %u 5: %u "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
i, (uint) rec.type, (uint) rec.short_trid, i, (uint) rec.type, (uint) rec.short_trid,
...@@ -561,18 +594,19 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -561,18 +594,19 @@ int main(int argc __attribute__((unused)), char *argv[])
goto err; goto err;
} }
lsn= rec.lsn; lsn= rec.lsn;
ok(1, "read record"); read_ok(&rec);
translog_free_record_header(&rec); translog_free_record_header(&rec);
len= translog_read_next_record_header(&scanner, &rec); len= translog_read_next_record_header(&scanner, &rec);
if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 9) if ((rec_len= random() / (RAND_MAX / (LONG_BUFFER_SIZE + 1))) < 9)
rec_len= 9; rec_len= 9;
if (rec.type !=LOGREC_REDO_INSERT_ROW_HEAD || if (rec.type != LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != rec_len || rec.record_length != rec_len ||
len != 9 || check_content(rec.header, len)) len != 9 || check_content(rec.header, len))
{ {
fprintf(stderr, "Incorrect LOGREC_REDO_INSERT_ROW_HEAD data read(%d)" fprintf(stderr, "Incorrect LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE "
"data read(%d) "
"type %u, strid %u, len %lu != %lu, hdr len: %u, " "type %u, strid %u, len %lu != %lu, hdr len: %u, "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
i, (uint) rec.type, (uint) rec.short_trid, i, (uint) rec.type, (uint) rec.short_trid,
...@@ -584,12 +618,12 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -584,12 +618,12 @@ int main(int argc __attribute__((unused)), char *argv[])
if (read_and_check_content(&rec, long_buffer, 0)) if (read_and_check_content(&rec, long_buffer, 0))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_UNDO_KEY_DELETE in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
goto err; goto err;
} }
ok(1, "read record"); read_ok(&rec);
translog_free_record_header(&rec); translog_free_record_header(&rec);
} }
} }
......
...@@ -176,6 +176,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -176,6 +176,7 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
plan(((ITERATIONS - 1) * 4 + 1) * 2); plan(((ITERATIONS - 1) * 4 + 1) * 2);
...@@ -186,15 +187,16 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -186,15 +187,16 @@ int main(int argc __attribute__((unused)), char *argv[])
int4store(long_tr_id, 0); int4store(long_tr_id, 0);
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn, LOGREC_LONG_TRANSACTION_ID, 0, NULL, NULL, if (translog_write_record(&lsn, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
0, NULL, NULL,
6, TRANSLOG_INTERNAL_PARTS + 1, parts)) 6, TRANSLOG_INTERNAL_PARTS + 1, parts))
{ {
fprintf(stderr, "Can't write record #%lu\n", (ulong) 0); fprintf(stderr, "Can't write record #%lu\n", (ulong) 0);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_LONG_TRANSACTION_ID"); ok(0, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_LONG_TRANSACTION_ID"); ok(1, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
lsn_base= first_lsn= lsn; lsn_base= first_lsn= lsn;
for (i= 1; i < ITERATIONS; i++) for (i= 1; i < ITERATIONS; i++)
...@@ -205,7 +207,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -205,7 +207,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE; parts[TRANSLOG_INTERNAL_PARTS + 0].length= LSN_STORE_SIZE;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_CLR_END, LOGREC_FIXED_RECORD_1LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, (i % 0xFFFF), NULL, NULL,
LSN_STORE_SIZE, LSN_STORE_SIZE,
TRANSLOG_INTERNAL_PARTS + 1, parts)) TRANSLOG_INTERNAL_PARTS + 1, parts))
...@@ -213,10 +215,10 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -213,10 +215,10 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "1 Can't write reference before record #%lu\n", fprintf(stderr, "1 Can't write reference before record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_CLR_END"); ok(0, "write LOGREC_FIXED_RECORD_1LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_CLR_END"); ok(1, "write LOGREC_FIXED_RECORD_1LSN_EXAMPLE");
lsn_store(lsn_buff, lsn_base); lsn_store(lsn_buff, lsn_base);
rec_len= get_len(); rec_len= get_len();
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)lsn_buff;
...@@ -224,7 +226,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -224,7 +226,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer; parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len; parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_UNDO_KEY_INSERT, LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE,
(i % 0xFFFF), (i % 0xFFFF),
NULL, NULL, LSN_STORE_SIZE + rec_len, NULL, NULL, LSN_STORE_SIZE + rec_len,
TRANSLOG_INTERNAL_PARTS + 2, TRANSLOG_INTERNAL_PARTS + 2,
...@@ -233,10 +235,10 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -233,10 +235,10 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "1 Can't write var reference before record #%lu\n", fprintf(stderr, "1 Can't write var reference before record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_UNDO_KEY_INSERT"); ok(0, "write LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_UNDO_KEY_INSERT"); ok(1, "write LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE");
} }
else else
{ {
...@@ -245,7 +247,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -245,7 +247,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)lsn_buff; parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)lsn_buff;
parts[TRANSLOG_INTERNAL_PARTS + 1].length= 23; parts[TRANSLOG_INTERNAL_PARTS + 1].length= 23;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_UNDO_ROW_DELETE, LOGREC_FIXED_RECORD_2LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, 23, (i % 0xFFFF), NULL, NULL, 23,
TRANSLOG_INTERNAL_PARTS + 1, TRANSLOG_INTERNAL_PARTS + 1,
parts)) parts))
...@@ -253,10 +255,10 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -253,10 +255,10 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "0 Can't write reference before record #%lu\n", fprintf(stderr, "0 Can't write reference before record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_UNDO_ROW_DELETE"); ok(0, "write LOGREC_FIXED_RECORD_2LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_UNDO_ROW_DELETE"); ok(1, "write LOGREC_FIXED_RECORD_2LSN_EXAMPLE");
lsn_store(lsn_buff, lsn_base); lsn_store(lsn_buff, lsn_base);
lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn); lsn_store(lsn_buff + LSN_STORE_SIZE, first_lsn);
rec_len= get_len(); rec_len= get_len();
...@@ -265,7 +267,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -265,7 +267,7 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer; parts[TRANSLOG_INTERNAL_PARTS + 1].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len; parts[TRANSLOG_INTERNAL_PARTS + 1].length= rec_len;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_UNDO_KEY_DELETE, LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE,
(i % 0xFFFF), (i % 0xFFFF),
NULL, NULL, LSN_STORE_SIZE * 2 + rec_len, NULL, NULL, LSN_STORE_SIZE * 2 + rec_len,
TRANSLOG_INTERNAL_PARTS + 2, TRANSLOG_INTERNAL_PARTS + 2,
...@@ -274,25 +276,25 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -274,25 +276,25 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "0 Can't write var reference before record #%lu\n", fprintf(stderr, "0 Can't write var reference before record #%lu\n",
(ulong) i); (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_UNDO_KEY_DELETE"); ok(0, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_UNDO_KEY_DELETE"); ok(1, "write LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE");
} }
int4store(long_tr_id, i); int4store(long_tr_id, i);
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, 6, (i % 0xFFFF), NULL, NULL, 6,
TRANSLOG_INTERNAL_PARTS + 1, parts)) TRANSLOG_INTERNAL_PARTS + 1, parts))
{ {
fprintf(stderr, "Can't write record #%lu\n", (ulong) i); fprintf(stderr, "Can't write record #%lu\n", (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_LONG_TRANSACTION_ID"); ok(0, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_LONG_TRANSACTION_ID"); ok(1, "write LOGREC_FIXED_RECORD_0LSN_EXAMPLE");
lsn_base= lsn; lsn_base= lsn;
...@@ -300,16 +302,16 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -300,16 +302,16 @@ int main(int argc __attribute__((unused)), char *argv[])
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= rec_len; parts[TRANSLOG_INTERNAL_PARTS + 0].length= rec_len;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_REDO_INSERT_ROW_HEAD, LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE,
(i % 0xFFFF), NULL, NULL, rec_len, (i % 0xFFFF), NULL, NULL, rec_len,
TRANSLOG_INTERNAL_PARTS + 1, parts)) TRANSLOG_INTERNAL_PARTS + 1, parts))
{ {
fprintf(stderr, "Can't write variable record #%lu\n", (ulong) i); fprintf(stderr, "Can't write variable record #%lu\n", (ulong) i);
translog_destroy(); translog_destroy();
ok(0, "write LOGREC_REDO_INSERT_ROW_HEAD"); ok(0, "write LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE");
exit(1); exit(1);
} }
ok(1, "write LOGREC_REDO_INSERT_ROW_HEAD"); ok(1, "write LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE");
} }
translog_destroy(); translog_destroy();
...@@ -333,6 +335,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -333,6 +335,7 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
srandom(122334817L); srandom(122334817L);
...@@ -346,12 +349,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -346,12 +349,13 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_free_record_header(&rec); translog_free_record_header(&rec);
goto err; goto err;
} }
if (rec.type !=LOGREC_LONG_TRANSACTION_ID || rec.short_trid != 0 || if (rec.type !=LOGREC_FIXED_RECORD_0LSN_EXAMPLE || rec.short_trid != 0 ||
rec.record_length != 6 || uint4korr(rec.header) != 0 || rec.record_length != 6 || uint4korr(rec.header) != 0 ||
((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF || ((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF ||
first_lsn != rec.lsn) first_lsn != rec.lsn)
{ {
fprintf(stderr, "Incorrect LOGREC_LONG_TRANSACTION_ID data read(0)\n" fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_0LSN_EXAMPLE "
"data read(0)\n"
"type %u, strid %u, len %u, i: %u, 4: %u 5: %u, " "type %u, strid %u, len %u, i: %u, 4: %u 5: %u, "
"lsn(0x%lu,0x%lx)\n", "lsn(0x%lu,0x%lx)\n",
(uint) rec.type, (uint) rec.short_trid, (uint) rec.record_length, (uint) rec.type, (uint) rec.short_trid, (uint) rec.record_length,
...@@ -395,10 +399,12 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -395,10 +399,12 @@ int main(int argc __attribute__((unused)), char *argv[])
{ {
LSN ref; LSN ref;
ref= lsn_korr(rec.header); ref= lsn_korr(rec.header);
if (rec.type != LOGREC_CLR_END || rec.short_trid != (i % 0xFFFF) || if (rec.type != LOGREC_FIXED_RECORD_1LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) ||
rec.record_length != LSN_STORE_SIZE || ref != lsn) rec.record_length != LSN_STORE_SIZE || ref != lsn)
{ {
fprintf(stderr, "Incorrect LOGREC_CLR_END data read(%d)" fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_1LSN_EXAMPLE "
"data read(%d)"
"type %u, strid %u, len %u, ref(%lu,0x%lx), lsn(%lu,0x%lx)\n", "type %u, strid %u, len %u, ref(%lu,0x%lx), lsn(%lu,0x%lx)\n",
i, (uint) rec.type, (uint) rec.short_trid, i, (uint) rec.type, (uint) rec.short_trid,
(uint) rec.record_length, (uint) rec.record_length,
...@@ -413,7 +419,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -413,7 +419,7 @@ int main(int argc __attribute__((unused)), char *argv[])
LSN ref1, ref2; LSN ref1, ref2;
ref1= lsn_korr(rec.header); ref1= lsn_korr(rec.header);
ref2= lsn_korr(rec.header + LSN_STORE_SIZE); ref2= lsn_korr(rec.header + LSN_STORE_SIZE);
if (rec.type !=LOGREC_UNDO_ROW_DELETE || if (rec.type != LOGREC_FIXED_RECORD_2LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != 23 || rec.record_length != 23 ||
ref1 != lsn || ref1 != lsn ||
...@@ -428,7 +434,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -428,7 +434,8 @@ int main(int argc __attribute__((unused)), char *argv[])
((uchar)rec.header[15]) != 0xAA || ((uchar)rec.header[15]) != 0xAA ||
((uchar)rec.header[14]) != 0x55) ((uchar)rec.header[14]) != 0x55)
{ {
fprintf(stderr, "Incorrect LOGREC_UNDO_ROW_DELETE data read(%d)" fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_2LSN_EXAMPLE "
"data read(%d) "
"type %u, strid %u, len %u, ref1(%lu,0x%lx), " "type %u, strid %u, len %u, ref1(%lu,0x%lx), "
"ref2(%lu,0x%lx) %x%x%x%x%x%x%x%x%x " "ref2(%lu,0x%lx) %x%x%x%x%x%x%x%x%x "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
...@@ -467,18 +474,19 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -467,18 +474,19 @@ int main(int argc __attribute__((unused)), char *argv[])
LSN ref; LSN ref;
ref= lsn_korr(rec.header); ref= lsn_korr(rec.header);
rec_len= get_len(); rec_len= get_len();
if (rec.type !=LOGREC_UNDO_KEY_INSERT || if (rec.type !=LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != rec_len + LSN_STORE_SIZE || rec.record_length != rec_len + LSN_STORE_SIZE ||
len != 12 || ref != lsn || len != 12 || ref != lsn ||
check_content(rec.header + LSN_STORE_SIZE, len - LSN_STORE_SIZE)) check_content(rec.header + LSN_STORE_SIZE, len - LSN_STORE_SIZE))
{ {
fprintf(stderr, "Incorrect LOGREC_UNDO_KEY_INSERT data read(%d)" fprintf(stderr, "Incorrect LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE "
"data read(%d)"
"type %u (%d), strid %u (%d), len %lu, %lu + 7 (%d), " "type %u (%d), strid %u (%d), len %lu, %lu + 7 (%d), "
"hdr len: %u (%d), " "hdr len: %u (%d), "
"ref(%lu,0x%lx), lsn(%lu,0x%lx) (%d), content: %d\n", "ref(%lu,0x%lx), lsn(%lu,0x%lx) (%d), content: %d\n",
i, (uint) rec.type, i, (uint) rec.type,
rec.type !=LOGREC_UNDO_KEY_INSERT, rec.type !=LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE,
(uint) rec.short_trid, (uint) rec.short_trid,
rec.short_trid != (i % 0xFFFF), rec.short_trid != (i % 0xFFFF),
(ulong) rec.record_length, (ulong) rec_len, (ulong) rec.record_length, (ulong) rec_len,
...@@ -496,8 +504,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -496,8 +504,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE)) if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_UNDO_KEY_INSERT in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_1LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
translog_free_record_header(&rec); translog_free_record_header(&rec);
goto err; goto err;
...@@ -509,7 +517,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -509,7 +517,7 @@ int main(int argc __attribute__((unused)), char *argv[])
ref1= lsn_korr(rec.header); ref1= lsn_korr(rec.header);
ref2= lsn_korr(rec.header + LSN_STORE_SIZE); ref2= lsn_korr(rec.header + LSN_STORE_SIZE);
rec_len= get_len(); rec_len= get_len();
if (rec.type !=LOGREC_UNDO_KEY_DELETE || if (rec.type != LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != rec_len + LSN_STORE_SIZE * 2 || rec.record_length != rec_len + LSN_STORE_SIZE * 2 ||
len != 19 || len != 19 ||
...@@ -518,7 +526,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -518,7 +526,8 @@ int main(int argc __attribute__((unused)), char *argv[])
check_content(rec.header + LSN_STORE_SIZE * 2, check_content(rec.header + LSN_STORE_SIZE * 2,
len - LSN_STORE_SIZE * 2)) len - LSN_STORE_SIZE * 2))
{ {
fprintf(stderr, "Incorrect LOGREC_UNDO_KEY_DELETE data read(%d)" fprintf(stderr, "Incorrect LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE "
" data read(%d) "
"type %u, strid %u, len %lu != %lu + 14, hdr len: %u, " "type %u, strid %u, len %lu != %lu + 14, hdr len: %u, "
"ref1(%lu,0x%lx), ref2(%lu,0x%lx), " "ref1(%lu,0x%lx), ref2(%lu,0x%lx), "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
...@@ -534,8 +543,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -534,8 +543,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE * 2)) if (read_and_check_content(&rec, long_buffer, LSN_STORE_SIZE * 2))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_UNDO_KEY_DELETE in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
translog_free_record_header(&rec); translog_free_record_header(&rec);
goto err; goto err;
...@@ -559,12 +568,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -559,12 +568,13 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_free_record_header(&rec); translog_free_record_header(&rec);
goto err; goto err;
} }
if (rec.type !=LOGREC_LONG_TRANSACTION_ID || if (rec.type != LOGREC_FIXED_RECORD_0LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != 6 || uint4korr(rec.header) != i || rec.record_length != 6 || uint4korr(rec.header) != i ||
((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF) ((uchar)rec.header[4]) != 0 || ((uchar)rec.header[5]) != 0xFF)
{ {
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, len %u, i: %u, 4: %u 5: %u " "type %u, strid %u, len %u, i: %u, 4: %u 5: %u "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
i, (uint) rec.type, (uint) rec.short_trid, i, (uint) rec.type, (uint) rec.short_trid,
...@@ -582,12 +592,13 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -582,12 +592,13 @@ int main(int argc __attribute__((unused)), char *argv[])
len= translog_read_next_record_header(&scanner, &rec); len= translog_read_next_record_header(&scanner, &rec);
rec_len= get_len(); rec_len= get_len();
if (rec.type !=LOGREC_REDO_INSERT_ROW_HEAD || if (rec.type != LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE ||
rec.short_trid != (i % 0xFFFF) || rec.short_trid != (i % 0xFFFF) ||
rec.record_length != rec_len || rec.record_length != rec_len ||
len != 9 || check_content(rec.header, len)) len != 9 || check_content(rec.header, len))
{ {
fprintf(stderr, "Incorrect LOGREC_REDO_INSERT_ROW_HEAD data read(%d)" fprintf(stderr, "Incorrect LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE "
"data read(%d) "
"type %u, strid %u, len %lu != %lu, hdr len: %u, " "type %u, strid %u, len %lu != %lu, hdr len: %u, "
"lsn(%lu,0x%lx)\n", "lsn(%lu,0x%lx)\n",
i, (uint) rec.type, (uint) rec.short_trid, i, (uint) rec.type, (uint) rec.short_trid,
...@@ -600,8 +611,8 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -600,8 +611,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (read_and_check_content(&rec, long_buffer, 0)) if (read_and_check_content(&rec, long_buffer, 0))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_UNDO_KEY_DELETE in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_OFFSET(rec.lsn));
translog_free_record_header(&rec); translog_free_record_header(&rec);
goto err; goto err;
......
...@@ -131,11 +131,11 @@ void writer(int num) ...@@ -131,11 +131,11 @@ void writer(int num)
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
num, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1, num, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1,
parts)) 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); "thread %i\n", (ulong) i, num);
translog_destroy(); translog_destroy();
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
...@@ -147,7 +147,7 @@ void writer(int num) ...@@ -147,7 +147,7 @@ void writer(int num)
parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer; parts[TRANSLOG_INTERNAL_PARTS + 0].str= (char*)long_buffer;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= len; parts[TRANSLOG_INTERNAL_PARTS + 0].length= len;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_REDO_INSERT_ROW_HEAD, LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE,
num, NULL, NULL, num, NULL, NULL,
len, TRANSLOG_INTERNAL_PARTS + 1, len, TRANSLOG_INTERNAL_PARTS + 1,
parts)) parts))
...@@ -283,6 +283,7 @@ int main(int argc __attribute__((unused)), ...@@ -283,6 +283,7 @@ int main(int argc __attribute__((unused)),
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
srandom(122334817L); srandom(122334817L);
{ {
...@@ -295,7 +296,7 @@ int main(int argc __attribute__((unused)), ...@@ -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].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&first_lsn, if (translog_write_record(&first_lsn,
LOGREC_LONG_TRANSACTION_ID, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
0, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1, 0, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1,
parts)) parts))
{ {
...@@ -393,13 +394,14 @@ int main(int argc __attribute__((unused)), ...@@ -393,13 +394,14 @@ int main(int argc __attribute__((unused)),
stage= indeces[rec.short_trid] % 2; stage= indeces[rec.short_trid] % 2;
if (stage == 0) if (stage == 0)
{ {
if (rec.type !=LOGREC_LONG_TRANSACTION_ID || if (rec.type !=LOGREC_FIXED_RECORD_0LSN_EXAMPLE ||
rec.record_length != 6 || rec.record_length != 6 ||
uint2korr(rec.header) != rec.short_trid || uint2korr(rec.header) != rec.short_trid ||
index != uint4korr(rec.header + 2) || index != uint4korr(rec.header + 2) ||
cmp_translog_addr(lsns1[rec.short_trid][index], rec.lsn) != 0) 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, " "type %u, strid %u %u, len %u, i: %u %u, "
"lsn(%lu,0x%lx) (%lu,0x%lx)\n", "lsn(%lu,0x%lx) (%lu,0x%lx)\n",
i, (uint) rec.type, i, (uint) rec.type,
...@@ -416,19 +418,21 @@ int main(int argc __attribute__((unused)), ...@@ -416,19 +418,21 @@ int main(int argc __attribute__((unused)),
} }
else else
{ {
if (rec.type !=LOGREC_REDO_INSERT_ROW_HEAD || if (rec.type != LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE ||
len != 9 || len != 9 ||
rec.record_length != lens[rec.short_trid][index] || rec.record_length != lens[rec.short_trid][index] ||
cmp_translog_addr(lsns2[rec.short_trid][index], rec.lsn) != 0 || cmp_translog_addr(lsns2[rec.short_trid][index], rec.lsn) != 0 ||
check_content(rec.header, len)) check_content(rec.header, len))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_REDO_INSERT_ROW_HEAD data read(%d) " "Incorrect LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE "
" thread: %d, iteration %d, stage %d\n" "data read(%d) "
"thread: %d, iteration %d, stage %d\n"
"type %u (%d), len %u, length %lu %lu (%d) " "type %u (%d), len %u, length %lu %lu (%d) "
"lsn(%lu,0x%lx) (%lu,0x%lx)\n", "lsn(%lu,0x%lx) (%lu,0x%lx)\n",
i, (uint) rec.short_trid, index, stage, 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, (uint) len,
(ulong) rec.record_length, lens[rec.short_trid][index], (ulong) rec.record_length, lens[rec.short_trid][index],
(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)), ...@@ -442,8 +446,8 @@ int main(int argc __attribute__((unused)),
if (read_and_check_content(&rec, long_buffer, 0)) if (read_and_check_content(&rec, long_buffer, 0))
{ {
fprintf(stderr, fprintf(stderr,
"Incorrect LOGREC_REDO_INSERT_ROW_HEAD in whole rec read " "Incorrect LOGREC_VARIABLE_RECORD_0LSN_EXAMPLE "
"lsn(%lu,0x%lx)\n", "in whole rec read lsn(%lu,0x%lx)\n",
(ulong) LSN_FILE_NO(rec.lsn), (ulong) LSN_FILE_NO(rec.lsn),
(ulong) LSN_OFFSET(rec.lsn)); (ulong) LSN_OFFSET(rec.lsn));
translog_free_record_header(&rec); translog_free_record_header(&rec);
......
...@@ -72,6 +72,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -72,6 +72,7 @@ int main(int argc __attribute__((unused)), char *argv[])
translog_destroy(); translog_destroy();
exit(1); exit(1);
} }
example_loghandler_init();
if ((stat= my_stat(first_translog_file, &st, MYF(0))) == 0) if ((stat= my_stat(first_translog_file, &st, MYF(0))) == 0)
{ {
...@@ -89,7 +90,7 @@ int main(int argc __attribute__((unused)), char *argv[]) ...@@ -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].str= (char*)long_tr_id;
parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6; parts[TRANSLOG_INTERNAL_PARTS + 0].length= 6;
if (translog_write_record(&lsn, if (translog_write_record(&lsn,
LOGREC_LONG_TRANSACTION_ID, LOGREC_FIXED_RECORD_0LSN_EXAMPLE,
0, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1, 0, NULL, NULL, 6, TRANSLOG_INTERNAL_PARTS + 1,
parts)) 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