mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 18:20:07 +01:00
ab0fa111fe
Fixed bug when calculating max_key_length that caused some ALTER TABLE to fail if MAX_ROWS was used. Use maria_block_size instead of MARIA_MIN_KEY_BLOCK_LENGTH Fixed bug when scanning table with BLOCK format for repair; If table was > bitmap coverage one page block was read twice which caused a lot of duplicate key errors Could not repeat Bug#34106 "auto_increment is reset to 1 when table is recovered from crash" after this patch. NOTE: This is an incompatible change, so one must do maria_chk -r on ones old Maria tables! Sorry, but this was needed to fix the bug with max_key_length and to be able to handle bigger key files with smaller key references cmd-line-utils/readline/readline.c: Fixed compiler warnings mysql-test/r/maria.result: Added more test of auto-increment handling mysql-test/t/maria.test: Added more test of auto-increment handling mysys/my_pread.c: Fixed wrong test Removed not needed tests (error is always 1 if readbytes != Count) mysys/my_read.c: Fixed wrong test storage/maria/ha_maria.cc: Disable LOAD INDEX until I got Sanja's extension to pagecache interface storage/maria/ma_blockrec.c: Ensure that info->last_auto_increment is reset properly storage/maria/ma_check.c: Fixed wrong printing of row number in case of duplicate key for --safe-repair Safety fix in recreate table so that Column numbers are given to maria_create() in original order Added missing HA_OPEN_FOR_REPAIR to maria_open() Fixed bug when scanning table with BLOCK format for repair; If table was > bitmap coverage one page block was read twice which caused a lot of duplicate key errors storage/maria/ma_create.c: Use correct value for how much free space there is on a key page Remember some missing table option when doing re-create. Removed optimization where last packed fields is unpacked; Caused problems for re-create. storage/maria/ma_delete.c: Ensure that info->last_auto_increment is reset properly Fix for update to restore autoincrement value on duplicate key storage/maria/ma_key_recover.c: Moved handling of restoring value of auto-increment in case of duplicate key from clr to undo This ensures the restoring works both for insert and update and also that this is symetrical to how the auto_increment value is stored storage/maria/ma_key_recover.h: Added new prototype storage/maria/ma_loghandler.c: Added hook to write_hook_for_undo_key_delete() storage/maria/ma_open.c: Fixed wrong calculation of max_key_file_length storage/maria/ma_page.c: Use maria_block_size instead of MARIA_MIN_KEY_BLOCK_LENGTH Increase internal buffer (safety fix) storage/maria/ma_search.c: Use maria_block_size instead of MARIA_MIN_KEY_BLOCK_LENGTH Note that this is an incompatible change, so one must do maria_chk -r on ones old Maria tables (sorry) storage/maria/ma_update.c: Ensure that info->last_auto_increment is reset properly storage/maria/ma_write.c: Ensure that info->last_auto_increment is reset properly Fix for update to restore autoincrement value on duplicate key storage/maria/maria_chk.c: Allow small page_buffer_size Fixed printing for --describe to better fit into 80 characters storage/maria/maria_def.h: Added comments
107 lines
4.2 KiB
C
107 lines
4.2 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);
|
|
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);
|
|
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,
|
|
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->used_key_del)
|
|
_ma_unlock_key_del(info);
|
|
}
|