mariadb/storage/maria/ma_key_recover.h
Michael Widenius 12648015b3 Added --sync-sys=0 option for mysqld to skip sync() calls for faster testing
Fixed LP#613418 (M)aria recovery failure: ma_key_recover.c:981: _ma_apply_redo_index: Assertion `check_page_length == page_length' failed

include/my_sys.h:
  Added my_disable_sync
mysql-test/mysql-test-run.pl:
  Added --sync-sys=0 to run test suite faster
mysys/my_static.c:
  Added my_disable_sync
mysys/my_sync.c:
  Added my_disable_sync
sql/mysqld.cc:
  Added -sync-sys=0 option for mysqld to skip sync() calls for faster testing
storage/maria/ma_key_recover.c:
  More DBUG_ASSERT()
  Added logging of KEY_OP_DEBUG to make examening of logs easier
  Fixed testing of page length in recovery to ensure we don't overwrite checksum (previous tests was too relaxed)
  Fixed bug in recovery logging of split pages which caused failure during recovery:
  - Length was not adjusted properly for pages to be split
  - Added KEY_OP_MAX_PAGELENGTH to tell recovery that page is now full length
  - This fixed LP#613418
storage/maria/ma_key_recover.h:
  Changed prototype for ma_log_change() for KEY_OP_DEBUG
storage/maria/ma_loghandler.h:
  Added new enums for better debugging of recovery logs
storage/maria/ma_rt_index.c:
  Added debugging information to calls to ma_log_change()
storage/maria/ma_write.c:
  Added debugging information to calls to ma_log_change() and ma_log_split()
2010-08-09 20:05:42 +03:00

112 lines
4.6 KiB
C

/* Copyright (C) 2007 Michael Widenius
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
When we have finished the write/update/delete of a row, we have cleanups to
do. For now it is signalling to Checkpoint that all dirtied pages have
their rec_lsn set and page LSN set (_ma_unpin_all_pages() has been called),
and that bitmap pages are correct (_ma_bitmap_release_unused() has been
called).
*/
/* Struct for clr_end */
struct st_msg_to_write_hook_for_clr_end
{
LSN previous_undo_lsn;
enum translog_record_type undone_record_type;
ha_checksum checksum_delta;
void *extra_msg;
};
struct st_msg_to_write_hook_for_undo_key
{
my_off_t *root;
my_off_t value;
uint keynr;
ulonglong auto_increment;
};
/* Function definitions for some redo functions */
my_bool _ma_write_clr(MARIA_HA *info, LSN undo_lsn,
enum translog_record_type undo_type,
my_bool store_checksum, ha_checksum checksum,
LSN *res_lsn, void *extra_msg);
int _ma_write_undo_key_insert(MARIA_HA *info, const MARIA_KEY *key,
my_off_t *root, my_off_t new_root,
LSN *res_lsn);
my_bool _ma_write_undo_key_delete(MARIA_HA *info, const MARIA_KEY *key,
my_off_t new_root, LSN *res_lsn);
my_bool write_hook_for_clr_end(enum translog_record_type type,
TRN *trn, MARIA_HA *tbl_info, LSN *lsn,
void *hook_arg);
extern my_bool write_hook_for_undo_key(enum translog_record_type type,
TRN *trn, MARIA_HA *tbl_info,
LSN *lsn, void *hook_arg);
extern my_bool write_hook_for_undo_key_insert(enum translog_record_type type,
TRN *trn, MARIA_HA *tbl_info,
LSN *lsn, void *hook_arg);
extern my_bool write_hook_for_undo_key_delete(enum translog_record_type type,
TRN *trn, MARIA_HA *tbl_info,
LSN *lsn, void *hook_arg);
my_bool _ma_log_prefix(MARIA_PAGE *page, uint changed_length, int move_length);
my_bool _ma_log_suffix(MARIA_PAGE *page, uint org_length,
uint new_length);
my_bool _ma_log_add(MARIA_PAGE *page, uint buff_length, uchar *key_pos,
uint changed_length, int move_length,
my_bool handle_overflow);
my_bool _ma_log_delete(MARIA_PAGE *page, const uchar *key_pos,
uint changed_length, uint move_length);
my_bool _ma_log_change(MARIA_PAGE *page, const uchar *key_pos, uint length,
enum en_key_debug debug_marker);
my_bool _ma_log_new(MARIA_PAGE *page, my_bool root_page);
uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn,
const uchar *header, uint length);
uint _ma_apply_redo_index_free_page(MARIA_HA *info, LSN lsn,
const uchar *header);
uint _ma_apply_redo_index(MARIA_HA *info,
LSN lsn, const uchar *header, uint length);
my_bool _ma_apply_undo_key_insert(MARIA_HA *info, LSN undo_lsn,
const uchar *header, uint length);
my_bool _ma_apply_undo_key_delete(MARIA_HA *info, LSN undo_lsn,
const uchar *header, uint length,
my_bool with_root);
static inline void _ma_finalize_row(MARIA_HA *info)
{
info->trn->rec_lsn= LSN_IMPOSSIBLE;
}
/* unpinning is often the last operation before finalizing */
static inline void _ma_unpin_all_pages_and_finalize_row(MARIA_HA *info,
LSN undo_lsn)
{
_ma_unpin_all_pages(info, undo_lsn);
_ma_finalize_row(info);
}
extern my_bool _ma_lock_key_del(MARIA_HA *info, my_bool insert_at_end);
extern void _ma_unlock_key_del(MARIA_HA *info);
static inline void _ma_fast_unlock_key_del(MARIA_HA *info)
{
if (info->key_del_used)
_ma_unlock_key_del(info);
}