mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
4e0964cb04
Fixed bugs in undo logging Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read) Reserved place for reference-transid on key pages (for packing of transids) ALTER TABLE and INSERT ... SELECT now uses fast creation of index Known bugs: ma_test_recovery fails because of a bug in redo handling when log is cut directly after a redo (Guilhem knows how to fix) ma_test_recovery.excepted is not totally correct, because of the above bug mysqld sometimes fails to restart; Fails with error "end_of_redo_phase: Assertion `long_trid != 0' failed"; Guilhem to investigate include/maria.h: Prototype changes Added current_filepos to st_maria_sort_info mysql-test/r/maria.result: Updated results that changes as alter table and insert ... select now uses fast creation of index mysys/mf_iocache.c: Reset variable to gurard against double invocation storage/maria/ma_bitmap.c: Added _ma_bitmap_reset_cache() (needed for repair) storage/maria/ma_blockrec.c: Simplify code More initial allocations Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read) storage/maria/ma_blockrec.h: Moved TRANSID_SIZE to maria_def.h Added prototype for new functions storage/maria/ma_check.c: Simplicy code Fixed repair_by_sort to work with BLOCK_RECORD - When using BLOCK_RECORD or UNPACK create new Maria handle - Use common initializer function - Align code with maria_repair() Made some changes to maria_repair_parallel() to use common initializer function Removed ASK_MONTY section by fixing noted problem storage/maria/ma_close.c: Moved check for readonly to _ma_state_info_write() storage/maria/ma_key_recover.c: Use different log entries if key root changes or not. This fixed some bugs when tree grows storage/maria/ma_key_recover.h: Added keynr to st_msg_to_write_hook_for_undo_key storage/maria/ma_loghandler.c: Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT storage/maria/ma_loghandler.h: Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT storage/maria/ma_open.c: Added TRANSID to all key pages (for future compressing of trans id's) For compressed records, alloc a bit bigger buffer to avoid valgrind warnings If table is opened readonly, don't update state storage/maria/ma_packrec.c: Allocate bigger array for bit unpacking to avoid valgrind errors storage/maria/ma_recovery.c: Added UNDO_KEY_INSERT_WITH_ROOT & UNDO_KEY_DELETE_WITH_ROOT storage/maria/ma_sort.c: More logging storage/maria/ma_test_all.sh: More tests storage/maria/ma_test_recovery.expected: Update results Note that this is not complete becasue of a bug in recovery storage/maria/ma_test_recovery: Removed recreation of index (not needed when we have redo for index pages) storage/maria/maria_chk.c: When using flag --read-only, don't update status for files When using --unpack, don't use REPAIR_BY_SORT if other repair option is given Enable repair_by_sort for BLOCK records Removed not needed newline at start of --describe storage/maria/maria_def.h: Support for TRANSID_SIZE to key pages storage/maria/maria_read_log.c: renamed --only-display to --display-only
99 lines
3.7 KiB
C
99 lines
3.7 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;
|
|
};
|
|
|
|
|
|
/* 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);
|
|
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);
|
|
void _ma_unpin_all_pages(MARIA_HA *info, LSN undo_lsn);
|
|
|
|
my_bool _ma_log_prefix(MARIA_HA *info, my_off_t page,
|
|
uchar *buff, uint changed_length,
|
|
int move_length);
|
|
my_bool _ma_log_suffix(MARIA_HA *info, my_off_t page,
|
|
uchar *buff, uint org_length,
|
|
uint new_length);
|
|
my_bool _ma_log_add(MARIA_HA *info, my_off_t page, uchar *buff,
|
|
uint buff_length, uchar *key_pos,
|
|
uint changed_length, int move_length,
|
|
my_bool handle_overflow);
|
|
|
|
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);
|
|
|
|
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->used_key_del)
|
|
_ma_unlock_key_del(info);
|
|
}
|