~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/log_event.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2006 MySQL AB
2
 
 
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.
6
 
 
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.
11
 
 
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:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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
 
18
 */
15
19
 
16
20
/**
17
21
  @addtogroup Replication
25
29
*/
26
30
 
27
31
 
28
 
#ifndef _log_event_h
29
 
#define _log_event_h
30
 
 
31
 
#if defined(USE_PRAGMA_INTERFACE) && !defined(DRIZZLE_CLIENT)
32
 
#pragma interface                       /* gcc class implementation */
33
 
#endif
34
 
 
 
32
#ifndef DRIZZLED_LOG_EVENT_H
 
33
#define DRIZZLED_LOG_EVENT_H
 
34
 
 
35
 
 
36
#include <string>
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"
40
 
#else
41
 
#include "my_decimal.h"
42
 
#endif
43
41
 
44
42
#include <drizzled/sql_string.h>       /* append_query_string() needs String declaration */
45
43
 
161
159
  char opt_flags;
162
160
  char empty_flags;
163
161
 
164
 
  // store in new format even if old is possible
 
162
  /* store in new format even if old is possible */
165
163
  void force_new_format() { cached_new_format = 1;}
166
164
  int data_size()
167
165
  {
431
429
/**
432
430
  @def OPTIONS_WRITTEN_TO_BIN_LOG
433
431
 
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.
441
439
 
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
455
453
 
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))
459
457
 
460
458
#if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS
461
459
#error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values!
547
545
};
548
546
 
549
547
 
550
 
#ifndef DRIZZLE_CLIENT
551
548
class String;
552
549
class DRIZZLE_BIN_LOG;
553
 
class THD;
554
 
#endif
 
550
class Session;
555
551
 
556
552
class Format_description_log_event;
557
553
class Relay_log_info;
558
554
 
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
567
 
};
568
 
 
569
 
/*
570
 
  A structure for mysqlbinlog to know how to print events
571
 
 
572
 
  This structure is passed to the event's print() methods,
573
 
 
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
577
 
     are printed.
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.
580
 
*/
581
 
typedef struct st_print_event_info
582
 
{
583
 
  /*
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.
587
 
  */
588
 
  // TODO: have the last catalog here ??
589
 
  char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is
590
 
  bool flags2_inited;
591
 
  uint32_t flags2;
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;
595
 
  bool charset_inited;
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;
600
 
  uint thread_id;
601
 
  bool thread_id_printed;
602
 
 
603
 
  st_print_event_info();
604
 
 
605
 
  ~st_print_event_info() {
606
 
    close_cached_file(&head_cache);
607
 
    close_cached_file(&body_cache);
608
 
  }
609
 
  bool init_ok() /* tells if construction was successful */
610
 
    { return my_b_inited(&head_cache) && my_b_inited(&body_cache); }
611
 
 
612
 
 
613
 
  /* Settings on how to print the events */
614
 
  bool short_form;
615
 
  enum_base64_output_mode base64_output_mode;
616
 
  /*
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.
621
 
  */
622
 
  bool printed_fd_event;
623
 
  my_off_t hexdump_from;
624
 
  uint8_t common_header_len;
625
 
  char delimiter[16];
626
 
 
627
 
  /*
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.
631
 
   */
632
 
  IO_CACHE head_cache;
633
 
  IO_CACHE body_cache;
634
 
} PRINT_EVENT_INFO;
635
 
#endif
636
 
 
637
555
/**
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.
828
746
  */
829
 
  my_off_t log_pos;
 
747
  off_t log_pos;
830
748
  /*
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.
867
785
  */
868
786
  ulong slave_exec_mode;
869
787
 
870
 
#ifndef DRIZZLE_CLIENT
871
 
  THD* thd;
 
788
  Session* session;
872
789
 
873
790
  Log_event();
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);
875
792
  /*
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
895
812
    EVENTS.
896
813
  */
897
814
  static void init_show_field_list(List<Item>* field_list);
898
 
#ifdef HAVE_REPLICATION
899
815
  int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
900
816
 
