Commit bcd2de49 authored by unknown's avatar unknown

WL#3072 Maria recovery:

preparation to enable recoverability of the table's state, more exactly
info->state->checksum. This will require that info->state->checksum
be updated in a inwrite_hook when writing an UNDO record, thus
info->cur_row.checksum needs to be accessible to inwrite_hook, so we
make translog_write_record() accept a MARIA_HA* (info) instead of
MARIA_SHARE* (info->s); with this, we will be able to access
info->cur_row.checksum. Old code which needed the MARIA_SHARE
can derive it from MARIA_HA. Fix for typos and compiler warnings.


storage/maria/ma_blockrec.c:
  fix for new loghandler API. Removing strange lines (how could gcc
  accept that?)
storage/maria/ma_check.c:
  fix for new loghandler API
storage/maria/ma_delete_all.c:
  fix for new loghandler API
storage/maria/ma_loghandler.c:
  functions now take a MARIA_HA in argument, this is more powerful
  than a MARIA_SHARE (MARIA_SHARE can be derived from MARIA_HA, not
  the other way around). MARIA_HA will be needed to allow recoverability
  of the table's state.
  Fixing wrong DBUG_PRINT ('i' is not the id).
  When writing the LOGREC_FILE_ID, we don't have a MARIA_HA around,
  so we cannot ask translog_write_record() to store the id for us;
  we thus store the file's id by ourselves. Alternative would have been
  to pass MARIA_HA to translog_assign_id_to_share() but I didn't like it.
storage/maria/ma_loghandler.h:
  new loghandler API
storage/maria/tablockman.c:
  fix for compiler warning (intptr is int on my machine)
