summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h33
1 files changed, 24 insertions, 9 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 29580589a34..35bddd14d3b 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -640,6 +640,13 @@ public:
const char **error,
const Format_description_log_event
*description_event);
+ virtual int get_event_len()
+ {
+ return (cached_event_len ? cached_event_len :
+ (cached_event_len = LOG_EVENT_HEADER_LEN + get_data_size()));
+ }
+ static Log_event* read_log_event(const char* buf, int event_len,
+ const char **error, bool old_format);
/* returns the human readable name of the event's type */
const char* get_type_str();
};
@@ -1247,18 +1254,18 @@ public:
class Rotate_log_event: public Log_event
{
public:
+ enum {
+ ZERO_LEN= 1, // if event should report 0 as its length
+ DUP_NAME= 2 // if constructor should dup the string argument
+ };
const char* new_log_ident;
ulonglong pos;
uint ident_len;
- bool alloced;
+ uint flags;
#ifndef MYSQL_CLIENT
Rotate_log_event(THD* thd_arg, const char* new_log_ident_arg,
- uint ident_len_arg = 0,
- ulonglong pos_arg = LOG_EVENT_OFFSET)
- :Log_event(), new_log_ident(new_log_ident_arg),
- pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
- (uint) strlen(new_log_ident_arg)), alloced(0)
- {}
+ uint ident_len_arg,
+ ulonglong pos_arg, uint flags);
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
@@ -1271,10 +1278,18 @@ public:
const Format_description_log_event* description_event);
~Rotate_log_event()
{
- if (alloced)
- my_free((gptr) new_log_ident, MYF(0));
+ if (flags & DUP_NAME)
+ my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
}
Log_event_type get_type_code() { return ROTATE_EVENT;}
+ virtual int get_event_len()
+ {
+ if (flags & ZERO_LEN)
+ return 0;
+ if (cached_event_len == 0)
+ cached_event_len= LOG_EVENT_HEADER_LEN + get_data_size();
+ return cached_event_len;
+ }
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
bool is_valid() const { return new_log_ident != 0; }
#ifndef MYSQL_CLIENT