901
817
  /*
905
821
 
906
822
  virtual void pack_info(Protocol *protocol);
907
823
 
908
 
#endif /* HAVE_REPLICATION */
909
824
  virtual const char* get_db()
910
825
  {
911
 
    return thd ? thd->db : 0;
 
826
    return session ? session->db : 0;
912
827
  }
913
 
#else
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
918
 
                                   *description_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,
923
 
                    bool is_more);
924
 
  void print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
925
 
                    bool is_more);
926
 
#endif
927
828
 
928
829
  static void *operator new(size_t size)
929
830
  {
931
832
  }
932
833
 
933
834
  static void operator delete(void *ptr,
934
 
                              size_t size __attribute__((unused)))
 
835
                              size_t)
935
836
  {
936
 
    my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
 
837
    free((unsigned char*) ptr);
937
838
  }
938
839
 
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*) { }
942
843
 
943
 
#ifndef DRIZZLE_CLIENT
944
844
  bool write_header(IO_CACHE* file, ulong data_length);
945
845
  virtual bool write(IO_CACHE* file)
946
846
  {
948
848
            write_data_header(file) ||
949
849
            write_data_body(file));
950
850
  }
951
 
  virtual bool write_data_header(IO_CACHE* file __attribute__((unused)))
 
851
  virtual bool write_data_header(IO_CACHE*)
952
852
  { return 0; }
953
 
  virtual bool write_data_body(IO_CACHE* file __attribute__((unused)))
 
853
  virtual bool write_data_body(IO_CACHE*)
954
854
  { return 0; }
955
855
  inline time_t get_time()
956
856
  {
957
 
    THD *tmp_thd;
 
857
    Session *tmp_session;
958
858
    if (when)
959
859
      return when;
960
 
    if (thd)
961
 
      return thd->start_time;
962
 
    if ((tmp_thd= current_thd))
963
 
      return tmp_thd->start_time;
 
860
    if (session)
 
861
      return session->start_time;
 
862
    if ((tmp_session= current_session))
 
863
      return tmp_session->start_time;
964
864
    return my_time(0);
965
865
  }
966
 
#endif
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; }
976
875
  {
977
876
    if (temp_buf)
978
877
    {
979
 
      my_free(temp_buf, MYF(0));
 
878
      free(temp_buf);
980
879
      temp_buf = 0;
981
880
    }
982
881
  }
985
884
    is calculated during write()
986
885
  */
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);
1000
899
 
1001
900
  /* Return start of query time or current time */
1002
901
 
1003
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1004
902
public:
1005
903
 
1006
904
  /**
1077
975
    @retval 0     Event applied successfully
1078
976
    @retval errno Error code if event application failed
1079
977
  */
1080
 
  virtual int do_apply_event(Relay_log_info const *rli __attribute__((unused)))
 
978
  virtual int do_apply_event(Relay_log_info const *)
1081
979
  {
1082
980
    return 0;                /* Default implementation does nothing */
1083
981
  }
1139
1037
     non-zero. The caller shall decrease the counter by one.
1140
1038
   */
1141
1039
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
1142
 
#endif
1143
1040
};
1144
1041
 
1145
1042
 
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>
1441
1338
 
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).
1446
1343
 
1507
1404
    concerned) from here.
1508
1405
  */
1509
1406
 
1510
 
  uint catalog_len;                     // <= 255 char; 0 means uninited
 
1407
  uint32_t catalog_len;                 // <= 255 char; 0 means uninited
1511
1408
 
1512
1409
  /*
1513
1410
    We want to be able to store a variable number of N-bit status vars:
1533
1430
 
1534
1431
  /*
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;
1556
 
 
1557
 
#ifndef DRIZZLE_CLIENT
1558
 
 
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;
 
1453
 
 
1454
 
 
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 */
1566
 
#else
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);
1569
 
#endif
1570
1460
 
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()
1576
1466
  {
1577
1467
    if (data_buf)
1578
 
      my_free((uchar*) data_buf, MYF(0));
 
1468
      free((unsigned char*) data_buf);
1579
1469
  }
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; }
1585
 
