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