diff options
Diffstat (limited to 'sql/log_event.h')
-rw-r--r-- | sql/log_event.h | 97 |
1 files changed, 89 insertions, 8 deletions
diff --git a/sql/log_event.h b/sql/log_event.h index 3adc7a26d93..405b9a15003 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -240,7 +240,8 @@ class String; 1 + 8 /* type, table_map_for_update */ + \ 1 + 4 /* type, master_data_written */ + \ 1 + 3 /* type, sec_part of NOW() */ + \ - 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */) + 1 + 16 + 1 + 60/* type, user_len, user, host_len, host */ + \ + 1 + 2 + 8 /* type, flags3, seq_no */) #define MAX_LOG_EVENT_HEADER ( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ @@ -321,6 +322,7 @@ class String; #define Q_HRNOW 128 #define Q_XID 129 +#define Q_GTID_FLAGS3 130 /* Intvar event post-header */ /* Intvar event data */ @@ -920,6 +922,20 @@ typedef struct st_print_event_info IO_CACHE review_sql_cache; #endif FILE *file; + + + + /* + Used to include the events within a GTID start/stop boundary + */ + my_bool m_is_event_group_active; + + /* + Tracks whether or not output events must be explicitly activated in order + to be printed + */ + my_bool m_is_event_group_filtering_enabled; + st_print_event_info(); ~st_print_event_info() { @@ -942,6 +958,40 @@ typedef struct st_print_event_info copy_event_cache_to_file_and_reinit(&body_cache, file); fflush(file); } + + /* + Notify that all events part of the current group should be printed + */ + void activate_current_event_group() + { + m_is_event_group_active= TRUE; + } + void deactivate_current_event_group() + { + m_is_event_group_active= FALSE; + } + + /* + Used for displaying events part of an event group. + Returns TRUE when both event group filtering is enabled and the current + event group should be displayed, OR if event group filtering is + disabled. More specifically, if filtering is disabled, all events + should be shown. + Returns FALSE when event group filtering is enabled and the current event + group is filtered out. + */ + my_bool is_event_group_active() + { + return m_is_event_group_filtering_enabled ? m_is_event_group_active : TRUE; + } + + /* + Notify that events must be explicitly activated in order to be printed + */ + void enable_event_group_filtering() + { + m_is_event_group_filtering_enabled= TRUE; + } } PRINT_EVENT_INFO; #endif @@ -2148,6 +2198,12 @@ public: Q_MASTER_DATA_WRITTEN_CODE to the slave's server binlog. */ uint32 master_data_written; + /* + A copy of Gtid event's extra flags that is relevant for two-phase + logged ALTER. + */ + uchar gtid_flags_extra; + decltype(rpl_gtid::seq_no) sa_seq_no; /* data part for CA/RA flags */ #ifdef MYSQL_SERVER @@ -2159,6 +2215,7 @@ public: #endif /* HAVE_REPLICATION */ #else bool print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); + bool print_verbose(IO_CACHE* cache, PRINT_EVENT_INFO* print_event_info); bool print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif @@ -2172,8 +2229,10 @@ public: my_free(data_buf); } Log_event_type get_type_code() { return QUERY_EVENT; } - static int dummy_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); - static int begin_event(String *packet, ulong ev_offset, enum enum_binlog_checksum_alg checksum_alg); + static int dummy_event(String *packet, ulong ev_offset, + enum enum_binlog_checksum_alg checksum_alg); + static int begin_event(String *packet, ulong ev_offset, + enum enum_binlog_checksum_alg checksum_alg); #ifdef MYSQL_SERVER bool write(); virtual bool write_post_header_for_derived() { return FALSE; } @@ -2199,6 +2258,9 @@ public: /* !!! Public in this patch to allow old usage */ size_t event_len, enum enum_binlog_checksum_alg checksum_alg); + int handle_split_alter_query_log_event(rpl_group_info *rgi, + bool &skip_error_check); + #endif /* HAVE_REPLICATION */ /* If true, the event always be applied by slave SQL thread or be printed by @@ -3606,13 +3668,19 @@ public: uint64 seq_no; uint64 commit_id; uint32 domain_id; + uint64 sa_seq_no; // start alter identifier for CA/RA #ifdef MYSQL_SERVER event_xid_t xid; #else event_mysql_xid_t xid; #endif uchar flags2; - uint flags_extra; // more flags area placed after the regular flags2's one + /* + More flags area placed after the regular flags2's area. The type + is declared to be in agreement with Query_log_event's member that + may copy the flags_extra value. + */ + decltype(Query_log_event::gtid_flags_extra) flags_extra; /* Number of engine participants in transaction minus 1. When zero the event does not contain that information. @@ -3650,14 +3718,19 @@ public: /* FL_"COMMITTED or ROLLED-BACK"_XA is set for XA transaction. */ static const uchar FL_COMPLETED_XA= 128; - /* Flags_extra. */ - /* - FL_EXTRA_MULTI_ENGINE is set for event group comprising a transaction + flags_extra 's bit values. + _E1 suffix below stands for Extra to infer the extra flags, + their "1st" generation (more *generations* can come when necessary). + + FL_EXTRA_MULTI_ENGINE_E1 is set for event group comprising a transaction involving multiple storage engines. No flag and extra data are added to the event when the transaction involves only one engine. */ - static const uchar FL_EXTRA_MULTI_ENGINE= 1; + static const uchar FL_EXTRA_MULTI_ENGINE_E1= 1; + static const uchar FL_START_ALTER_E1= 2; + static const uchar FL_COMMIT_ALTER_E1= 4; + static const uchar FL_ROLLBACK_ALTER_E1= 8; #ifdef MYSQL_SERVER Gtid_log_event(THD *thd_arg, uint64 seq_no, uint32 domain_id, bool standalone, @@ -5827,4 +5900,12 @@ int row_log_event_uncompress(const Format_description_log_event uchar* buf, ulong buf_size, bool *is_malloc, uchar **dst, ulong *newlen); +bool is_parallel_retry_error(rpl_group_info *rgi, int err); + +/* + Compares two GTIDs to facilitate sorting a GTID list log event by domain id + (ascending) and sequence number (ascending) +*/ +int compare_glle_gtids(const void * _gtid1, const void *_gtid2); + #endif /* _log_event_h */ |