#endif
1586
1474
  bool is_valid() const { return query != 0; }
1587
1475
 
1588
1476
  /*
1593
1481
  /* Writes derived event-specific part of post header. */
1594
1482
 
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);
1601
1488
  int do_apply_event(Relay_log_info const *rli,
1602
1489
                       const char *query_arg,
1603
1490
                       uint32_t q_len_arg);
1604
 
#endif /* HAVE_REPLICATION */
1605
1491
};
1606
1492
 
1607
1493
 
1608
 
#ifdef HAVE_REPLICATION
1609
 
 
1610
1494
/**
1611
1495
  @class Slave_log_event
1612
1496
 
1655
1539
  </tr>
1656
1540
  </table>
1657
1541
*/
 
1542
 
1658
1543
class Slave_log_event: public Log_event
1659
1544
{
1660
1545
protected:
1661
1546
  char* mem_pool;
1662
 
  void init_from_mem_pool(int data_size);
 
1547
  void init_from_mem_pool();
1663
1548
public:
1664
 
  my_off_t master_pos;
1665
 
  char* master_host;
1666
 
  char* master_log;
1667
 
  int master_host_len;
1668
 
  int master_log_len;
 
1549
  off_t master_pos;
 
1550
  std::string master_host;
 
1551
  std::string master_log;
1669
1552
  uint16_t master_port;
1670
1553
 
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);
1674
 
#else
1675
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1676
 
#endif
1677
1556
 
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);
1685
 
#endif
1686
1563
 
1687
1564
private:
1688
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
1689
1565
  virtual int do_apply_event(Relay_log_info const* rli);
1690
 
#endif
1691
1566
};
1692
1567
 
1693
 
#endif /* HAVE_REPLICATION */
1694
 
 
1695
1568
 
1696
1569
/**
1697
1570
  @class Load_log_event
1895
1768
class Load_log_event: public Log_event
1896
1769
{
1897
1770
private:
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);
1901
1774
protected:
1916
1789
  uint32_t fname_len;
1917
1790
  uint32_t num_fields;
1918
1791
  const char* fields;
1919
 
  const uchar* field_lens;
 
1792
  const unsigned char* field_lens;
1920
1793
  uint32_t field_block_len;
1921
1794
 
1922
1795
  const char* table_name;
1927
1800
  bool local_fname;
1928
1801
 
1929
1802
  /* fname doesn't point to memory inside Log_event::temp_buf  */
1930
 
  void set_fname_outside_temp_buf(const char *afname, uint alen)
 
1803
  void set_fname_outside_temp_buf(const char *afname, uint32_t alen)
1931
1804
  {
1932
1805
    fname= afname;
1933
1806
    fname_len= alen;
1939
1812
    return local_fname;
1940
1813
  }
1941
1814
 
1942
 
#ifndef DRIZZLE_CLIENT
1943
1815
  String field_lens_buf;
1944
1816
  String fields_buf;
1945
1817
 
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 */
1956
 
#else
1957
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
1958
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool commented);
1959
 
#endif
1960
1826
 
1961
1827
  /*
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).
1966
1832
  */
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()
1970
1836
  {}
1972
1838
  {
1973
1839
    return sql_ex.new_format() ? NEW_LOAD_EVENT: LOAD_EVENT;
1974
1840
  }
1975
 
#ifndef DRIZZLE_CLIENT
1976
1841
  bool write_data_header(IO_CACHE* file);
1977
1842
  bool write_data_body(IO_CACHE* file);
1978
 
#endif
1979
1843
  bool is_valid() const { return table_name != 0; }
1980
1844
  int get_data_size()
1981
1845
  {
1985
1849
  }
1986
1850
 
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)
1990
1853
  {
1991
 
    return do_apply_event(thd->slave_net,rli,0);
 
1854
    return do_apply_event(session->slave_net,rli,0);
1992
1855
  }
1993
1856
 
1994
1857
  int do_apply_event(NET *net, Relay_log_info const *rli,
1995
1858
                     bool use_rli_only_for_errors);
1996
 
#endif
1997
1859
};
1998
1860
 
