| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
#ifndef PFS_EVENTS_TRANSACTIONS_H |
| 25 |
#define PFS_EVENTS_TRANSACTIONS_H |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#include <sys/types.h> |
| 33 |
#include <atomic> |
| 34 |
|
| 35 |
#include "my_inttypes.h" |
| 36 |
#include "sql/rpl_gtid.h" |
| 37 |
#include "storage/perfschema/pfs_column_types.h" |
| 38 |
#include "storage/perfschema/pfs_events.h" |
| 39 |
#include "storage/perfschema/pfs_global.h" |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#define XIDDATASIZE 128 |
| 46 |
|
| 47 |
struct PFS_thread; |
| 48 |
struct PFS_account; |
| 49 |
struct PFS_user; |
| 50 |
struct PFS_host; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
struct PSI_xid { |
| 65 |
|
| 66 |
long formatID; |
| 67 |
|
| 68 |
long gtrid_length; |
| 69 |
|
| 70 |
long bqual_length; |
| 71 |
|
| 72 |
char data[XIDDATASIZE]; |
| 73 |
|
| 74 |
PSI_xid() { null(); } |
| 75 |
bool is_null() const { return formatID == -1; } |
| 76 |
void null() { |
| 77 |
formatID = -1; |
| 78 |
gtrid_length = 0; |
| 79 |
bqual_length = 0; |
| 80 |
} |
| 81 |
}; |
| 82 |
typedef struct PSI_xid PSI_xid; |
| 83 |
|
| 84 |
|
| 85 |
struct PFS_events_transactions : public PFS_events { |
| 86 |
|
| 87 |
rpl_sid m_sid; |
| 88 |
|
| 89 |
ulonglong m_trxid; |
| 90 |
|
| 91 |
enum_transaction_state m_state; |
| 92 |
|
| 93 |
Gtid_specification m_gtid_spec; |
| 94 |
|
| 95 |
bool m_xa; |
| 96 |
|
| 97 |
PSI_xid m_xid; |
| 98 |
|
| 99 |
enum_xa_transaction_state m_xa_state; |
| 100 |
|
| 101 |
enum_isolation_level m_isolation_level; |
| 102 |
|
| 103 |
bool m_read_only; |
| 104 |
|
| 105 |
bool m_autocommit; |
| 106 |
|
| 107 |
ulonglong m_savepoint_count; |
| 108 |
|
| 109 |
ulonglong m_rollback_to_savepoint_count; |
| 110 |
|
| 111 |
ulonglong m_release_savepoint_count; |
| 112 |
}; |
| 113 |
|
| 114 |
bool xid_printable(PSI_xid *xid, size_t offset, size_t length); |
| 115 |
|
| 116 |
void insert_events_transactions_history(PFS_thread *thread, |
| 117 |
PFS_events_transactions *transaction); |
| 118 |
void insert_events_transactions_history_long( |
| 119 |
PFS_events_transactions *transaction); |
| 120 |
|
| 121 |
extern bool flag_events_transactions_current; |
| 122 |
extern bool flag_events_transactions_history; |
| 123 |
extern bool flag_events_transactions_history_long; |
| 124 |
|
| 125 |
extern bool events_transactions_history_long_full; |
| 126 |
extern PFS_cacheline_atomic_uint32 events_transactions_history_long_index; |
| 127 |
extern PFS_events_transactions *events_transactions_history_long_array; |
| 128 |
extern ulong events_transactions_history_long_size; |
| 129 |
|
| 130 |
int init_events_transactions_history_long( |
| 131 |
uint events_transactions_history_long_sizing); |
| 132 |
void cleanup_events_transactions_history_long(); |
| 133 |
|
| 134 |
void reset_events_transactions_current(); |
| 135 |
void reset_events_transactions_history(); |
| 136 |
void reset_events_transactions_history_long(); |
| 137 |
void reset_events_transactions_by_thread(); |
| 138 |
void reset_events_transactions_by_account(); |
| 139 |
void reset_events_transactions_by_user(); |
| 140 |
void reset_events_transactions_by_host(); |
| 141 |
void reset_events_transactions_global(); |
| 142 |
void aggregate_account_transactions(PFS_account *account); |
| 143 |
void aggregate_user_transactions(PFS_user *user); |
| 144 |
void aggregate_host_transactions(PFS_host *host); |
| 145 |
|
| 146 |
#endif |