42#define TC_LOG_MIN_PAGES 6
86 bool run_after_commit =
true);
171 virtual int open(
const char *opt_name) = 0;
228 int open(
const char *)
override;
283 int open(
const char *opt_name)
override;
284 void close()
override;
320 assert(
p->ptr <
p->end);
324 ulong cookie = (ulong)((
uchar *)
p->ptr - data_arg);
int prepare(THD *thd, bool all) override
Log a prepare record of the transaction to the storage engines.
Definition: tc_log.cc:261
void close() override
Close the transaction coordinator log and free any resources.
Definition: tc_log.h:229
int rollback(THD *thd, bool all) override
Log a rollback record of the transaction to the transaction coordinator log.
Definition: tc_log.cc:254
enum_result commit(THD *thd, bool all) override
Log a commit record of the transaction to the transaction coordinator log.
Definition: tc_log.cc:246
int open(const char *) override
Initialize and open the coordinator log.
Definition: tc_log.cc:238
ulong store_xid_in_empty_slot(my_xid xid, PAGE *p, uchar *data_arg)
Find empty slot in the page and write xid value there.
Definition: tc_log.h:316
PAGE * get_active_from_pool()
there is no active page, let's got one from the pool.
Definition: tc_log.cc:434
enum_result commit(THD *thd, bool all) override
Commit the transaction.
Definition: tc_log.cc:494
PAGE * pages
Definition: tc_log.h:264
uint size() const
Get the total amount of potentially usable slots for XIDs in TC log.
Definition: tc_log.cc:414
my_off_t file_length
Definition: tc_log.h:261
bool wait_sync_completion(PAGE *p)
Wait for until page data will be written to the disk.
Definition: tc_log.h:340
PAGE * pool
Definition: tc_log.h:264
File fd
Definition: tc_log.h:260
void unlog(ulong cookie, my_xid xid)
erase xid from the page, update page free space counters/pointers.
Definition: tc_log.cc:645
void close() override
Close the transaction coordinator log and free any resources.
Definition: tc_log.cc:664
virtual int do_msync_and_fsync(int fd_arg, void *addr, size_t len, int flags)
Definition: tc_log.h:300
uchar * data
Definition: tc_log.h:263
uint npages
Definition: tc_log.h:262
mysql_mutex_t LOCK_tc
Definition: tc_log.h:269
PAGE * syncing
Definition: tc_log.h:264
char logname[FN_REFLEN]
Definition: tc_log.h:259
TC_LOG_MMAP()
Definition: tc_log.h:282
void overflow()
Definition: tc_log.cc:468
PAGE_STATE
Definition: tc_log.h:237
@ PS_DIRTY
Definition: tc_log.h:240
@ PS_POOL
Definition: tc_log.h:238
@ PS_ERROR
Definition: tc_log.h:239
mysql_cond_t COND_pool
Signalled when one more page becomes available in the pool which we might select as active.
Definition: tc_log.h:279
friend class TCLogMMapTest
Definition: tc_log.h:354
PAGE ** pool_last_ptr
Definition: tc_log.h:264
int recover()
Definition: tc_log.cc:695
int open(const char *opt_name) override
Initialize and open the coordinator log.
Definition: tc_log.cc:316
PAGE * active
Definition: tc_log.h:264
uint inited
Definition: tc_log.h:262
ulong log_xid(my_xid xid)
Record that transaction XID is committed on the persistent storage.
Definition: tc_log.cc:557
mysql_cond_t COND_active
Signalled when active PAGE is moved to syncing state, thus member "active" becomes 0.
Definition: tc_log.h:274
int rollback(THD *thd, bool all) override
Log a rollback record of the transaction to the transaction coordinator log.
Definition: tc_log.cc:516
int prepare(THD *thd, bool all) override
Log a prepare record of the transaction to the storage engines.
Definition: tc_log.cc:523
bool sync()
Write the page data being synchronized to the disk.
Definition: tc_log.cc:610
Transaction Coordinator Log.
Definition: tc_log.h:144
virtual int open(const char *opt_name)=0
Initialize and open the coordinator log.
virtual enum_result commit(THD *thd, bool all)=0
Log a commit record of the transaction to the transaction coordinator log.
virtual ~TC_LOG()=default
bool using_heuristic_recover()
Perform heuristic recovery, if –tc-heuristic-recover was used.
Definition: tc_log.cc:739
virtual void close()=0
Close the transaction coordinator log and free any resources.
virtual int prepare(THD *thd, bool all)=0
Log a prepare record of the transaction to the storage engines.
virtual int rollback(THD *thd, bool all)=0
Log a rollback record of the transaction to the transaction coordinator log.
enum_result
Definition: tc_log.h:160
@ RESULT_INCONSISTENT
Definition: tc_log.h:160
@ RESULT_SUCCESS
Definition: tc_log.h:160
@ RESULT_ABORTED
Definition: tc_log.h:160
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
#define mysql_cond_wait(C, M)
Definition: mysql_cond.h:48
const char * p
Definition: ctype-mb.cc:1237
int my_msync(int, void *, size_t, int)
Definition: my_mmap.cc:51
static int flags[50]
Definition: hp_test1.cc:40
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
ulonglong my_off_t
Definition: my_inttypes.h:72
unsigned char uchar
Definition: my_inttypes.h:52
Common #defines and includes for file and socket I/O.
#define FN_REFLEN
Definition: my_io.h:83
int File
Definition: my_io_bits.h:51
Common header for many mysys elements.
Instrumentation helpers for conditions.
ABI for instrumented mutexes.
bool commit_detached_by_xid(THD *thd, bool run_after_commit=true)
Commits detached XA transaction by XID in all storage engines.
Definition: tc_log.cc:109
bool commit_in_engines(THD *thd, bool all=false, bool run_after_commit=true)
Commits the underlying transaction in storage engines.
Definition: tc_log.cc:137
bool should_statement_set_prepared_in_tc(THD *thd)
Checks whether or not the underlying statement should trigger setting the transaction to PREPARED_IN_...
Definition: tc_log.cc:180
int set_prepared_in_tc_in_engines(THD *thd, bool all=false)
Marks the underlying transaction as PREPARED_IN_TC in storage engines.
Definition: tc_log.cc:162
bool rollback_detached_by_xid(THD *thd)
Rolls back detached XA transaction by XID in all storage engines.
Definition: tc_log.cc:127
bool rollback_in_engines(THD *thd, bool all=false)
Rolls back the underlying transaction in storage engines.
Definition: tc_log.cc:150
Instrumentation helpers for conditions.
ulonglong my_xid
Definition: handler.h:1228
PAGE * next
Definition: tc_log.h:245
my_xid * start
Definition: tc_log.h:246
int waiters
Definition: tc_log.h:249
my_xid * end
Definition: tc_log.h:246
int free
Definition: tc_log.h:248
PAGE_STATE state
Definition: tc_log.h:250
int size
Definition: tc_log.h:248
mysql_cond_t cond
Signalled when syncing of this page is done or when this page is in "active" slot and syncing slot ju...
Definition: tc_log.h:256
my_xid * ptr
Definition: tc_log.h:247
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
TC_LOG_DUMMY tc_log_dummy
Definition: tc_log.cc:736
TC_LOG_MMAP tc_log_mmap
Definition: tc_log.cc:737
TC_LOG * tc_log
Definition: tc_log.cc:735
ulonglong my_xid
Definition: tc_log.h:38
unsigned int uint
Definition: uca9-dump.cc:75
static int all(site_def const *s, node_no node)
Definition: xcom_transport.cc:871