1999
1861
extern char server_version[SERVER_VERSION_LENGTH];
2053
1915
  */
2054
1916
  bool dont_set_created;
2055
1917
 
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 */
2061
 
#else
2062
 
  Start_log_event_v3() {}
2063
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2064
 
#endif
2065
1920
 
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);
2072
 
#endif
2073
1926
  bool is_valid() const { return 1; }
2074
1927
  int get_data_size()
2075
1928
  {
2078
1931
  virtual bool is_artificial_event() { return artificial_event; }
2079
1932
 
2080
1933
protected:
2081
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2082
1934
  virtual int do_apply_event(Relay_log_info const *rli);
2083
1935
  virtual enum_skip_reason do_shall_skip(Relay_log_info*)
2084
1936
  {
2091
1943
    else
2092
1944
      return Log_event::EVENT_SKIP_NOT;
2093
1945
  }
2094
 
#endif
2095
1946
};
2096
1947
 
2097
1948
 
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;
2123
1974
 
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()
2129
1980
  {
2130
 
    my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR));
 
1981
    free((unsigned char*)post_header_len);
2131
1982
  }
2132
1983
  Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
2133
 
#ifndef DRIZZLE_CLIENT
2134
1984
  bool write(IO_CACHE* file);
2135
 
#endif
2136
1985
  bool is_valid() const
2137
1986
  {
2138
1987
    return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
2152
2001
  void calc_server_version_split();
2153
2002
 
2154
2003
protected:
2155
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2156
2004
  virtual int do_apply_event(Relay_log_info const *rli);
2157
2005
  virtual int do_update_pos(Relay_log_info *rli);
2158
2006
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2159
 
#endif
2160
2007
};
2161
2008
 
2162
2009
 
2201
2048
{
2202
2049
public:
2203
2050
  uint64_t val;
2204
 
  uchar type;
 
2051
  unsigned char type;
2205
2052
 
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)
2209
2055
  {}
2210
 
#ifdef HAVE_REPLICATION
2211
2056
  void pack_info(Protocol* protocol);
2212
 
#endif /* HAVE_REPLICATION */
2213
 
#else
2214
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2215
 
#endif
2216
2057
 
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);
2225
 
#endif
2226
2065
  bool is_valid() const { return 1; }
2227
2066
 
2228
2067
private:
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);
2233
 
#endif
2234
2071
};
2235
2072
 
2236
2073
 
2278
2115
  uint64_t seed1;
2279
2116
  uint64_t seed2;
2280
2117
 
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)
2284
2120
  {}
2285
 
#ifdef HAVE_REPLICATION
2286
2121
  void pack_info(Protocol* protocol);
2287
 
#endif /* HAVE_REPLICATION */
2288
 
#else
2289
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2290
 
#endif
2291
2122
 
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);
2299
 
#endif
2300
2129
  bool is_valid() const { return 1; }
2301
2130
 
2302
2131
private:
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);
2307
 
#endif
2308
2135
};
2309
2136
 
2310
2137
/**
2315
2142
 
2316
2143
  @section Xid_log_event_binary_format Binary Format  
2317
2144
*/
2318
 
#ifdef DRIZZLE_CLIENT
2319
 
typedef uint64_t my_xid; // this line is the same as in handler.h
2320
 
#endif
2321
 
 
2322
2145
class Xid_log_event: public Log_event
2323
2146
{
2324
2147
 public:
2325
2148
   my_xid xid;
2326
2149
 
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 */
2332
 
#else
2333
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2334
 
#endif
2335
2152
 
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);
2343
 
#endif
2344
2159
  bool is_valid() const { return 1; }
2345
2160
 
2346
2161
private:
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);
2350
 
#endif
2351
2164
};
2352
2165
 
