summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorunknown <Li-Bing.Song@sun.com>2010-03-28 19:57:33 +0800
committerunknown <Li-Bing.Song@sun.com>2010-03-28 19:57:33 +0800
commit454c003a5c5a31a8d59ba4ab54d3b3a90a609752 (patch)
tree656156db7cdeef9ce027bbc4cd40c78d35b284f9 /sql/log_event.h
parent4775601012f81655643667d8635e46de120be7ae (diff)
downloadmariadb-git-454c003a5c5a31a8d59ba4ab54d3b3a90a609752.tar.gz
Bug #50407 mysqlbinlog --database=X produces bad output for SAVEPOINTs
When mysqlbinlog was given the --database=X flag, it always printed 'ROLLBACK TO', but the corresponding 'SAVEPOINT' statement was not printed. The replicated filter(replicated-do/ignore-db) and binlog filter (binlog-do/ignore-db) has the same problem. They are solved in this patch together. After this patch, We always check whether the query is 'SAVEPOINT' statement or not. Because this is a literal check, 'SAVEPOINT' and 'ROLLBACK TO' statements are also binlogged in uppercase with no any comments. The binlog before this patch can be handled correctly except one case that any comments are in front of the keywords. for example: /* bla bla */ SAVEPOINT a; /* bla bla */ ROLLBACK TO a;
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 30a68955fb3..9b7f000648d 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -1682,6 +1682,28 @@ public: /* !!! Public in this patch to allow old usage */
const char *query_arg,
uint32 q_len_arg);
#endif /* HAVE_REPLICATION */
+ /*
+ If true, the event always be applied by slave SQL thread or be printed by
+ mysqlbinlog
+ */
+ bool is_trans_keyword()
+ {
+ /*
+ Before the patch for bug#50407, The 'SAVEPOINT and ROLLBACK TO'
+ queries input by user was written into log events directly.
+ So the keywords can be written in both upper case and lower case
+ together, strncasecmp is used to check both cases. they also could be
+ binlogged with comments in the front of these keywords. for examples:
+ / * bla bla * / SAVEPOINT a;
+ / * bla bla * / ROLLBACK TO a;
+ but we don't handle these cases and after the patch, both quiries are
+ binlogged in upper case with no comments.
+ */
+ return !strncmp(query, "BEGIN", q_len) ||
+ !strncmp(query, "COMMIT", q_len) ||
+ !strncasecmp(query, "SAVEPOINT", 9) ||
+ !strncasecmp(query, "ROLLBACK", 8);
+ }
};