mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
722a8ebe5b
This can serve to maria_chk to check that trids found in rows and keys are not too big. Also used by Recovery when logs are lost. Options --require-control-file, --datadir, --log-dir (yes, the dashes are inconsistent but I imitated mysqld --datadir and --maria-log-dir) for maria_chk. Lock control file _before_ reading its content. storage/maria/ha_maria.cc: new prototype storage/maria/ma_check.c: A function to find the max trid in the system (consults transaction manager and control file), to check tables. storage/maria/ma_checkpoint.c: new prototype storage/maria/ma_control_file.c: Store max trid into control file, in a backward-compatible way (can still read old control files). Parameter to ma_control_file_open(), to not create the log if it's missing (maria_chk needs that). Lock control file _before_ reading its content. Fix for a segfault when reading an old control file (bzero() with a negative second argument) storage/maria/ma_control_file.h: changes to the control file module's API storage/maria/ma_init.c: When Maria shuts down cleanly, store max trid into control file. storage/maria/ma_loghandler.c: new prototype storage/maria/ma_recovery.c: During recovery, consult max trid stored in control file, in case it is bigger than what we found in log (case of logs manually removed by user). storage/maria/ma_test1.c: new prototype storage/maria/ma_test2.c: new prototype storage/maria/maria_chk.c: New option --require-control-file (abort if control file not found), --datadir (path for control file (and for logs if --log-dir not specified)), --log-dir (path for logs). Try to open control file when maria_chk starts. storage/maria/maria_read_log.c: new prototype storage/maria/trnman.c: A new function to know max trid in transaction manager storage/maria/trnman_public.h: New function storage/maria/unittest/ma_control_file-t.c: new prototypes. Testing storing and retrieving the max trid to/from control file storage/maria/unittest/ma_test_loghandler-t.c: new prototype storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: new prototype storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: new prototype storage/maria/unittest/ma_test_loghandler_multigroup-t.c: new prototype storage/maria/unittest/ma_test_loghandler_multithread-t.c: new prototype storage/maria/unittest/ma_test_loghandler_noflush-t.c: new prototype storage/maria/unittest/ma_test_loghandler_nologs-t.c: new prototype storage/maria/unittest/ma_test_loghandler_pagecache-t.c: new prototype storage/maria/unittest/ma_test_loghandler_purge-t.c: new prototype
63 lines
2.3 KiB
C
63 lines
2.3 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(TrID);
|
|
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);
|
|
uint trnman_has_locked_tables(TRN *trn);
|
|
void trnman_reset_locked_tables(TRN *trn, uint locked_tables);
|
|
TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid);
|
|
TRN *trnman_get_any_trn(void);
|
|
TrID trnman_get_max_trid(void);
|
|
#define TRANSID_SIZE 6
|
|
#define transid_store(dst, id) int6store(dst,id)
|
|
#define transid_korr(P) uint6korr(P)
|
|
C_MODE_END
|
|
#endif
|