parent 13251c2a
...@@ -1143,7 +1143,7 @@ static my_bool write_tail(MARIA_HA *info, ...@@ -1143,7 +1143,7 @@ static my_bool write_tail(MARIA_HA *info,
MARIA_BITMAP_BLOCK *block, MARIA_BITMAP_BLOCK *block,
uchar *row_part, uint length) uchar *row_part, uint length)
{ {
MARIA_SHARE *share= share= info->s; MARIA_SHARE *share= info->s;
MARIA_PINNED_PAGE page_link; MARIA_PINNED_PAGE page_link;
uint block_size= share->block_size, empty_space; uint block_size= share->block_size, empty_space;
struct st_row_pos_info row_pos; struct st_row_pos_info row_pos;
...@@ -1179,7 +1179,7 @@ static my_bool write_tail(MARIA_HA *info, ...@@ -1179,7 +1179,7 @@ static my_bool write_tail(MARIA_HA *info,
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= (char*) row_pos.data; log_array[TRANSLOG_INTERNAL_PARTS + 1].str= (char*) row_pos.data;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length; log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length;
if (translog_write_record(&lsn, LOGREC_REDO_INSERT_ROW_TAIL, if (translog_write_record(&lsn, LOGREC_REDO_INSERT_ROW_TAIL,
info->trn, share, sizeof(log_data) + length, info->trn, info, sizeof(log_data) + length,
TRANSLOG_INTERNAL_PARTS + 2, log_array, TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data)) log_data))
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -1261,7 +1261,7 @@ static my_bool write_full_pages(MARIA_HA *info, ...@@ -1261,7 +1261,7 @@ static my_bool write_full_pages(MARIA_HA *info,
uchar *data, ulong length) uchar *data, ulong length)
{ {
my_off_t page; my_off_t page;
MARIA_SHARE *share= share= info->s; MARIA_SHARE *share= info->s;
uint block_size= share->block_size; uint block_size= share->block_size;
uint data_size= FULL_PAGE_SIZE(block_size); uint data_size= FULL_PAGE_SIZE(block_size);
uchar *buff= info->keyread_buff; uchar *buff= info->keyread_buff;
...@@ -1433,7 +1433,7 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row) ...@@ -1433,7 +1433,7 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row)
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= row->extents; log_array[TRANSLOG_INTERNAL_PARTS + 1].str= row->extents;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= extents_length; log_array[TRANSLOG_INTERNAL_PARTS + 1].length= extents_length;
if (translog_write_record(&lsn, LOGREC_REDO_PURGE_BLOCKS, info->trn, if (translog_write_record(&lsn, LOGREC_REDO_PURGE_BLOCKS, info->trn,
info->s, sizeof(log_data) + extents_length, info, sizeof(log_data) + extents_length,
TRANSLOG_INTERNAL_PARTS + 2, log_array, TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data)) log_data))
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -1479,7 +1479,7 @@ static my_bool free_full_page_range(MARIA_HA *info, ulonglong page, uint count) ...@@ -1479,7 +1479,7 @@ static my_bool free_full_page_range(MARIA_HA *info, ulonglong page, uint count)
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
if (translog_write_record(&lsn, LOGREC_REDO_PURGE_BLOCKS, if (translog_write_record(&lsn, LOGREC_REDO_PURGE_BLOCKS,
info->trn, info->s, sizeof(log_data), info->trn, info, sizeof(log_data),
TRANSLOG_INTERNAL_PARTS + 1, log_array, TRANSLOG_INTERNAL_PARTS + 1, log_array,
log_data)) log_data))
res= 1; res= 1;
...@@ -1994,7 +1994,7 @@ static my_bool write_block_record(MARIA_HA *info, ...@@ -1994,7 +1994,7 @@ static my_bool write_block_record(MARIA_HA *info,
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= (char*) row_pos->data; log_array[TRANSLOG_INTERNAL_PARTS + 1].str= (char*) row_pos->data;
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= data_length; log_array[TRANSLOG_INTERNAL_PARTS + 1].length= data_length;
if (translog_write_record(&lsn, LOGREC_REDO_INSERT_ROW_HEAD, info->trn, if (translog_write_record(&lsn, LOGREC_REDO_INSERT_ROW_HEAD, info->trn,
share, sizeof(log_data) + data_length, info, sizeof(log_data) + data_length,
TRANSLOG_INTERNAL_PARTS + 2, log_array, TRANSLOG_INTERNAL_PARTS + 2, log_array,
log_data)) log_data))
goto disk_err; goto disk_err;
...@@ -2111,7 +2111,7 @@ static my_bool write_block_record(MARIA_HA *info, ...@@ -2111,7 +2111,7 @@ static my_bool write_block_record(MARIA_HA *info,
/* trn->rec_lsn is already set earlier in this function */ /* trn->rec_lsn is already set earlier in this function */
error= translog_write_record(&lsn, LOGREC_REDO_INSERT_ROW_BLOBS, error= translog_write_record(&lsn, LOGREC_REDO_INSERT_ROW_BLOBS,
info->trn, share, log_entry_length, info->trn, info, log_entry_length,
(uint) (log_array_pos - log_array), (uint) (log_array_pos - log_array),
log_array, log_data); log_array, log_data);
if (log_array != tmp_log_array) if (log_array != tmp_log_array)
...@@ -2142,7 +2142,7 @@ static my_bool write_block_record(MARIA_HA *info, ...@@ -2142,7 +2142,7 @@ static my_bool write_block_record(MARIA_HA *info,
{ {
/* Write UNDO log record for the INSERT */ /* Write UNDO log record for the INSERT */
if (translog_write_record(&lsn, LOGREC_UNDO_ROW_INSERT, if (translog_write_record(&lsn, LOGREC_UNDO_ROW_INSERT,
info->trn, share, sizeof(log_data), info->trn, info, sizeof(log_data),
TRANSLOG_INTERNAL_PARTS + 1, log_array, TRANSLOG_INTERNAL_PARTS + 1, log_array,
log_data + LSN_STORE_SIZE)) log_data + LSN_STORE_SIZE))
goto disk_err; goto disk_err;
...@@ -2157,7 +2157,7 @@ static my_bool write_block_record(MARIA_HA *info, ...@@ -2157,7 +2157,7 @@ static my_bool write_block_record(MARIA_HA *info,
TRANSLOG_INTERNAL_PARTS + 1, TRANSLOG_INTERNAL_PARTS + 1,
&row_parts_count); &row_parts_count);
if (translog_write_record(&lsn, LOGREC_UNDO_ROW_UPDATE, info->trn, if (translog_write_record(&lsn, LOGREC_UNDO_ROW_UPDATE, info->trn,
share, sizeof(log_data) + row_length, info, sizeof(log_data) + row_length,
TRANSLOG_INTERNAL_PARTS + 1 + row_parts_count, TRANSLOG_INTERNAL_PARTS + 1 + row_parts_count,
log_array, log_data + LSN_STORE_SIZE)) log_array, log_data + LSN_STORE_SIZE))
goto disk_err; goto disk_err;
...@@ -2376,7 +2376,7 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info) ...@@ -2376,7 +2376,7 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
if (translog_write_record(&lsn, LOGREC_UNDO_ROW_PURGE, if (translog_write_record(&lsn, LOGREC_UNDO_ROW_PURGE,
info->trn, info->s, sizeof(log_data), info->trn, info, sizeof(log_data),
TRANSLOG_INTERNAL_PARTS + 1, log_array, TRANSLOG_INTERNAL_PARTS + 1, log_array,
log_data + LSN_STORE_SIZE)) log_data + LSN_STORE_SIZE))
res= 1; res= 1;
...@@ -2643,7 +2643,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info, ...@@ -2643,7 +2643,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
if (translog_write_record(&lsn, (head ? LOGREC_REDO_PURGE_ROW_HEAD : if (translog_write_record(&lsn, (head ? LOGREC_REDO_PURGE_ROW_HEAD :
LOGREC_REDO_PURGE_ROW_TAIL), LOGREC_REDO_PURGE_ROW_TAIL),
info->trn, share, sizeof(log_data), info->trn, info, sizeof(log_data),
TRANSLOG_INTERNAL_PARTS + 1, log_array, TRANSLOG_INTERNAL_PARTS + 1, log_array,
log_data)) log_data))
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -2670,7 +2670,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info, ...@@ -2670,7 +2670,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
if (translog_write_record(&lsn, LOGREC_REDO_PURGE_BLOCKS, if (translog_write_record(&lsn, LOGREC_REDO_PURGE_BLOCKS,
info->trn, share, sizeof(log_data), info->trn, info, sizeof(log_data),
TRANSLOG_INTERNAL_PARTS + 1, log_array, TRANSLOG_INTERNAL_PARTS + 1, log_array,
log_data)) log_data))
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -2775,7 +2775,7 @@ my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record) ...@@ -2775,7 +2775,7 @@ my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record)
&row_parts_count); &row_parts_count);
if (translog_write_record(&lsn, LOGREC_UNDO_ROW_DELETE, info->trn, if (translog_write_record(&lsn, LOGREC_UNDO_ROW_DELETE, info->trn,
info->s, sizeof(log_data) + row_length, info, sizeof(log_data) + row_length,
TRANSLOG_INTERNAL_PARTS + 1 + row_parts_count, TRANSLOG_INTERNAL_PARTS + 1 + row_parts_count,
info->log_row_parts, log_data + LSN_STORE_SIZE)) info->log_row_parts, log_data + LSN_STORE_SIZE))
goto err; goto err;
......
...@@ -5536,7 +5536,7 @@ static int write_log_record_for_repair(const HA_CHECK *param, MARIA_HA *info) ...@@ -5536,7 +5536,7 @@ static int write_log_record_for_repair(const HA_CHECK *param, MARIA_HA *info)
int4store(log_data + FILEID_STORE_SIZE, param->testflag); int4store(log_data + FILEID_STORE_SIZE, param->testflag);
if (unlikely(translog_write_record(&share->state.create_rename_lsn, if (unlikely(translog_write_record(&share->state.create_rename_lsn,
LOGREC_REDO_REPAIR_TABLE, LOGREC_REDO_REPAIR_TABLE,
&dummy_transaction_object, share, &dummy_transaction_object, info,
log_array[TRANSLOG_INTERNAL_PARTS + log_array[TRANSLOG_INTERNAL_PARTS +
0].length, 0].length,
sizeof(log_array)/sizeof(log_array[0]), sizeof(log_array)/sizeof(log_array[0]),
......
...@@ -62,7 +62,7 @@ int maria_delete_all_rows(MARIA_HA *info) ...@@ -62,7 +62,7 @@ int maria_delete_all_rows(MARIA_HA *info)
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
if (unlikely(translog_write_record(&lsn, LOGREC_REDO_DELETE_ALL, if (unlikely(translog_write_record(&lsn, LOGREC_REDO_DELETE_ALL,
info->trn, share, 0, info->trn, info, 0,
sizeof(log_array)/sizeof(log_array[0]), sizeof(log_array)/sizeof(log_array[0]),
log_array, log_data) || log_array, log_data) ||
translog_flush(lsn))) translog_flush(lsn)))
......
...@@ -181,10 +181,10 @@ static MARIA_SHARE **id_to_share= NULL; ...@@ -181,10 +181,10 @@ static MARIA_SHARE **id_to_share= NULL;
static my_atomic_rwlock_t LOCK_id_to_share; static my_atomic_rwlock_t LOCK_id_to_share;
static my_bool write_hook_for_redo(enum translog_record_type type, static my_bool write_hook_for_redo(enum translog_record_type type,
TRN *trn, MARIA_SHARE *share, LSN *lsn, TRN *trn, MARIA_HA *tbl_info, LSN *lsn,
struct st_translog_parts *parts); struct st_translog_parts *parts);
static my_bool write_hook_for_undo(enum translog_record_type type, static my_bool write_hook_for_undo(enum translog_record_type type,
TRN *trn, MARIA_SHARE *share, LSN *lsn, TRN *trn, MARIA_HA *tbl_info, LSN *lsn,
struct st_translog_parts *parts); struct st_translog_parts *parts);
/* /*
...@@ -3049,7 +3049,7 @@ static translog_size_t translog_get_current_group_size() ...@@ -3049,7 +3049,7 @@ static translog_size_t translog_get_current_group_size()
static my_bool static my_bool
translog_write_variable_record_1group(LSN *lsn, translog_write_variable_record_1group(LSN *lsn,
enum translog_record_type type, enum translog_record_type type,
MARIA_SHARE *share, MARIA_HA *tbl_info,
SHORT_TRANSACTION_ID short_trid, SHORT_TRANSACTION_ID short_trid,
struct st_translog_parts *parts, struct st_translog_parts *parts,
struct st_translog_buffer struct st_translog_buffer
...@@ -3067,7 +3067,7 @@ translog_write_variable_record_1group(LSN *lsn, ...@@ -3067,7 +3067,7 @@ translog_write_variable_record_1group(LSN *lsn,
*lsn= horizon= log_descriptor.horizon; *lsn= horizon= log_descriptor.horizon;
if (log_record_type_descriptor[type].inwrite_hook && if (log_record_type_descriptor[type].inwrite_hook &&
(*log_record_type_descriptor[type].inwrite_hook)(type, trn, share, (*log_record_type_descriptor[type].inwrite_hook)(type, trn, tbl_info,
lsn, parts)) lsn, parts))
{ {
translog_unlock(); translog_unlock();
...@@ -3205,7 +3205,7 @@ translog_write_variable_record_1group(LSN *lsn, ...@@ -3205,7 +3205,7 @@ translog_write_variable_record_1group(LSN *lsn,
static my_bool static my_bool
translog_write_variable_record_1chunk(LSN *lsn, translog_write_variable_record_1chunk(LSN *lsn,
enum translog_record_type type, enum translog_record_type type,
MARIA_SHARE *share, MARIA_HA *tbl_info,
SHORT_TRANSACTION_ID short_trid, SHORT_TRANSACTION_ID short_trid,
struct st_translog_parts *parts, struct st_translog_parts *parts,
struct st_translog_buffer struct st_translog_buffer
...@@ -3221,7 +3221,7 @@ translog_write_variable_record_1chunk(LSN *lsn, ...@@ -3221,7 +3221,7 @@ translog_write_variable_record_1chunk(LSN *lsn,
*lsn= log_descriptor.horizon; *lsn= log_descriptor.horizon;
if (log_record_type_descriptor[type].inwrite_hook && if (log_record_type_descriptor[type].inwrite_hook &&
(*log_record_type_descriptor[type].inwrite_hook)(type, trn, share, (*log_record_type_descriptor[type].inwrite_hook)(type, trn, tbl_info,
lsn, parts)) lsn, parts))
{ {
translog_unlock(); translog_unlock();
...@@ -3574,7 +3574,7 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts, ...@@ -3574,7 +3574,7 @@ static my_bool translog_relative_LSN_encode(struct st_translog_parts *parts,
static my_bool static my_bool
translog_write_variable_record_mgroup(LSN *lsn, translog_write_variable_record_mgroup(LSN *lsn,
enum translog_record_type type, enum translog_record_type type,
MARIA_SHARE *share, MARIA_HA *tbl_info,
SHORT_TRANSACTION_ID short_trid, SHORT_TRANSACTION_ID short_trid,
struct st_translog_parts *parts, struct st_translog_parts *parts,
struct st_translog_buffer struct st_translog_buffer
...@@ -3917,7 +3917,8 @@ translog_write_variable_record_mgroup(LSN *lsn, ...@@ -3917,7 +3917,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
first_chunk0= 0; first_chunk0= 0;
*lsn= horizon; *lsn= horizon;
if (log_record_type_descriptor[type].inwrite_hook && if (log_record_type_descriptor[type].inwrite_hook &&
(*log_record_type_descriptor[type].inwrite_hook) (type, trn, share, (*log_record_type_descriptor[type].inwrite_hook) (type, trn,
tbl_info,
lsn, parts)) lsn, parts))
goto err; goto err;
} }
...@@ -4003,7 +4004,7 @@ translog_write_variable_record_mgroup(LSN *lsn, ...@@ -4003,7 +4004,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
static my_bool translog_write_variable_record(LSN *lsn, static my_bool translog_write_variable_record(LSN *lsn,
enum translog_record_type type, enum translog_record_type type,
MARIA_SHARE *share, MARIA_HA *tbl_info,
SHORT_TRANSACTION_ID short_trid, SHORT_TRANSACTION_ID short_trid,
struct st_translog_parts *parts, struct st_translog_parts *parts,
TRN *trn) TRN *trn)
...@@ -4081,7 +4082,7 @@ static my_bool translog_write_variable_record(LSN *lsn, ...@@ -4081,7 +4082,7 @@ static my_bool translog_write_variable_record(LSN *lsn,
if (page_rest >= parts->record_length + header_length1) if (page_rest >= parts->record_length + header_length1)
{ {
/* following function makes translog_unlock(); */ /* following function makes translog_unlock(); */
res= translog_write_variable_record_1chunk(lsn, type, share, res= translog_write_variable_record_1chunk(lsn, type, tbl_info,
short_trid, short_trid,
parts, buffer_to_flush, parts, buffer_to_flush,
header_length1, trn); header_length1, trn);
...@@ -4093,14 +4094,14 @@ static my_bool translog_write_variable_record(LSN *lsn, ...@@ -4093,14 +4094,14 @@ static my_bool translog_write_variable_record(LSN *lsn,
if (buffer_rest >= parts->record_length + header_length1 - page_rest) if (buffer_rest >= parts->record_length + header_length1 - page_rest)
{ {
/* following function makes translog_unlock(); */ /* following function makes translog_unlock(); */
res= translog_write_variable_record_1group(lsn, type, share, res= translog_write_variable_record_1group(lsn, type, tbl_info,
short_trid, short_trid,
parts, buffer_to_flush, parts, buffer_to_flush,
header_length1, trn); header_length1, trn);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
/* following function makes translog_unlock(); */ /* following function makes translog_unlock(); */
res= translog_write_variable_record_mgroup(lsn, type, share, res= translog_write_variable_record_mgroup(lsn, type, tbl_info,
short_trid, short_trid,
parts, buffer_to_flush, parts, buffer_to_flush,
header_length1, header_length1,
...@@ -4128,7 +4129,7 @@ static my_bool translog_write_variable_record(LSN *lsn, ...@@ -4128,7 +4129,7 @@ static my_bool translog_write_variable_record(LSN *lsn,
static my_bool translog_write_fixed_record(LSN *lsn, static my_bool translog_write_fixed_record(LSN *lsn,
enum translog_record_type type, enum translog_record_type type,
MARIA_SHARE *share, MARIA_HA *tbl_info,
SHORT_TRANSACTION_ID short_trid, SHORT_TRANSACTION_ID short_trid,
struct st_translog_parts *parts, struct st_translog_parts *parts,
TRN *trn) TRN *trn)
...@@ -4181,7 +4182,7 @@ static my_bool translog_write_fixed_record(LSN *lsn, ...@@ -4181,7 +4182,7 @@ static my_bool translog_write_fixed_record(LSN *lsn,
*lsn= log_descriptor.horizon; *lsn= log_descriptor.horizon;
if (log_record_type_descriptor[type].inwrite_hook && if (log_record_type_descriptor[type].inwrite_hook &&
(*log_record_type_descriptor[type].inwrite_hook) (type, trn, share, (*log_record_type_descriptor[type].inwrite_hook) (type, trn, tbl_info,
lsn, parts)) lsn, parts))
{ {
rc= 1; rc= 1;
...@@ -4247,16 +4248,16 @@ static my_bool translog_write_fixed_record(LSN *lsn, ...@@ -4247,16 +4248,16 @@ static my_bool translog_write_fixed_record(LSN *lsn,
@param type the log record type @param type the log record type
@param trn Transaction structure pointer for hooks by @param trn Transaction structure pointer for hooks by
record log type, for short_id record log type, for short_id
@param share MARIA_SHARE of table or NULL @param tbl_info MARIA_HA of table or NULL
@param rec_len record length or 0 (count it) @param rec_len record length or 0 (count it)
@param part_no number of parts or 0 (count it) @param part_no number of parts or 0 (count it)
@param parts_data zero ended (in case of number of parts is 0) @param parts_data zero ended (in case of number of parts is 0)
array of LEX_STRINGs (parts), first array of LEX_STRINGs (parts), first
TRANSLOG_INTERNAL_PARTS positions in the log TRANSLOG_INTERNAL_PARTS positions in the log
should be unused (need for loghandler) should be unused (need for loghandler)
@param store_share_id if share!=NULL then share's id will automatically @param store_share_id if tbl_info!=NULL then share's id will
be stored in the two first bytes pointed (so automatically be stored in the two first bytes
pointer is assumed to be !=NULL) pointed (so pointer is assumed to be !=NULL)
@return Operation status @return Operation status
@retval 0 OK @retval 0 OK
@retval 1 Error @retval 1 Error
...@@ -4264,7 +4265,7 @@ static my_bool translog_write_fixed_record(LSN *lsn, ...@@ -4264,7 +4265,7 @@ static my_bool translog_write_fixed_record(LSN *lsn,
my_bool translog_write_record(LSN *lsn, my_bool translog_write_record(LSN *lsn,
enum translog_record_type type, enum translog_record_type type,
TRN *trn, struct st_maria_share *share, TRN *trn, MARIA_HA *tbl_info,
translog_size_t rec_len, translog_size_t rec_len,
uint part_no, uint part_no,
LEX_STRING *parts_data, LEX_STRING *parts_data,
...@@ -4278,8 +4279,9 @@ my_bool translog_write_record(LSN *lsn, ...@@ -4278,8 +4279,9 @@ my_bool translog_write_record(LSN *lsn,
DBUG_PRINT("enter", ("type: %u ShortTrID: %u", DBUG_PRINT("enter", ("type: %u ShortTrID: %u",
(uint) type, (uint)short_trid)); (uint) type, (uint)short_trid));
if (share) if (tbl_info)
{ {
MARIA_SHARE *share= tbl_info->s;
if (!share->now_transactional) if (!share->now_transactional)
{ {
DBUG_PRINT("info", ("It is not transactional table")); DBUG_PRINT("info", ("It is not transactional table"));
...@@ -4375,17 +4377,17 @@ my_bool translog_write_record(LSN *lsn, ...@@ -4375,17 +4377,17 @@ my_bool translog_write_record(LSN *lsn,
/* process this parts */ /* process this parts */
if (!(rc= (log_record_type_descriptor[type].prewrite_hook && if (!(rc= (log_record_type_descriptor[type].prewrite_hook &&
(*log_record_type_descriptor[type].prewrite_hook) (type, trn, (*log_record_type_descriptor[type].prewrite_hook) (type, trn,
share, tbl_info,
&parts)))) &parts))))
{ {
switch (log_record_type_descriptor[type].class) { switch (log_record_type_descriptor[type].class) {
case LOGRECTYPE_VARIABLE_LENGTH: case LOGRECTYPE_VARIABLE_LENGTH:
rc= translog_write_variable_record(lsn, type, share, rc= translog_write_variable_record(lsn, type, tbl_info,
short_trid, &parts, trn); short_trid, &parts, trn);
break; break;
case LOGRECTYPE_PSEUDOFIXEDLENGTH: case LOGRECTYPE_PSEUDOFIXEDLENGTH:
case LOGRECTYPE_FIXEDLENGTH: case LOGRECTYPE_FIXEDLENGTH:
rc= translog_write_fixed_record(lsn, type, share, rc= translog_write_fixed_record(lsn, type, tbl_info,
short_trid, &parts, trn); short_trid, &parts, trn);
break; break;
case LOGRECTYPE_NOT_ALLOWED: case LOGRECTYPE_NOT_ALLOWED:
...@@ -5619,7 +5621,7 @@ my_bool translog_flush(LSN lsn) ...@@ -5619,7 +5621,7 @@ my_bool translog_flush(LSN lsn)
static my_bool write_hook_for_redo(enum translog_record_type type static my_bool write_hook_for_redo(enum translog_record_type type
__attribute__ ((unused)), __attribute__ ((unused)),
TRN *trn, MARIA_SHARE *share TRN *trn, MARIA_HA *tbl_info
__attribute__ ((unused)), __attribute__ ((unused)),
LSN *lsn, LSN *lsn,
struct st_translog_parts *parts struct st_translog_parts *parts
...@@ -5657,7 +5659,7 @@ static my_bool write_hook_for_redo(enum translog_record_type type ...@@ -5657,7 +5659,7 @@ static my_bool write_hook_for_redo(enum translog_record_type type
static my_bool write_hook_for_undo(enum translog_record_type type static my_bool write_hook_for_undo(enum translog_record_type type
__attribute__ ((unused)), __attribute__ ((unused)),
TRN *trn, MARIA_SHARE *share TRN *trn, MARIA_HA *tbl_info
__attribute__ ((unused)), __attribute__ ((unused)),
LSN *lsn, LSN *lsn,
struct st_translog_parts *parts struct st_translog_parts *parts
...@@ -5722,10 +5724,11 @@ int translog_assign_id_to_share(MARIA_SHARE *share, TRN *trn) ...@@ -5722,10 +5724,11 @@ int translog_assign_id_to_share(MARIA_SHARE *share, TRN *trn)
my_atomic_rwlock_wrunlock(&LOCK_id_to_share); my_atomic_rwlock_wrunlock(&LOCK_id_to_share);
i= 1; /* scan the whole array */ i= 1; /* scan the whole array */
} while (share->id == 0); } while (share->id == 0);
DBUG_PRINT("info", ("id_to_share: 0x%lx -> %u", (ulong)share, i)); DBUG_PRINT("info", ("id_to_share: 0x%lx -> %u", (ulong)share, share->id));
LSN lsn; LSN lsn;
LEX_STRING log_array[TRANSLOG_INTERNAL_PARTS + 2]; LEX_STRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
uchar log_data[FILEID_STORE_SIZE]; uchar log_data[FILEID_STORE_SIZE];
fileid_store(log_data, share->id);
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
/* /*
...@@ -5740,12 +5743,12 @@ int translog_assign_id_to_share(MARIA_SHARE *share, TRN *trn) ...@@ -5740,12 +5743,12 @@ int translog_assign_id_to_share(MARIA_SHARE *share, TRN *trn)
*/ */
log_array[TRANSLOG_INTERNAL_PARTS + 1].length= log_array[TRANSLOG_INTERNAL_PARTS + 1].length=
strlen(share->open_file_name) + 1; strlen(share->open_file_name) + 1;
if (unlikely(translog_write_record(&lsn, LOGREC_FILE_ID, trn, share, if (unlikely(translog_write_record(&lsn, LOGREC_FILE_ID, trn, NULL,
sizeof(log_data) + sizeof(log_data) +
log_array[TRANSLOG_INTERNAL_PARTS + log_array[TRANSLOG_INTERNAL_PARTS +
1].length, 1].length,
sizeof(log_array)/sizeof(log_array[0]), sizeof(log_array)/sizeof(log_array[0]),
log_array, log_data))) log_array, NULL)))
return 1; return 1;
} }
pthread_mutex_unlock(&share->intern_lock); pthread_mutex_unlock(&share->intern_lock);
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
/* short transaction ID type */ /* short transaction ID type */
typedef uint16 SHORT_TRANSACTION_ID; typedef uint16 SHORT_TRANSACTION_ID;
struct st_maria_share; struct st_maria_info;
/* Length of CRC at end of pages */ /* Length of CRC at end of pages */
#define CRC_LENGTH 4 #define CRC_LENGTH 4
...@@ -225,7 +225,7 @@ extern my_bool translog_init(const char *directory, uint32 log_file_max_size, ...@@ -225,7 +225,7 @@ extern my_bool translog_init(const char *directory, uint32 log_file_max_size,
extern my_bool extern my_bool
translog_write_record(LSN *lsn, enum translog_record_type type, translog_write_record(LSN *lsn, enum translog_record_type type,
struct st_transaction *trn, struct st_transaction *trn,
struct st_maria_share *share, struct st_maria_info *tbl_info,
translog_size_t rec_len, uint part_no, translog_size_t rec_len, uint part_no,
LEX_STRING *parts_data, uchar *store_share_id); LEX_STRING *parts_data, uchar *store_share_id);
...@@ -284,11 +284,11 @@ struct st_translog_parts ...@@ -284,11 +284,11 @@ struct st_translog_parts
}; };
typedef my_bool(*prewrite_rec_hook) (enum translog_record_type type, typedef my_bool(*prewrite_rec_hook) (enum translog_record_type type,
TRN *trn, struct st_maria_share *share, TRN *trn, struct st_maria_info *tbl_info,
struct st_translog_parts *parts); struct st_translog_parts *parts);
typedef my_bool(*inwrite_rec_hook) (enum translog_record_type type, typedef my_bool(*inwrite_rec_hook) (enum translog_record_type type,
TRN *trn, struct st_maria_share *share, TRN *trn, struct st_maria_info *tbl_info,
LSN *lsn, LSN *lsn,
struct st_translog_parts *parts); struct st_translog_parts *parts);
......
...@@ -663,11 +663,11 @@ void tablockman_print_tlo(TABLE_LOCK_OWNER *lo) ...@@ -663,11 +663,11 @@ void tablockman_print_tlo(TABLE_LOCK_OWNER *lo)
printf("lo%d>", lo->loid); printf("lo%d>", lo->loid);
if ((lock= lo->waiting_lock)) if ((lock= lo->waiting_lock))
printf(" (%s.0x%lx)", lock2str[lock->lock_type], (intptr)lock->table); printf(" (%s.0x%lx)", lock2str[lock->lock_type], (ulong)lock->table);
for (lock= lo->active_locks; for (lock= lo->active_locks;
lock && lock != lock->next_in_lo; lock && lock != lock->next_in_lo;
lock= lock->next_in_lo) lock= lock->next_in_lo)
printf(" %s.0x%lx", lock2str[lock->lock_type], (intptr)lock->table); printf(" %s.0x%lx", lock2str[lock->lock_type], (ulong)lock->table);
if (lock && lock == lock->next_in_lo) if (lock && lock == lock->next_in_lo)
printf("!"); printf("!");
printf("\n"); printf("\n");
......
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