summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2016-10-20 18:00:59 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2016-10-20 18:00:59 +0200
commitc06bc668166ed658e6c68a57d9a6ee42b14189e8 (patch)
treead9b174e391f7b668a9788cceaa9227467c67b83 /sql/log_event.h
parente1c502879fea4bc95c493e429c295ba8c95e5483 (diff)
downloadmariadb-git-c06bc668166ed658e6c68a57d9a6ee42b14189e8.tar.gz
MDEV-11065: Compressed binary log
Minor review comments/changes: - A bunch of style-fixes. - Change macros to static inline functions. - Update check_event_type() with compressed event types. - Small .result file update.
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h60
1 files changed, 51 insertions, 9 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 59e4dcd8527..7ac21e379bb 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -694,6 +694,11 @@ enum Log_event_type
/*
Compressed binlog event.
+
+ Note that the order between WRITE/UPDATE/DELETE events is significant;
+ this is so that we can convert from the compressed to the uncompressed
+ event type with (type-WRITE_ROWS_COMPRESSED_EVENT + WRITE_ROWS_EVENT)
+ and similar for _V1.
*/
QUERY_COMPRESSED_EVENT = 165,
WRITE_ROWS_COMPRESSED_EVENT_V1 = 166,
@@ -708,15 +713,52 @@ enum Log_event_type
ENUM_END_EVENT /* end marker */
};
-#define LOG_EVENT_IS_QUERY(type) (type == QUERY_EVENT || type == QUERY_COMPRESSED_EVENT)
-#define LOG_EVENT_IS_WRITE_ROW(type) (type == WRITE_ROWS_EVENT || type == WRITE_ROWS_EVENT_V1 || type == WRITE_ROWS_COMPRESSED_EVENT || type == WRITE_ROWS_COMPRESSED_EVENT_V1)
-#define LOG_EVENT_IS_UPDATE_ROW(type) (type == UPDATE_ROWS_EVENT || type == UPDATE_ROWS_EVENT_V1 || type == UPDATE_ROWS_COMPRESSED_EVENT || type == UPDATE_ROWS_COMPRESSED_EVENT_V1)
-#define LOG_EVENT_IS_DELETE_ROW(type) (type == DELETE_ROWS_EVENT || type == DELETE_ROWS_EVENT_V1 || type == DELETE_ROWS_COMPRESSED_EVENT || type == DELETE_ROWS_COMPRESSED_EVENT_V1)
-#define LOG_EVENT_IS_ROW_COMPRESSED(type) (type == WRITE_ROWS_COMPRESSED_EVENT || type == WRITE_ROWS_COMPRESSED_EVENT_V1 ||\
- type == UPDATE_ROWS_COMPRESSED_EVENT || type == UPDATE_ROWS_COMPRESSED_EVENT_V1 ||\
- type == DELETE_ROWS_COMPRESSED_EVENT || type == DELETE_ROWS_COMPRESSED_EVENT_V1)
-#define LOG_EVENT_IS_ROW_V2(type) (type >= WRITE_ROWS_EVENT && type <= DELETE_ROWS_EVENT || \
- type >= WRITE_ROWS_COMPRESSED_EVENT && type <= DELETE_ROWS_COMPRESSED_EVENT )
+static inline bool LOG_EVENT_IS_QUERY(enum Log_event_type type)
+{
+ return type == QUERY_EVENT || type == QUERY_COMPRESSED_EVENT;
+}
+
+
+static inline bool LOG_EVENT_IS_WRITE_ROW(enum Log_event_type type)
+{
+ return type == WRITE_ROWS_EVENT || type == WRITE_ROWS_EVENT_V1 ||
+ type == WRITE_ROWS_COMPRESSED_EVENT ||
+ type == WRITE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+
+static inline bool LOG_EVENT_IS_UPDATE_ROW(enum Log_event_type type)
+{
+ return type == UPDATE_ROWS_EVENT || type == UPDATE_ROWS_EVENT_V1 ||
+ type == UPDATE_ROWS_COMPRESSED_EVENT ||
+ type == UPDATE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+
+static inline bool LOG_EVENT_IS_DELETE_ROW(enum Log_event_type type)
+{
+ return type == DELETE_ROWS_EVENT || type == DELETE_ROWS_EVENT_V1 ||
+ type == DELETE_ROWS_COMPRESSED_EVENT ||
+ type == DELETE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+
+static inline bool LOG_EVENT_IS_ROW_COMPRESSED(enum Log_event_type type)
+{
+ return type == WRITE_ROWS_COMPRESSED_EVENT ||
+ type == WRITE_ROWS_COMPRESSED_EVENT_V1 ||
+ type == UPDATE_ROWS_COMPRESSED_EVENT ||
+ type == UPDATE_ROWS_COMPRESSED_EVENT_V1 ||
+ type == DELETE_ROWS_COMPRESSED_EVENT ||
+ type == DELETE_ROWS_COMPRESSED_EVENT_V1;
+}
+
+
+static inline bool LOG_EVENT_IS_ROW_V2(enum Log_event_type type)
+{
+ return (type >= WRITE_ROWS_EVENT && type <= DELETE_ROWS_EVENT) ||
+ (type >= WRITE_ROWS_COMPRESSED_EVENT && type <= DELETE_ROWS_COMPRESSED_EVENT);
+}
/*