2353
2166
/**
2363
2176
{
2364
2177
public:
2365
2178
  char *name;
2366
 
  uint name_len;
 
2179
  uint32_t name_len;
2367
2180
  char *val;
2368
2181
  ulong val_len;
2369
2182
  Item_result type;
2370
 
  uint charset_number;
 
2183
  uint32_t charset_number;
2371
2184
  bool is_null;
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);
2381
 
#else
2382
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2383
 
#endif
2384
2193
 
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);
2391
 
#endif
2392
2199
  bool is_valid() const { return 1; }
2393
2200
 
2394
2201
private:
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);
2399
 
#endif
2400
2205
};
2401
2206
 
2402
2207
 
2411
2216
class Stop_log_event: public Log_event
2412
2217
{
2413
2218
public:
2414
 
#ifndef DRIZZLE_CLIENT
2415
2219
  Stop_log_event() :Log_event()
2416
2220
  {}
2417
 
#else
2418
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2419
 
#endif
2420
2221
 
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; }
2428
2229
 
2429
2230
private:
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 *)
2433
2233
  {
2434
2234
    /*
2435
2235
      Events from ourself should be skipped, but they should not
2440
2240
    else
2441
2241
      return Log_event::EVENT_SKIP_NOT;
2442
2242
  }
2443
 
#endif
2444
2243
};
2445
2244
 
2446
2245
/**
2500
2299
  };
2501
2300
  const char* new_log_ident;
2502
2301
  uint64_t pos;
2503
 
  uint ident_len;
2504
 
  uint flags;
2505
 
#ifndef DRIZZLE_CLIENT
 
2302
  uint32_t ident_len;
 
2303
  uint32_t flags;
2506
2304
  Rotate_log_event(const char* new_log_ident_arg,
2507
 
                   uint ident_len_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 */
2512
 
#else
2513
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2514
 
#endif
2515
2308
 
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()
2519
2312
  {
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);
2522
2315
  }
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);
2528
 
#endif
2529
2320
 
2530
2321
private:
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);
2534
 
#endif
2535
2324
};
2536
2325
 
2537
2326
 
2553
2342
  */
2554
2343
  bool fake_base;
2555
2344
public:
2556
 
  uchar* block;
 
2345
  unsigned char* block;
2557
2346
  const char *event_buf;
2558
 
  uint block_len;
2559
 
  uint file_id;
 
2347
  uint32_t block_len;
 
2348
  uint32_t file_id;
2560
2349
  bool inited_from_old;
2561
2350
 
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 */
2572
 
#else
2573
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2574
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2575
 
             bool enable_local);
2576
 
#endif
2577
2358
 
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()
2581
2362
  {
2582
 
    my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR));
 
2363
    free((char*) event_buf);
2583
2364
  }
2584
2365
 
2585
2366
  Log_event_type get_type_code()
2593
2374
            4 + 1 + block_len);
2594
2375
  }
2595
2376
  bool is_valid() const { return inited_from_old || block != 0; }
2596
 
#ifndef DRIZZLE_CLIENT
2597
2377
  bool write_data_header(IO_CACHE* file);
2598
2378
  bool write_data_body(IO_CACHE* file);
2599
2379
  /*
2601
2381
    write it as Load event - used on the slave
2602
2382
  */
2603
2383
  bool write_base(IO_CACHE* file);
2604
 
#endif
2605
2384
 
2606
2385
private:
2607
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2608
2386
  virtual int do_apply_event(Relay_log_info const *rli);
2609
 
#endif
2610
2387
};
2611
2388
 
2612
2389
 
2619
2396
class Append_block_log_event: public Log_event
2620
2397
{
2621
2398
public:
2622
 
  uchar* block;
2623
 
  uint block_len;
2624
 
  uint file_id;
 
2399
  unsigned char* block;
 
2400
  uint32_t block_len;
 
2401
  uint32_t file_id;
2625
2402
  /*
2626
2403
    'db' is filled when the event is created in mysql_load() (the
2627
2404
    event needs to have a 'db' member to be well filtered by
2635
2412
  */
2636
2413
  const char* db;
2637
2414
 
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 */
2645
 
#else
2646
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2647
 
#endif
2648
2419
 
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; }
2659
 
#endif
2660
2429
 
2661
2430
private:
2662
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2663
2431
  virtual int do_apply_event(Relay_log_info const *rli);
2664
 
#endif
2665
2432
};
2666
2433
 
2667
2434
 
