mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
e27890cab0
* create page cache before initializing engine and not after, because Maria's recovery needs a page cache * make the creation of a bitmap page more crash-resistent * bugfix (see ma_blockrec.c) * back to old way: create an 8k bitmap page when creating table * preparations for the UNDO phase: recreate TRNs * preparations for Checkpoint: list of dirty pages, testing of rec_lsn to know if page should be skipped during Recovery (unused in this patch as no Checkpoint module pushed yet) * maria_chk tags repaired table with a special LSN * reworking all around in ma_recovery.c (less duplication) mysys/my_realloc.c: noted an issue in my_realloc() sql/mysqld.cc: page cache needs to be created before engines are initialized, because Maria's initialization may do a recovery which needs the page cache. storage/maria/ha_maria.cc: update to new prototype storage/maria/ma_bitmap.c: when creating the first bitmap page we used chsize to 8192 bytes then pwrite (overwrite) the last 2 bytes (8191-8192). If crash between the two operations, this leaves a bitmap page full without its end marker. A later recovery may try to read this page and find it exists and misses a marker and conclude it's corrupted and fail. Changing the chsize to only 8190 bytes: recovery will then find the page is too short and recreate it entirely. storage/maria/ma_blockrec.c: Fix for a bug: when executing a REDO, if the data page is created, data_file_length was increased before _ma_bitmap_set(): _ma_bitmap_set() called _ma_read_bitmap_page() which, due to the increased data_file_length, expected to find a bitmap page on disk with a correct end marker; if the bitmap page didn't exist already in fact, this failed. Fixed by increasing data_file_length only after _ma_read_bitmap_page() has created the new bitmap page correctly. This bug could happen every time a REDO is about creating a new bitmap page. storage/maria/ma_check.c: empty data file has a bitmap page storage/maria/ma_control_file.c: useless parameter to ma_control_file_create_or_open(), just test if this is recovery. storage/maria/ma_control_file.h: new prototype storage/maria/ma_create.c: Back to how it was before: maria_create() creates an 8k bitmap page. Thus (bugfix) data_file_length needs to reflect this instead of being 0. storage/maria/ma_loghandler.c: as ma_test1 and ma_test2 now use real transactions and not dummy_transaction_object, REDO for INSERT/UPDATE/DELETE are always about real transactions, can assert this. A function for Recovery to assign a short id to a table. storage/maria/ma_loghandler.h: new function storage/maria/ma_loghandler_lsn.h: maria_chk tags repaired tables with this LSN storage/maria/ma_open.c: * enforce that DMLs on transactional tables use real transactions and not dummy_transaction_object. * test if table was repaired with maria_chk (which has to been seen as an import of an external table into the server), test validity of create_rename_lsn (header corruption detection) * comments. storage/maria/ma_recovery.c: * preparations for the UNDO phase: recreate TRNs * preparations for Checkpoint: list of dirty pages, testing of rec_lsn to know if page should be skipped during Recovery (unused in this patch as no Checkpoint module pushed yet) * reworking all around (less duplication) storage/maria/ma_recovery.h: a parameter to say if the UNDO phase should be skipped storage/maria/maria_chk.c: tag repaired tables with a special LSN storage/maria/maria_read_log.c: * update to new prototype * no UNDO phase in maria_read_log for now storage/maria/trnman.c: * a function for Recovery to create a transaction (TRN), needed in the UNDO phase * a function for Recovery to grab an existing transaction, needed in the UNDO phase (rollback all existing transactions) storage/maria/trnman_public.h: new functions
60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
/* Copyright (C) 2006 MySQL AB
|
|
|
|
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 */
|
|
|
|
|
|
/*
|
|
External definitions for trnman.h
|
|
We need to split this into two files as gcc 4.1.2 gives error if it tries
|
|
to include my_atomic.h in C++ code.
|
|
*/
|
|
|
|
#ifndef _trnman_public_h
|
|
#define _trnman_public_h
|
|
|
|
#include "ma_loghandler_lsn.h"
|
|
|
|
C_MODE_START
|
|
typedef uint64 TrID; /* our TrID is 6 bytes */
|
|
typedef struct st_transaction TRN;
|
|
|
|
#define SHORT_TRID_MAX 65535
|
|
|
|
extern uint trnman_active_transactions, trnman_allocated_transactions;
|
|
extern TRN dummy_transaction_object;
|
|
|
|
int trnman_init(void);
|
|
void trnman_destroy(void);
|
|
TRN *trnman_new_trn(pthread_mutex_t *, pthread_cond_t *, void *);
|
|
int trnman_end_trn(TRN *trn, my_bool commit);
|
|
#define trnman_commit_trn(T) trnman_end_trn(T, TRUE)
|
|
#define trnman_abort_trn(T) trnman_end_trn(T, FALSE)
|
|
#define trnman_rollback_trn(T) trnman_end_trn(T, FALSE)
|
|
void trnman_free_trn(TRN *trn);
|
|
int trnman_can_read_from(TRN *trn, TrID trid);
|
|
void trnman_new_statement(TRN *trn);
|
|
void trnman_rollback_statement(TRN *trn);
|
|
my_bool trnman_collect_transactions(LEX_STRING *str_act, LEX_STRING *str_com,
|
|
LSN *min_rec_lsn,
|
|
LSN *min_first_undo_lsn);
|
|
|
|
uint trnman_increment_locked_tables(TRN *trn);
|
|
uint trnman_decrement_locked_tables(TRN *trn);
|
|
my_bool trnman_has_locked_tables(TRN *trn);
|
|
void trnman_reset_locked_tables(TRN *trn);
|
|
TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid);
|
|
TRN *trnman_get_any_trn();
|
|
|
|
C_MODE_END
|
|
#endif
|