Commit 372b4ed4 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 8dcd83d0
......@@ -1143,7 +1143,7 @@ static my_bool write_tail(MARIA_HA *info,
MARIA_BITMAP_BLOCK *block,
uchar *row_part, uint length)
{
MARIA_SHARE *share= share= info->s;
MARIA_SHARE *share= info->s;
MARIA_PINNED_PAGE page_link;
uint block_size= share->block_size, empty_space;
struct st_row_pos_info row_pos;
......@@ -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].length= length;
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,
log_data))
DBUG_RETURN(1);
......@@ -1261,7 +1261,7 @@ static my_bool write_full_pages(MARIA_HA *info,
uchar *data, ulong length)
{
my_off_t page;
MARIA_SHARE *share= share= info->s;
MARIA_SHARE *share= info->s;
uint block_size= share->block_size;
uint data_size= FULL_PAGE_SIZE(block_size);
uchar *buff= info->keyread_buff;
......@@ -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].length= extents_length;
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,
log_data))
DBUG_RETURN(1);
......@@ -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);
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,
log_data))
res= 1;
......@@ -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].length= data_length;
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,
log_data))
goto disk_err;
......@@ -2111,7 +2111,7 @@ static my_bool write_block_record(MARIA_HA *info,
/* trn->rec_lsn is already set earlier in this function */
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),
log_array, log_data);
if (log_array != tmp_log_array)
......@@ -2142,7 +2142,7 @@ static my_bool write_block_record(MARIA_HA *info,
{
/* Write UNDO log record for the 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,
log_data + LSN_STORE_SIZE))
goto disk_err;
......@@ -2157,7 +2157,7 @@ static my_bool write_block_record(MARIA_HA *info,
TRANSLOG_INTERNAL_PARTS + 1,
&row_parts_count);
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,
log_array, log_data + LSN_STORE_SIZE))
goto disk_err;
......@@ -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].length= sizeof(log_data);
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,
log_data + LSN_STORE_SIZE))
res= 1;
......@@ -2643,7 +2643,7 @@ static my_bool delete_head_or_tail(MARIA_HA *info,
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
if (translog_write_record(&lsn, (head ? LOGREC_REDO_PURGE_ROW_HEAD :
LOGREC_REDO_PURGE_ROW_TAIL),
info->trn, share, sizeof(log_data),
info->trn, info, sizeof(log_data),
TRANSLOG_INTERNAL_PARTS + 1, log_array,
log_data))
DBUG_RETURN(1);
......@@ -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].length= sizeof(log_data);
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,
log_data))
DBUG_RETURN(1);
......@@ -2775,7 +2775,7 @@ my_bool _ma_delete_block_record(MARIA_HA *info, const uchar *record)
&row_parts_count);
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,
info->log_row_parts, log_data + LSN_STORE_SIZE))
goto err;
......
......@@ -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);
if (unlikely(translog_write_record(&share->state.create_rename_lsn,
LOGREC_REDO_REPAIR_TABLE,
&dummy_transaction_object, share,
&dummy_transaction_object, info,
log_array[TRANSLOG_INTERNAL_PARTS +
0].length,
sizeof(log_array)/sizeof(log_array[0]),
......
......@@ -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].length= sizeof(log_data);
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]),
log_array, log_data) ||
translog_flush(lsn)))
......
This diff is collapsed.
......@@ -46,7 +46,7 @@
/* short transaction ID type */
typedef uint16 SHORT_TRANSACTION_ID;
struct st_maria_share;
struct st_maria_info;
/* Length of CRC at end of pages */
#define CRC_LENGTH 4
......@@ -225,7 +225,7 @@ extern my_bool translog_init(const char *directory, uint32 log_file_max_size,
extern my_bool
translog_write_record(LSN *lsn, enum translog_record_type type,
struct st_transaction *trn,
struct st_maria_share *share,
struct st_maria_info *tbl_info,
translog_size_t rec_len, uint part_no,
LEX_STRING *parts_data, uchar *store_share_id);
......@@ -284,11 +284,11 @@ struct st_translog_parts
};
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);
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,
struct st_translog_parts *parts);
......
......@@ -663,11 +663,11 @@ void tablockman_print_tlo(TABLE_LOCK_OWNER *lo)
printf("lo%d>", lo->loid);
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;
lock && 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)
printf("!");
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