2674
2441
class Delete_file_log_event: public Log_event
2675
2442
{
2676
2443
public:
2677
 
  uint file_id;
 
2444
  uint32_t file_id;
2678
2445
  const char* db; /* see comment in Append_block_log_event */
2679
2446
 
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 */
2685
 
#else
2686
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2687
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
2688
 
             bool enable_local);
2689
 
#endif
2690
2449
 
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; }
2700
 
#endif
2701
2458
 
2702
2459
private:
2703
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2704
2460
  virtual int do_apply_event(Relay_log_info const *rli);
2705
 
#endif
2706
2461
};
2707
2462
 
2708
2463
 
2715
2470
class Execute_load_log_event: public Log_event
2716
2471
{
2717
2472
public:
2718
 
  uint file_id;
 
2473
  uint32_t file_id;
2719
2474
  const char* db; /* see comment in Append_block_log_event */
2720
2475
 
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 */
2726
 
#else
2727
 
  void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
2728
 
#endif
2729
2478
 
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; }
2740
 
#endif
2741
2488
 
2742
2489
private:
2743
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2744
2490
  virtual int do_apply_event(Relay_log_info const *rli);
2745
 
#endif
2746
2491
};
2747
2492
 
2748
2493
 
2758
2503
class Begin_load_query_log_event: public Append_block_log_event
2759
2504
{
2760
2505
public:
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 */
2769
 
#endif
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; }
2775
2516
private:
2776
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2777
2517
  virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
2778
 
#endif
2779
2518
};
2780
2519
 
2781
2520
 
2797
2536
class Execute_load_query_log_event: public Query_log_event
2798
2537
{
2799
2538
public:
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
2804
2543
  /*
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
2809
2548
  */
2810
2549
  enum_load_dup_handling dup_handling;
2811
2550
 
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,
2818
 
                               THD::killed_state
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 */
2823
 
#else
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);
2828
 
#endif
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; }
2836
2566
 
2837
2567
  ulong get_post_header_size_for_derived();
2838
 
#ifndef DRIZZLE_CLIENT
2839
2568
  bool write_post_header_for_derived(IO_CACHE* file);
2840
 
#endif
2841
2569
 
2842
2570
private:
2843
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
2844
2571
  virtual int do_apply_event(Relay_log_info const *rli);
2845
 
#endif
2846
 
};
2847
 
 
2848
 
 
2849
 
#ifdef DRIZZLE_CLIENT
2850
 
/**
2851
 
  @class Unknown_log_event
2852
 
 
2853
 
  @section Unknown_log_event_binary_format Binary Format
2854
 
*/
2855
 
class Unknown_log_event: public Log_event
2856
 
{
2857
 
public:
2858
 
  /*
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).
2862
 
  */
2863
 
  Unknown_log_event(const char* buf,
2864
 
                    const Format_description_log_event *description_event):
2865
 
    Log_event(buf, description_event)
2866
 
  {}
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; }
2871
 
};
2872
 
#endif
2873
 
char *str_to_hex(char *to, const char *from, uint len);
 
2572
};
 
2573
 
 
2574
 
 
2575
char *str_to_hex(char *to, const char *from, uint32_t len);
2874
2576
 
2875
2577
/**
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; }
3165
2867
 
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);
3169
 
#endif
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);
3173
 
#endif
3174
2872
 
3175
2873
  ~Table_map_log_event();
3176
2874
 
3178
2876
  virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ }
3179
2877
 
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; }
3186
 
#endif
3187
 
 
3188
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3189
2883
  virtual void pack_info(Protocol *protocol);
3190
 
#endif
3191
 
 
3192
 
#ifdef DRIZZLE_CLIENT
3193
 
  virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3194
 
#endif
3195
 
 
3196
2884
 
3197
2885
private:
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);
3202
 
#endif
3203
2889
 
3204
 
#ifndef DRIZZLE_CLIENT
3205
2890
  Table         *m_table;
3206
 
#endif
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;
3212
 
  uchar         *m_coltype;
 
2896
  unsigned char         *m_coltype;
3213
2897
 
3214
 
  uchar         *m_memory;
 
2898
  unsigned char         *m_memory;
3215
2899
  ulong          m_table_id;
3216
2900
  flag_set       m_flags;
3217
2901
 
3218
2902
  size_t         m_data_size;
3219
2903
 
3220
 
  uchar          *m_field_metadata;        // buffer for field metadata
 
2904
  unsigned char          *m_field_metadata;        // buffer for field metadata
3221
2905
  /*
3222
2906
    The size of field metadata buffer set by calling save_field_metadata()
3223
2907
  */
