1
/* Copyright (C) 2000-2006 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
21
@addtogroup Replication
31
#if defined(USE_PRAGMA_INTERFACE) && !defined(DRIZZLE_CLIENT)
32
#pragma interface /* gcc class implementation */
32
#ifndef DRIZZLED_LOG_EVENT_H
33
#define DRIZZLED_LOG_EVENT_H
35
37
#include <mysys/my_bitmap.h>
36
38
#include "rpl_constants.h"
37
#ifndef DRIZZLE_CLIENT
38
39
#include "rpl_record.h"
39
40
#include "rpl_reporting.h"
41
#include "my_decimal.h"
44
42
#include <drizzled/sql_string.h> /* append_query_string() needs String declaration */
432
430
@def OPTIONS_WRITTEN_TO_BIN_LOG
434
OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must
432
OPTIONS_WRITTEN_TO_BIN_LOG are the bits of session->options which must
435
433
be written to the binlog. OPTIONS_WRITTEN_TO_BIN_LOG could be
436
434
written into the Format_description_log_event, so that if later we
437
435
don't want to replicate a variable we did replicate, or the
438
436
contrary, it's doable. But it should not be too hard to decide once
439
437
for all of what we replicate and what we don't, among the fixed 32
440
bits of thd->options.
438
bits of session->options.
442
440
I (Guilhem) have read through every option's usage, and it looks
443
441
like OPTION_AUTO_IS_NULL and OPTION_NO_FOREIGN_KEYS are the only
456
454
/* Shouldn't be defined before */
457
455
#define EXPECTED_OPTIONS \
458
((1ULL << 14) | (1ULL << 26) | (1ULL << 27) | (1ULL << 19))
456
((1U << 14) | (1U << 26) | (1U << 27) | (1U << 19))
460
458
#if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS
461
459
#error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values!
550
#ifndef DRIZZLE_CLIENT
552
549
class DRIZZLE_BIN_LOG;
556
552
class Format_description_log_event;
557
553
class Relay_log_info;
559
#ifdef DRIZZLE_CLIENT
560
enum enum_base64_output_mode {
561
BASE64_OUTPUT_NEVER= 0,
562
BASE64_OUTPUT_AUTO= 1,
563
BASE64_OUTPUT_ALWAYS= 2,
564
BASE64_OUTPUT_UNSPEC= 3,
565
/* insert new output modes here */
566
BASE64_OUTPUT_MODE_COUNT
570
A structure for mysqlbinlog to know how to print events
572
This structure is passed to the event's print() methods,
574
There are two types of settings stored here:
575
1. Last db, flags2, sql_mode etc comes from the last printed event.
576
They are stored so that only the necessary USE and SET commands
578
2. Other information on how to print the events, e.g. short_form,
579
hexdump_from. These are not dependent on the last event.
581
typedef struct st_print_event_info
584
Settings for database, sql_mode etc that comes from the last event
585
that was printed. We cache these so that we don't have to print
586
them if they are unchanged.
588
// TODO: have the last catalog here ??
589
char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is
592
bool sql_mode_inited;
593
ulong sql_mode; /* must be same as THD.variables.sql_mode */
594
ulong auto_increment_increment, auto_increment_offset;
596
char charset[6]; // 3 variables, each of them storable in 2 bytes
597
char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
598
uint32_t lc_time_names_number;
599
uint charset_database_number;
601
bool thread_id_printed;
603
st_print_event_info();
605
~st_print_event_info() {
606
close_cached_file(&head_cache);
607
close_cached_file(&body_cache);
609
bool init_ok() /* tells if construction was successful */
610
{ return my_b_inited(&head_cache) && my_b_inited(&body_cache); }
613
/* Settings on how to print the events */
615
enum_base64_output_mode base64_output_mode;
617
This is set whenever a Format_description_event is printed.
618
Later, when an event is printed in base64, this flag is tested: if
619
no Format_description_event has been seen, it is unsafe to print
620
the base64 event, so an error message is generated.
622
bool printed_fd_event;
623
my_off_t hexdump_from;
624
uint8_t common_header_len;
628
These two caches are used by the row-based replication events to
629
collect the header information and the main body of the events
630
making up a statement.
638
556
the struct aggregates two paramenters that identify an event
639
557
uniquely in scope of communication of a particular master and slave couple.
826
744
sees the offset of the BEGIN, which is logical as rollback may
827
745
occur), except the COMMIT query which has its real offset.
831
749
A temp buffer for read_log_event; it is later analysed according to the
832
750
event's type, and its content is distributed in the event-specific fields.
868
786
ulong slave_exec_mode;
870
#ifndef DRIZZLE_CLIENT
874
Log_event(THD* thd_arg, uint16_t flags_arg, bool cache_stmt);
791
Log_event(Session* session_arg, uint16_t flags_arg, bool cache_stmt);
876
793
read_log_event() functions read an event from a binlog or relay
877
794
log; used by SHOW BINLOG EVENTS, the binlog_dump thread on the
906
822
virtual void pack_info(Protocol *protocol);
908
#endif /* HAVE_REPLICATION */
909
824
virtual const char* get_db()
911
return thd ? thd->db : 0;
826
return session ? session->db : 0;
914
Log_event() : temp_buf(0) {}
915
/* avoid having to link mysqlbinlog against libpthread */
916
static Log_event* read_log_event(IO_CACHE* file,
917
const Format_description_log_event
919
/* print*() functions are used by mysqlbinlog */
920
virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
921
void print_timestamp(IO_CACHE* file, time_t *ts = 0);
922
void print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
924
void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
928
829
static void *operator new(size_t size)
933
834
static void operator delete(void *ptr,
934
size_t size __attribute__((unused)))
936
my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
837
free((unsigned char*) ptr);
939
840
/* Placement version of the above operators */
940
841
static void *operator new(size_t, void* ptr) { return ptr; }
941
842
static void operator delete(void*, void*) { }
943
#ifndef DRIZZLE_CLIENT
944
844
bool write_header(IO_CACHE* file, ulong data_length);
945
845
virtual bool write(IO_CACHE* file)
948
848
write_data_header(file) ||
949
849
write_data_body(file));
951
virtual bool write_data_header(IO_CACHE* file __attribute__((unused)))
851
virtual bool write_data_header(IO_CACHE*)
953
virtual bool write_data_body(IO_CACHE* file __attribute__((unused)))
853
virtual bool write_data_body(IO_CACHE*)
955
855
inline time_t get_time()
857
Session *tmp_session;
961
return thd->start_time;
962
if ((tmp_thd= current_thd))
963
return tmp_thd->start_time;
861
return session->start_time;
862
if ((tmp_session= current_session))
863
return tmp_session->start_time;
964
864
return my_time(0);
967
866
virtual Log_event_type get_type_code() = 0;
968
867
virtual bool is_valid() const = 0;
969
868
virtual bool is_artificial_event() { return 0; }
985
884
is calculated during write()
987
886
virtual int get_data_size() { return 0;}
988
static Log_event* read_log_event(const char* buf, uint event_len,
887
static Log_event* read_log_event(const char* buf, uint32_t event_len,
989
888
const char **error,
990
889
const Format_description_log_event
991
890
*description_event);
1282
1179
<td>flags2</td>
1283
1180
<td>Q_FLAGS2_CODE == 0</td>
1284
1181
<td>4 byte bitfield</td>
1285
<td>The flags in @c thd->options, binary AND-ed with @c
1286
OPTIONS_WRITTEN_TO_BIN_LOG. The @c thd->options bitfield contains
1182
<td>The flags in @c session->options, binary AND-ed with @c
1183
OPTIONS_WRITTEN_TO_BIN_LOG. The @c session->options bitfield contains
1287
1184
options for "SELECT". @c OPTIONS_WRITTEN identifies those options
1288
1185
that need to be written to the binlog (not all do). Specifically,
1289
1186
@c OPTIONS_WRITTEN_TO_BIN_LOG equals (@c OPTION_AUTO_IS_NULL | @c
1440
1337
<td>2 byte integer</td>
1442
1339
<td>The value of the collation_database system variable (in the
1443
source code stored in @c thd->variables.collation_database), which
1340
source code stored in @c session->variables.collation_database), which
1444
1341
holds the code for a (character set, collation) pair as described
1445
1342
above (see Q_CHARSET_CODE).
1535
1432
'flags2' is a second set of flags (on top of those in Log_event), for
1536
session variables. These are thd->options which is & against a mask
1433
session variables. These are session->options which is & against a mask
1537
1434
(OPTIONS_WRITTEN_TO_BIN_LOG).
1538
1435
flags2_inited helps make a difference between flags2==0 (3.23 or 4.x
1539
1436
master, we don't know flags2, so use the slave server's global options) and
1549
1446
ulong sql_mode;
1550
1447
ulong auto_increment_increment, auto_increment_offset;
1551
1448
char charset[6];
1552
uint time_zone_len; /* 0 means uninited */
1449
uint32_t time_zone_len; /* 0 means uninited */
1553
1450
const char *time_zone_str;
1554
uint lc_time_names_number; /* 0 means en_US */
1555
uint charset_database_number;
1557
#ifndef DRIZZLE_CLIENT
1559
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
1451
uint32_t lc_time_names_number; /* 0 means en_US */
1452
uint32_t charset_database_number;
1455
Query_log_event(Session* session_arg, const char* query_arg, ulong query_length,
1560
1456
bool using_trans, bool suppress_use,
1561
THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
1457
Session::killed_state killed_err_arg= Session::KILLED_NO_VALUE);
1562
1458
const char* get_db() { return db; }
1563
#ifdef HAVE_REPLICATION
1564
1459
void pack_info(Protocol* protocol);
1565
#endif /* HAVE_REPLICATION */
1567
void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info);
1568
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1571
1461
Query_log_event();
1572
Query_log_event(const char* buf, uint event_len,
1462
Query_log_event(const char* buf, uint32_t event_len,
1573
1463
const Format_description_log_event *description_event,
1574
1464
Log_event_type event_type);
1575
1465
~Query_log_event()
1578
my_free((uchar*) data_buf, MYF(0));
1468
free((unsigned char*) data_buf);
1580
1470
Log_event_type get_type_code() { return QUERY_EVENT; }
1581
#ifndef DRIZZLE_CLIENT
1582
1471
bool write(IO_CACHE* file);
1583
virtual bool write_post_header_for_derived(IO_CACHE* file __attribute__((unused)))
1472
virtual bool write_post_header_for_derived(IO_CACHE*)
1584
1473
{ return false; }
1586
1474
bool is_valid() const { return query != 0; }
1593
1481
/* Writes derived event-specific part of post header. */
1595
1483
public: /* !!! Public in this patch to allow old usage */
1596
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1597
1484
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
1598
1485
virtual int do_apply_event(Relay_log_info const *rli);
1599
1486
virtual int do_update_pos(Relay_log_info *rli);
1658
1543
class Slave_log_event: public Log_event
1661
1546
char* mem_pool;
1662
void init_from_mem_pool(int data_size);
1547
void init_from_mem_pool();
1664
my_off_t master_pos;
1667
int master_host_len;
1550
std::string master_host;
1551
std::string master_log;
1669
1552
uint16_t master_port;
1671
#ifndef DRIZZLE_CLIENT
1672
Slave_log_event(THD* thd_arg, Relay_log_info* rli);
1554
Slave_log_event(Session* session_arg, Relay_log_info* rli);
1673
1555
void pack_info(Protocol* protocol);
1675
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1678
Slave_log_event(const char* buf, uint event_len);
1557
Slave_log_event(const char* buf, uint32_t event_len);
1679
1558
~Slave_log_event();
1680
1559
int get_data_size();
1681
bool is_valid() const { return master_host != 0; }
1560
bool is_valid() const { return master_host.length() != 0; }
1682
1561
Log_event_type get_type_code() { return SLAVE_EVENT; }
1683
#ifndef DRIZZLE_CLIENT
1684
1562
bool write(IO_CACHE* file);
1688
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1689
1565
virtual int do_apply_event(Relay_log_info const* rli);
1693
#endif /* HAVE_REPLICATION */
1697
1570
@class Load_log_event
1895
1768
class Load_log_event: public Log_event
1898
uint get_query_buffer_length();
1771
uint32_t get_query_buffer_length();
1899
1772
void print_query(bool need_db, char *buf, char **end,
1900
1773
char **fn_start, char **fn_end);
1939
1812
return local_fname;
1942
#ifndef DRIZZLE_CLIENT
1943
1815
String field_lens_buf;
1944
1816
String fields_buf;
1946
Load_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
1818
Load_log_event(Session* session, sql_exchange* ex, const char* db_arg,
1947
1819
const char* table_name_arg,
1948
1820
List<Item>& fields_arg, enum enum_duplicates handle_dup, bool ignore,
1949
1821
bool using_trans);
1950
1822
void set_fields(const char* db, List<Item> &fields_arg,
1951
1823
Name_resolution_context *context);
1952
1824
const char* get_db() { return db; }
1953
#ifdef HAVE_REPLICATION
1954
1825
void pack_info(Protocol* protocol);
1955
#endif /* HAVE_REPLICATION */
1957
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1958
void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented);
1962
1828
Note that for all the events related to LOAD DATA (Load_log_event,
1964
1830
logging of LOAD DATA is going to be changed in 4.1 or 5.0, this is only used
1965
1831
for the common_header_len (post_header_len will not be changed).
1967
Load_log_event(const char* buf, uint event_len,
1833
Load_log_event(const char* buf, uint32_t event_len,
1968
1834
const Format_description_log_event* description_event);
1969
1835
~Load_log_event()
1987
1851
public: /* !!! Public in this patch to allow old usage */
1988
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1989
1852
virtual int do_apply_event(Relay_log_info const* rli)
1991
return do_apply_event(thd->slave_net,rli,0);
1854
return do_apply_event(session->slave_net,rli,0);
1994
1857
int do_apply_event(NET *net, Relay_log_info const *rli,
1995
1858
bool use_rli_only_for_errors);
1999
1861
extern char server_version[SERVER_VERSION_LENGTH];
2054
1916
bool dont_set_created;
2056
#ifndef DRIZZLE_CLIENT
2057
1918
Start_log_event_v3();
2058
#ifdef HAVE_REPLICATION
2059
1919
void pack_info(Protocol* protocol);
2060
#endif /* HAVE_REPLICATION */
2062
Start_log_event_v3() {}
2063
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2066
1921
Start_log_event_v3(const char* buf,
2067
1922
const Format_description_log_event* description_event);
2068
1923
~Start_log_event_v3() {}
2069
1924
Log_event_type get_type_code() { return START_EVENT_V3;}
2070
#ifndef DRIZZLE_CLIENT
2071
1925
bool write(IO_CACHE* file);
2073
1926
bool is_valid() const { return 1; }
2074
1927
int get_data_size()
2118
1969
uint8_t number_of_event_types;
2119
1970
/* The list of post-headers' lengthes */
2120
1971
uint8_t *post_header_len;
2121
uchar server_version_split[3];
1972
unsigned char server_version_split[3];
2122
1973
const uint8_t *event_type_permutation;
2124
1975
Format_description_log_event(uint8_t binlog_ver, const char* server_ver=0);
2125
Format_description_log_event(const char* buf, uint event_len,
1976
Format_description_log_event(const char* buf, uint32_t event_len,
2126
1977
const Format_description_log_event
2127
1978
*description_event);
2128
1979
~Format_description_log_event()
2130
my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR));
1981
free((unsigned char*)post_header_len);
2132
1983
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
2133
#ifndef DRIZZLE_CLIENT
2134
1984
bool write(IO_CACHE* file);
2136
1985
bool is_valid() const
2138
1987
return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
2206
#ifndef DRIZZLE_CLIENT
2207
Intvar_log_event(THD* thd_arg,uchar type_arg, uint64_t val_arg)
2208
:Log_event(thd_arg,0,0),val(val_arg),type(type_arg)
2053
Intvar_log_event(Session* session_arg,unsigned char type_arg, uint64_t val_arg)
2054
:Log_event(session_arg,0,0),val(val_arg),type(type_arg)
2210
#ifdef HAVE_REPLICATION
2211
2056
void pack_info(Protocol* protocol);
2212
#endif /* HAVE_REPLICATION */
2214
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2217
2058
Intvar_log_event(const char* buf,
2218
2059
const Format_description_log_event *description_event);
2220
2061
Log_event_type get_type_code() { return INTVAR_EVENT;}
2221
2062
const char* get_var_type_name();
2222
2063
int get_data_size() { return 9; /* sizeof(type) + sizeof(val) */;}
2223
#ifndef DRIZZLE_CLIENT
2224
2064
bool write(IO_CACHE* file);
2226
2065
bool is_valid() const { return 1; }
2229
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2230
2068
virtual int do_apply_event(Relay_log_info const *rli);
2231
2069
virtual int do_update_pos(Relay_log_info *rli);
2232
2070
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2278
2115
uint64_t seed1;
2279
2116
uint64_t seed2;
2281
#ifndef DRIZZLE_CLIENT
2282
Rand_log_event(THD* thd_arg, uint64_t seed1_arg, uint64_t seed2_arg)
2283
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
2118
Rand_log_event(Session* session_arg, uint64_t seed1_arg, uint64_t seed2_arg)
2119
:Log_event(session_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
2285
#ifdef HAVE_REPLICATION
2286
2121
void pack_info(Protocol* protocol);
2287
#endif /* HAVE_REPLICATION */
2289
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2292
2123
Rand_log_event(const char* buf,
2293
2124
const Format_description_log_event *description_event);
2294
2125
~Rand_log_event() {}
2295
2126
Log_event_type get_type_code() { return RAND_EVENT;}
2296
2127
int get_data_size() { return 16; /* sizeof(uint64_t) * 2*/ }
2297
#ifndef DRIZZLE_CLIENT
2298
2128
bool write(IO_CACHE* file);
2300
2129
bool is_valid() const { return 1; }
2303
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2304
2132
virtual int do_apply_event(Relay_log_info const *rli);
2305
2133
virtual int do_update_pos(Relay_log_info *rli);
2306
2134
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2316
2143
@section Xid_log_event_binary_format Binary Format
2318
#ifdef DRIZZLE_CLIENT
2319
typedef uint64_t my_xid; // this line is the same as in handler.h
2322
2145
class Xid_log_event: public Log_event
2327
#ifndef DRIZZLE_CLIENT
2328
Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {}
2329
#ifdef HAVE_REPLICATION
2150
Xid_log_event(Session* session_arg, my_xid x): Log_event(session_arg,0,0), xid(x) {}
2330
2151
void pack_info(Protocol* protocol);
2331
#endif /* HAVE_REPLICATION */
2333
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2336
2153
Xid_log_event(const char* buf,
2337
2154
const Format_description_log_event *description_event);
2338
2155
~Xid_log_event() {}
2339
2156
Log_event_type get_type_code() { return XID_EVENT;}
2340
2157
int get_data_size() { return sizeof(xid); }
2341
#ifndef DRIZZLE_CLIENT
2342
2158
bool write(IO_CACHE* file);
2344
2159
bool is_valid() const { return 1; }
2347
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2348
2162
virtual int do_apply_event(Relay_log_info const *rli);
2349
2163
enum_skip_reason do_shall_skip(Relay_log_info *rli);
2369
2182
Item_result type;
2370
uint charset_number;
2183
uint32_t charset_number;
2372
#ifndef DRIZZLE_CLIENT
2373
User_var_log_event(THD* thd_arg __attribute__((unused)),
2374
char *name_arg, uint name_len_arg,
2185
User_var_log_event(Session*,
2186
char *name_arg, uint32_t name_len_arg,
2375
2187
char *val_arg, ulong val_len_arg, Item_result type_arg,
2376
uint charset_number_arg)
2188
uint32_t charset_number_arg)
2377
2189
:Log_event(), name(name_arg), name_len(name_len_arg), val(val_arg),
2378
2190
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg)
2379
2191
{ is_null= !val; }
2380
2192
void pack_info(Protocol* protocol);
2382
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2385
2194
User_var_log_event(const char* buf,
2386
2195
const Format_description_log_event *description_event);
2387
2196
~User_var_log_event() {}
2388
2197
Log_event_type get_type_code() { return USER_VAR_EVENT;}
2389
#ifndef DRIZZLE_CLIENT
2390
2198
bool write(IO_CACHE* file);
2392
2199
bool is_valid() const { return 1; }
2395
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2396
2202
virtual int do_apply_event(Relay_log_info const *rli);
2397
2203
virtual int do_update_pos(Relay_log_info *rli);
2398
2204
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2411
2216
class Stop_log_event: public Log_event
2414
#ifndef DRIZZLE_CLIENT
2415
2219
Stop_log_event() :Log_event()
2418
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2421
2222
Stop_log_event(const char* buf,
2422
2223
const Format_description_log_event *description_event):
2427
2228
bool is_valid() const { return 1; }
2430
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2431
2231
virtual int do_update_pos(Relay_log_info *rli);
2432
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli __attribute__((unused)))
2232
virtual enum_skip_reason do_shall_skip(Relay_log_info *)
2435
2235
Events from ourself should be skipped, but they should not
2501
2300
const char* new_log_ident;
2505
#ifndef DRIZZLE_CLIENT
2506
2304
Rotate_log_event(const char* new_log_ident_arg,
2508
uint64_t pos_arg, uint flags);
2509
#ifdef HAVE_REPLICATION
2305
uint32_t ident_len_arg,
2306
uint64_t pos_arg, uint32_t flags);
2510
2307
void pack_info(Protocol* protocol);
2511
#endif /* HAVE_REPLICATION */
2513
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2516
Rotate_log_event(const char* buf, uint event_len,
2309
Rotate_log_event(const char* buf, uint32_t event_len,
2517
2310
const Format_description_log_event* description_event);
2518
2311
~Rotate_log_event()
2520
2313
if (flags & DUP_NAME)
2521
my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
2314
free((unsigned char*) new_log_ident);
2523
2316
Log_event_type get_type_code() { return ROTATE_EVENT;}
2524
2317
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
2525
2318
bool is_valid() const { return new_log_ident != 0; }
2526
#ifndef DRIZZLE_CLIENT
2527
2319
bool write(IO_CACHE* file);
2531
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2532
2322
virtual int do_update_pos(Relay_log_info *rli);
2533
2323
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2554
2343
bool fake_base;
2345
unsigned char* block;
2557
2346
const char *event_buf;
2560
2349
bool inited_from_old;
2562
#ifndef DRIZZLE_CLIENT
2563
Create_file_log_event(THD* thd, sql_exchange* ex, const char* db_arg,
2351
Create_file_log_event(Session* session, sql_exchange* ex, const char* db_arg,
2564
2352
const char* table_name_arg,
2565
2353
List<Item>& fields_arg,
2566
2354
enum enum_duplicates handle_dup, bool ignore,
2567
uchar* block_arg, uint block_len_arg,
2355
unsigned char* block_arg, uint32_t block_len_arg,
2568
2356
bool using_trans);
2569
#ifdef HAVE_REPLICATION
2570
2357
void pack_info(Protocol* protocol);
2571
#endif /* HAVE_REPLICATION */
2573
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2574
void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2578
Create_file_log_event(const char* buf, uint event_len,
2359
Create_file_log_event(const char* buf, uint32_t event_len,
2579
2360
const Format_description_log_event* description_event);
2580
2361
~Create_file_log_event()
2582
my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR));
2363
free((char*) event_buf);
2585
2366
Log_event_type get_type_code()
2636
2413
const char* db;
2638
#ifndef DRIZZLE_CLIENT
2639
Append_block_log_event(THD* thd, const char* db_arg, uchar* block_arg,
2640
uint block_len_arg, bool using_trans);
2641
#ifdef HAVE_REPLICATION
2415
Append_block_log_event(Session* session, const char* db_arg, unsigned char* block_arg,
2416
uint32_t block_len_arg, bool using_trans);
2642
2417
void pack_info(Protocol* protocol);
2643
2418
virtual int get_create_or_append() const;
2644
#endif /* HAVE_REPLICATION */
2646
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2649
Append_block_log_event(const char* buf, uint event_len,
2420
Append_block_log_event(const char* buf, uint32_t event_len,
2650
2421
const Format_description_log_event
2651
2422
*description_event);
2652
2423
~Append_block_log_event() {}
2653
2424
Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
2654
2425
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
2655
2426
bool is_valid() const { return block != 0; }
2656
#ifndef DRIZZLE_CLIENT
2657
2427
bool write(IO_CACHE* file);
2658
2428
const char* get_db() { return db; }
2662
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2663
2431
virtual int do_apply_event(Relay_log_info const *rli);
2674
2441
class Delete_file_log_event: public Log_event
2678
2445
const char* db; /* see comment in Append_block_log_event */
2680
#ifndef DRIZZLE_CLIENT
2681
Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans);
2682
#ifdef HAVE_REPLICATION
2447
Delete_file_log_event(Session* session, const char* db_arg, bool using_trans);
2683
2448
void pack_info(Protocol* protocol);
2684
#endif /* HAVE_REPLICATION */
2686
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2687
void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2691
Delete_file_log_event(const char* buf, uint event_len,
2450
Delete_file_log_event(const char* buf, uint32_t event_len,
2692
2451
const Format_description_log_event* description_event);
2693
2452
~Delete_file_log_event() {}
2694
2453
Log_event_type get_type_code() { return DELETE_FILE_EVENT;}
2695
2454
int get_data_size() { return DELETE_FILE_HEADER_LEN ;}
2696
2455
bool is_valid() const { return file_id != 0; }
2697
#ifndef DRIZZLE_CLIENT
2698
2456
bool write(IO_CACHE* file);
2699
2457
const char* get_db() { return db; }
2703
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2704
2460
virtual int do_apply_event(Relay_log_info const *rli);
2715
2470
class Execute_load_log_event: public Log_event
2719
2474
const char* db; /* see comment in Append_block_log_event */
2721
#ifndef DRIZZLE_CLIENT
2722
Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans);
2723
#ifdef HAVE_REPLICATION
2476
Execute_load_log_event(Session* session, const char* db_arg, bool using_trans);
2724
2477
void pack_info(Protocol* protocol);
2725
#endif /* HAVE_REPLICATION */
2727
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2730
Execute_load_log_event(const char* buf, uint event_len,
2479
Execute_load_log_event(const char* buf, uint32_t event_len,
2731
2480
const Format_description_log_event
2732
2481
*description_event);
2733
2482
~Execute_load_log_event() {}
2734
2483
Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
2735
2484
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
2736
2485
bool is_valid() const { return file_id != 0; }
2737
#ifndef DRIZZLE_CLIENT
2738
2486
bool write(IO_CACHE* file);
2739
2487
const char* get_db() { return db; }
2743
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2744
2490
virtual int do_apply_event(Relay_log_info const *rli);
2758
2503
class Begin_load_query_log_event: public Append_block_log_event
2761
#ifndef DRIZZLE_CLIENT
2762
Begin_load_query_log_event(THD* thd_arg, const char *db_arg,
2763
uchar* block_arg, uint block_len_arg,
2506
Begin_load_query_log_event(Session* session_arg, const char *db_arg,
2507
unsigned char* block_arg, uint32_t block_len_arg,
2764
2508
bool using_trans);
2765
#ifdef HAVE_REPLICATION
2766
Begin_load_query_log_event(THD* thd);
2509
Begin_load_query_log_event(Session* session);
2767
2510
int get_create_or_append() const;
2768
#endif /* HAVE_REPLICATION */
2770
Begin_load_query_log_event(const char* buf, uint event_len,
2511
Begin_load_query_log_event(const char* buf, uint32_t event_len,
2771
2512
const Format_description_log_event
2772
2513
*description_event);
2773
2514
~Begin_load_query_log_event() {}
2774
2515
Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
2776
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2777
2517
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2797
2536
class Execute_load_query_log_event: public Query_log_event
2800
uint file_id; // file_id of temporary file
2801
uint fn_pos_start; // pointer to the part of the query that should
2539
uint32_t file_id; // file_id of temporary file
2540
uint32_t fn_pos_start; // pointer to the part of the query that should
2802
2541
// be substituted
2803
uint fn_pos_end; // pointer to the end of this part of query
2542
uint32_t fn_pos_end; // pointer to the end of this part of query
2805
2544
We have to store type of duplicate handling explicitly, because
2806
2545
for LOAD DATA it also depends on LOCAL option. And this part
2810
2549
enum_load_dup_handling dup_handling;
2812
#ifndef DRIZZLE_CLIENT
2813
Execute_load_query_log_event(THD* thd, const char* query_arg,
2814
ulong query_length, uint fn_pos_start_arg,
2815
uint fn_pos_end_arg,
2551
Execute_load_query_log_event(Session* session, const char* query_arg,
2552
ulong query_length, uint32_t fn_pos_start_arg,
2553
uint32_t fn_pos_end_arg,
2816
2554
enum_load_dup_handling dup_handling_arg,
2817
2555
bool using_trans, bool suppress_use,
2819
killed_err_arg= THD::KILLED_NO_VALUE);
2820
#ifdef HAVE_REPLICATION
2556
Session::killed_state
2557
killed_err_arg= Session::KILLED_NO_VALUE);
2821
2558
void pack_info(Protocol* protocol);
2822
#endif /* HAVE_REPLICATION */
2824
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2825
/* Prints the query as LOAD DATA LOCAL and with rewritten filename */
2826
void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2827
const char *local_fname);
2829
Execute_load_query_log_event(const char* buf, uint event_len,
2559
Execute_load_query_log_event(const char* buf, uint32_t event_len,
2830
2560
const Format_description_log_event
2831
2561
*description_event);
2832
2562
~Execute_load_query_log_event() {}
2835
2565
bool is_valid() const { return Query_log_event::is_valid() && file_id != 0; }
2837
2567
ulong get_post_header_size_for_derived();
2838
#ifndef DRIZZLE_CLIENT
2839
2568
bool write_post_header_for_derived(IO_CACHE* file);
2843
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2844
2571
virtual int do_apply_event(Relay_log_info const *rli);
2849
#ifdef DRIZZLE_CLIENT
2851
@class Unknown_log_event
2853
@section Unknown_log_event_binary_format Binary Format
2855
class Unknown_log_event: public Log_event
2859
Even if this is an unknown event, we still pass description_event to
2860
Log_event's ctor, this way we can extract maximum information from the
2861
event's header (the unique ID for example).
2863
Unknown_log_event(const char* buf,
2864
const Format_description_log_event *description_event):
2865
Log_event(buf, description_event)
2867
~Unknown_log_event() {}
2868
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2869
Log_event_type get_type_code() { return UNKNOWN_EVENT;}
2870
bool is_valid() const { return 1; }
2873
char *str_to_hex(char *to, const char *from, uint len);
2575
char *str_to_hex(char *to, const char *from, uint32_t len);
2876
2578
@class Table_map_log_event
3163
2865
void clear_flags(flag_set flag) { m_flags &= ~flag; }
3164
2866
flag_set get_flags(flag_set flag) const { return m_flags & flag; }
3166
#ifndef DRIZZLE_CLIENT
3167
Table_map_log_event(THD *thd, Table *tbl, ulong tid,
2868
Table_map_log_event(Session *session, Table *tbl, ulong tid,
3168
2869
bool is_transactional, uint16_t flags);
3170
#ifdef HAVE_REPLICATION
3171
Table_map_log_event(const char *buf, uint event_len,
2870
Table_map_log_event(const char *buf, uint32_t event_len,
3172
2871
const Format_description_log_event *description_event);
3175
2873
~Table_map_log_event();
3178
2876
virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
3180
2878
virtual int get_data_size() { return m_data_size; }
3181
#ifndef DRIZZLE_CLIENT
3182
2879
virtual int save_field_metadata();
3183
2880
virtual bool write_data_header(IO_CACHE *file);
3184
2881
virtual bool write_data_body(IO_CACHE *file);
3185
2882
virtual const char *get_db() { return m_dbnam; }
3188
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3189
2883
virtual void pack_info(Protocol *protocol);
3192
#ifdef DRIZZLE_CLIENT
3193
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3198
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3199
2886
virtual int do_apply_event(Relay_log_info const *rli);
3200
2887
virtual int do_update_pos(Relay_log_info *rli);
3201
2888
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
3204
#ifndef DRIZZLE_CLIENT
3205
2890
Table *m_table;
3207
2891
char const *m_dbnam;
3208
2892
size_t m_dblen;
3209
2893
char const *m_tblnam;
3210
2894
size_t m_tbllen;
3211
2895
ulong m_colcnt;
2896
unsigned char *m_coltype;
2898
unsigned char *m_memory;
3215
2899
ulong m_table_id;
3216
2900
flag_set m_flags;
3218
2902
size_t m_data_size;
3220
uchar *m_field_metadata; // buffer for field metadata
2904
unsigned char *m_field_metadata; // buffer for field metadata
3222
2906
The size of field metadata buffer set by calling save_field_metadata()
3224
2908
ulong m_field_metadata_size;
3226
uchar *m_meta_memory;
2909
unsigned char *m_null_bits;
2910
unsigned char *m_meta_memory;
3270
2954
/* Last event of a statement */
3271
2955
STMT_END_F = (1U << 0),
3273
/* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in thd->options */
2957
/* Value of the OPTION_NO_FOREIGN_KEY_CHECKS flag in session->options */
3274
2958
NO_FOREIGN_KEY_CHECKS_F = (1U << 1),
3276
/* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in thd->options */
2960
/* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in session->options */
3277
2961
RELAXED_UNIQUE_CHECKS_F = (1U << 2),
3297
2981
void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; }
3298
2982
flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; }
3300
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3301
2984
virtual void pack_info(Protocol *protocol);
3304
#ifdef DRIZZLE_CLIENT
3305
/* not for direct call, each derived has its own ::print() */
3306
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info)= 0;
3309
#ifndef DRIZZLE_CLIENT
3310
int add_row_data(uchar *data, size_t length)
2986
int add_row_data(unsigned char *data, size_t length)
3312
2988
return do_add_row_data(data,length);
3316
2991
/* Member functions to implement superclass interface */
3317
2992
virtual int get_data_size();
3320
2995
size_t get_width() const { return m_width; }
3321
2996
ulong get_table_id() const { return m_table_id; }
3323
#ifndef DRIZZLE_CLIENT
3324
2998
virtual bool write_data_header(IO_CACHE *file);
3325
2999
virtual bool write_data_body(IO_CACHE *file);
3326
3000
virtual const char *get_db() { return m_table->s->db.str; }
3329
3002
Check that malloc() succeeded in allocating memory for the rows
3330
3003
buffer and the COLS vector. Checking that an Update_rows_log_event
3336
3009
return m_rows_buf && m_cols.bitmap;
3339
uint m_row_count; /* The number of rows added to the event */
3012
uint32_t m_row_count; /* The number of rows added to the event */
3343
3016
The constructors are protected since you're supposed to inherit
3344
3017
this class, not create instances of this class.
3346
#ifndef DRIZZLE_CLIENT
3347
Rows_log_event(THD*, Table*, ulong table_id,
3019
Rows_log_event(Session*, Table*, ulong table_id,
3348
3020
MY_BITMAP const *cols, bool is_transactional);
3350
Rows_log_event(const char *row_data, uint event_len,
3021
Rows_log_event(const char *row_data, uint32_t event_len,
3351
3022
Log_event_type event_type,
3352
3023
const Format_description_log_event *description_event);
3354
#ifdef DRIZZLE_CLIENT
3355
void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name);
3358
#ifndef DRIZZLE_CLIENT
3359
virtual int do_add_row_data(uchar *data, size_t length);
3362
#ifndef DRIZZLE_CLIENT
3025
virtual int do_add_row_data(unsigned char *data, size_t length);
3363
3027
Table *m_table; /* The table the rows belong to */
3365
3028
ulong m_table_id; /* Table ID */
3366
3029
MY_BITMAP m_cols; /* Bitmap denoting columns available */
3367
3030
ulong m_width; /* The width of the columns bitmap */
3380
3043
uint32_t m_bitbuf[128/(sizeof(uint32_t)*8)];
3381
3044
uint32_t m_bitbuf_ai[128/(sizeof(uint32_t)*8)];
3383
uchar *m_rows_buf; /* The rows in packed format */
3384
uchar *m_rows_cur; /* One-after the end of the data */
3385
uchar *m_rows_end; /* One-after the end of the allocated space */
3046
unsigned char *m_rows_buf; /* The rows in packed format */
3047
unsigned char *m_rows_cur; /* One-after the end of the data */
3048
unsigned char *m_rows_end; /* One-after the end of the allocated space */
3387
3050
flag_set m_flags; /* Flags for row-level events */
3389
3052
/* helper functions */
3391
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3392
const uchar *m_curr_row; /* Start of the row being processed */
3393
const uchar *m_curr_row_end; /* One-after the end of the current row */
3394
uchar *m_key; /* Buffer to keep key value during searches */
3054
const unsigned char *m_curr_row; /* Start of the row being processed */
3055
const unsigned char *m_curr_row_end; /* One-after the end of the current row */
3056
unsigned char *m_key; /* Buffer to keep key value during searches */
3396
3058
int find_row(const Relay_log_info *const);
3397
3059
int write_row(const Relay_log_info *const, const bool);
3399
3061
// Unpack the current row into m_table->record[0]
3400
3062
int unpack_current_row(const Relay_log_info *const rli,
3401
MY_BITMAP const *cols)
3404
ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
3405
int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, cols,
3406
&m_curr_row_end, &m_master_reclength);
3407
if (m_curr_row_end > m_rows_end)
3408
my_error(ER_SLAVE_CORRUPT_EVENT, MYF(0));
3409
ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
3063
MY_BITMAP const *cols);
3416
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3417
3067
virtual int do_apply_event(Relay_log_info const *rli);
3418
3068
virtual int do_update_pos(Relay_log_info *rli);
3419
3069
virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
3490
/* Support interface to THD::binlog_prepare_pending_rows_event */
3139
/* Support interface to Session::binlog_prepare_pending_rows_event */
3491
3140
TYPE_CODE = WRITE_ROWS_EVENT
3494
#if !defined(DRIZZLE_CLIENT)
3495
Write_rows_log_event(THD*, Table*, ulong table_id,
3143
Write_rows_log_event(Session*, Table*, ulong table_id,
3496
3144
bool is_transactional);
3498
#ifdef HAVE_REPLICATION
3499
Write_rows_log_event(const char *buf, uint event_len,
3145
Write_rows_log_event(const char *buf, uint32_t event_len,
3500
3146
const Format_description_log_event *description_event);
3502
#if !defined(DRIZZLE_CLIENT)
3503
static bool binlog_row_logging_function(THD *thd, Table *table,
3147
static bool binlog_row_logging_function(Session *session, Table *table,
3504
3148
bool is_transactional,
3505
const uchar *before_record
3506
__attribute__((unused)),
3507
const uchar *after_record)
3149
const unsigned char *,
3150
const unsigned char *after_record)
3509
return thd->binlog_write_row(table, is_transactional, after_record);
3152
return session->binlog_write_row(table, is_transactional, after_record);
3514
3156
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3516
#ifdef DRIZZLE_CLIENT
3517
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3520
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3521
3158
virtual int do_before_row_operations(const Slave_reporting_capability *const);
3522
3159
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3523
3160
virtual int do_exec_row(const Relay_log_info *const);
3545
/* Support interface to THD::binlog_prepare_pending_rows_event */
3181
/* Support interface to Session::binlog_prepare_pending_rows_event */
3546
3182
TYPE_CODE = UPDATE_ROWS_EVENT
3549
#ifndef DRIZZLE_CLIENT
3550
Update_rows_log_event(THD*, Table*, ulong table_id,
3185
Update_rows_log_event(Session*, Table*, ulong table_id,
3551
3186
bool is_transactional);
3553
3188
void init(MY_BITMAP const *cols);
3556
3190
virtual ~Update_rows_log_event();
3558
#ifdef HAVE_REPLICATION
3559
Update_rows_log_event(const char *buf, uint event_len,
3192
Update_rows_log_event(const char *buf, uint32_t event_len,
3560
3193
const Format_description_log_event *description_event);
3563
#if !defined(DRIZZLE_CLIENT)
3564
static bool binlog_row_logging_function(THD *thd, Table *table,
3195
static bool binlog_row_logging_function(Session *session, Table *table,
3565
3196
bool is_transactional,
3566
const uchar *before_record,
3567
const uchar *after_record)
3197
const unsigned char *before_record,
3198
const unsigned char *after_record)
3569
return thd->binlog_update_row(table, is_transactional,
3200
return session->binlog_update_row(table, is_transactional,
3570
3201
before_record, after_record);
3574
3204
virtual bool is_valid() const
3580
3210
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3582
#ifdef DRIZZLE_CLIENT
3583
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3586
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3587
3212
virtual int do_before_row_operations(const Slave_reporting_capability *const);
3588
3213
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3589
3214
virtual int do_exec_row(const Relay_log_info *const);
3590
#endif /* !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION) */
3618
/* Support interface to THD::binlog_prepare_pending_rows_event */
3242
/* Support interface to Session::binlog_prepare_pending_rows_event */
3619
3243
TYPE_CODE = DELETE_ROWS_EVENT
3622
#ifndef DRIZZLE_CLIENT
3623
Delete_rows_log_event(THD*, Table*, ulong,
3246
Delete_rows_log_event(Session*, Table*, ulong,
3624
3247
bool is_transactional);
3626
#ifdef HAVE_REPLICATION
3627
Delete_rows_log_event(const char *buf, uint event_len,
3248
Delete_rows_log_event(const char *buf, uint32_t event_len,
3628
3249
const Format_description_log_event *description_event);
3630
#if !defined(DRIZZLE_CLIENT)
3631
static bool binlog_row_logging_function(THD *thd, Table *table,
3250
static bool binlog_row_logging_function(Session *session, Table *table,
3632
3251
bool is_transactional,
3633
const uchar *before_record,
3634
const uchar *after_record
3635
__attribute__((unused)))
3252
const unsigned char *before_record,
3253
const unsigned char *)
3637
return thd->binlog_delete_row(table, is_transactional, before_record);
3255
return session->binlog_delete_row(table, is_transactional, before_record);
3642
3259
virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3644
#ifdef DRIZZLE_CLIENT
3645
void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3648
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3649
3261
virtual int do_before_row_operations(const Slave_reporting_capability *const);
3650
3262
virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
3651
3263
virtual int do_exec_row(const Relay_log_info *const);
3692
3303
class Incident_log_event : public Log_event {
3694
#ifndef DRIZZLE_CLIENT
3695
Incident_log_event(THD *thd_arg, Incident incident)
3696
: Log_event(thd_arg, 0, false), m_incident(incident)
3305
Incident_log_event(Session *session_arg, Incident incident)
3306
: Log_event(session_arg, 0, false), m_incident(incident)
3698
3308
m_message.str= NULL; /* Just as a precaution */
3699
3309
m_message.length= 0;
3703
Incident_log_event(THD *thd_arg, Incident incident, LEX_STRING const msg)
3704
: Log_event(thd_arg, 0, false), m_incident(incident)
3313
Incident_log_event(Session *session_arg, Incident incident, LEX_STRING const msg)
3314
: Log_event(session_arg, 0, false), m_incident(incident)
3706
3316
m_message= msg;
3711
#ifndef DRIZZLE_CLIENT
3712
3320
void pack_info(Protocol*);
3715
Incident_log_event(const char *buf, uint event_len,
3322
Incident_log_event(const char *buf, uint32_t event_len,
3716
3323
const Format_description_log_event *descr_event);
3718
3325
virtual ~Incident_log_event();
3720
#ifdef DRIZZLE_CLIENT
3721
virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3724
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3725
3327
virtual int do_apply_event(Relay_log_info const *rli);
3728
3329
virtual bool write_data_header(IO_CACHE *file);
3729
3330
virtual bool write_data_body(IO_CACHE *file);
3772
3372
class Heartbeat_log_event: public Log_event
3775
Heartbeat_log_event(const char* buf, uint event_len,
3375
Heartbeat_log_event(const char* buf, uint32_t event_len,
3776
3376
const Format_description_log_event* description_event);
3777
3377
Log_event_type get_type_code() { return HEARTBEAT_LOG_EVENT; }
3778
3378
bool is_valid() const
3781
3381
log_pos >= BIN_LOG_HEADER_SIZE);
3783
3383
const char * get_log_ident() { return log_ident; }
3784
uint get_ident_len() { return ident_len; }
3384
uint32_t get_ident_len() { return ident_len; }
3787
3387
const char* log_ident;
3793
3392
@} (end of group Replication)
3796
#endif /* _log_event_h */
3395
#endif /* DRIZZLED_LOG_EVENT_H */