3224
2908
  ulong          m_field_metadata_size;   
3225
 
  uchar         *m_null_bits;
3226
 
  uchar         *m_meta_memory;
 
2909
  unsigned char         *m_null_bits;
 
2910
  unsigned char         *m_meta_memory;
3227
2911
};
3228
2912
 
3229
2913
 
3270
2954
    /* Last event of a statement */
3271
2955
    STMT_END_F = (1U << 0),
3272
2956
 
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),
3275
2959
 
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),
3278
2962
 
3279
2963
    /** 
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; }
3299
2983
 
3300
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3301
2984
  virtual void pack_info(Protocol *protocol);
3302
 
#endif
3303
 
 
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;
3307
 
#endif
3308
 
 
3309
 
#ifndef DRIZZLE_CLIENT
3310
 
  int add_row_data(uchar *data, size_t length)
 
2985
 
 
2986
  int add_row_data(unsigned char *data, size_t length)
3311
2987
  {
3312
2988
    return do_add_row_data(data,length); 
3313
2989
  }
3314
 
#endif
3315
2990
 
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; }
3322
2997
 
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; }
3327
 
#endif
3328
3001
  /*
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;
3337
3010
  }
3338
3011
 
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 */
3340
3013
 
3341
3014
protected:
3342
3015
  /* 
3343
3016
     The constructors are protected since you're supposed to inherit
3344
3017
     this class, not create instances of this class.
3345
3018
  */
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);
3349
 
#endif
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);
3353
3024
 
3354
 
#ifdef DRIZZLE_CLIENT
3355
 
  void print_helper(FILE *, PRINT_EVENT_INFO *, char const *const name);
3356
 
#endif
3357
 
 
3358
 
#ifndef DRIZZLE_CLIENT
3359
 
  virtual int do_add_row_data(uchar *data, size_t length);
3360
 
#endif
3361
 
 
3362
 
#ifndef DRIZZLE_CLIENT
 
3025
  virtual int do_add_row_data(unsigned char *data, size_t length);
 
3026
 
3363
3027
  Table *m_table;               /* The table the rows belong to */
3364
 
#endif
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)];
3382
3045
 
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 */
3386
3049
 
3387
3050
  flag_set m_flags;             /* Flags for row-level events */
3388
3051
 
3389
3052
  /* helper functions */
3390
3053
 
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 */
3395
3057
 
3396
3058
  int find_row(const Relay_log_info *const);
3397
3059
  int write_row(const Relay_log_info *const, const bool);
3398
3060
 
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)
3402
 
  { 
3403
 
    assert(m_table);
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);
3410
 
    return result;
3411
 
  }
3412
 
#endif
 
3063
                         MY_BITMAP const *cols);
3413
3064
 
3414
3065
private:
3415
3066
 
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);
3468
3118
      
3469
3119
  */
3470
3120
  virtual int do_exec_row(const Relay_log_info *const rli) = 0;
3471
 
#endif /* !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION) */
3472
3121
 
3473
3122
  friend class Old_rows_log_event;
3474
3123
};
3487
3136
public:
3488
3137
  enum 
3489
3138
  {
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
3492
3141
  };
3493
3142
 
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);
3497
 
#endif
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);
3501
 
#endif
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)
3508
3151
  {
3509
 
    return thd->binlog_write_row(table, is_transactional, after_record);
 
3152
    return session->binlog_write_row(table, is_transactional, after_record);
3510
3153
  }
3511
 
#endif
3512
3154
 
3513
3155
private:
3514
3156
  virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3515
3157
 
3516
 
#ifdef DRIZZLE_CLIENT
3517
 
  void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3518
 
#endif
3519
 
 
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);
3524
 
#endif
3525
3161
};
3526
3162
 
3527
3163
 
3542
3178
public:
3543
3179
  enum 
3544
3180
  {
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
3547
3183
  };
3548
3184
 
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);
3552
3187
 
3553
3188
  void init(MY_BITMAP const *cols);
3554
 
#endif
3555
3189
 
3556
3190
  virtual ~Update_rows_log_event();
3557
3191
 
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);
3561
 
#endif
3562
3194
 
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)
3568
3199
  {
3569
 
    return thd->binlog_update_row(table, is_transactional,
 
3200
    return session->binlog_update_row(table, is_transactional,
3570
3201
                                  before_record, after_record);
3571
3202
  }
3572
 
#endif
3573
3203
 
3574
3204
  virtual bool is_valid() const
3575
3205
  {
3579
3209
protected:
3580
3210
  virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3581
3211
 
3582
 
#ifdef DRIZZLE_CLIENT
3583
 
  void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3584
 
#endif
3585
 
 
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) */
3591
3215
};
3592
3216
 
3593
3217
/**
3615
3239
public:
3616
3240
  enum 
3617
3241
  {
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
3620
3244
  };
3621
3245
 
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);
3625
 
#endif
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);
3629
 
#endif
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 *)
3636
3254
  {
3637
 
    return thd->binlog_delete_row(table, is_transactional, before_record);
 
3255
    return session->binlog_delete_row(table, is_transactional, before_record);
3638
3256
  }
3639
 
#endif
3640
3257
  
3641
3258
protected:
3642
3259
  virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; }
3643
3260
 
3644
 
#ifdef DRIZZLE_CLIENT
3645
 
  void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3646
 
#endif
3647
 
 
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);
3652
 
#endif
3653
3264
};
3654
3265
 
3655
3266
 
3691
3302
*/
3692
3303
class Incident_log_event : public Log_event {
3693
3304
public:
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)
3697
3307
  {
3698
3308
    m_message.str= NULL;                    /* Just as a precaution */
3699
3309
    m_message.length= 0;
3700
3310
    return;
3701
3311
  }
3702
3312
 
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)
3705
3315
  {
3706
3316
    m_message= msg;
3707
3317
    return;
3708
3318
  }
3709
 
#endif
3710
3319
 
3711
 
#ifndef DRIZZLE_CLIENT
3712
3320
  void pack_info(Protocol*);
3713
 
#endif
3714
3321
 
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);
3717
3324
 
3718
3325
  virtual ~Incident_log_event();
3719
3326
 
3720
 
#ifdef DRIZZLE_CLIENT
3721
 
  virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info);
3722
 
#endif
3723
 
 
3724
 
#if !defined(DRIZZLE_CLIENT) && defined(HAVE_REPLICATION)
3725
3327
  virtual int do_apply_event(Relay_log_info const *rli);
3726
 
#endif
3727
3328
 
3728
3329
  virtual bool write_data_header(IO_CACHE *file);
3729
3330
  virtual bool write_data_body(IO_CACHE *file);
3753
3354
    reinit_io_cache(cache, WRITE_CACHE, 0, false, true);
3754
3355
}
3755
3356
 
3756
 
#ifndef DRIZZLE_CLIENT
3757
3357
/*****************************************************************************
3758
3358
 
3759
3359
  Heartbeat Log Event class
3772
3372
class Heartbeat_log_event: public Log_event
3773
3373
{
3774
3374
public:
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);
3782
3382
    }
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; }
3785
3385
  
3786
3386
private:
3787
3387
  const char* log_ident;
3788
 
  uint ident_len;
 
3388
  uint32_t ident_len;
3789
3389
};
3790
 
#endif
3791
3390
 
3792
3391
/**
3793
3392
  @} (end of group Replication)
3794
3393
*/
3795
3394
 
3796
 
#endif /* _log_event_h */
 
3395
#endif /* DRIZZLED_LOG_EVENT_H */