summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2005-02-03 16:22:16 +0100
committerguilhem@mysql.com <>2005-02-03 16:22:16 +0100
commited1696f6b9d2ed32168ddaba4c2d9cd1529022a1 (patch)
tree7a4b93f6301c5bdc29371dda2344050ce305ba4c /sql/log_event.h
parentd8f0e8f04e1546292342e3409c4d44f524998c1c (diff)
downloadmariadb-git-ed1696f6b9d2ed32168ddaba4c2d9cd1529022a1.tar.gz
WL#1062 "log charset info into all Query_log_event":
we store 7 bytes (1 + 2*3) in every Query_log_event. In the future if users want binlog optimized for small size and less safe, we could add --binlog-no-charset (and binlog-no-sql-mode etc): charset info is something by design optional (even if for now we don't offer possibility to disable it): it's not a binlog format change. We try to reduce the number of get_charset() calls in the slave SQL thread to a minimum by caching the charset read from the previous event (which will often be equal to the one of the current event). We don't use SET ONE_SHOT for charset-aware repl (we still do for timezones, will be fixed later). No more errors if one changes the global value of charset vars on master or slave (as we log charset info in all Query_log_event). Not fixing Load_log_event as it will be rewritten soon by Dmitri. Testing how mysqlbinlog behaves in rpl_charset.test. mysqlbinlog needs to know where charset file is (to be able to convert a charset number found in binlog (e.g. in User_var_log_event) to a charset name); mysql-test-run needs to pass the correct value for this option to mysqlbinlog. Many result udpates (adding charset info into every event shifts log_pos in SHOW BINLOG EVENTS). Roughly the same job is to be done for timezones :)
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 64bb9d502e9..7f04582a32d 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -232,6 +232,7 @@ struct sql_ex_info
#define Q_SQL_MODE_CODE 1
#define Q_CATALOG_CODE 2
#define Q_AUTO_INCREMENT 3
+#define Q_CHARSET_CODE 4
/* Intvar event post-header */
@@ -401,11 +402,19 @@ typedef struct st_last_event_info
bool sql_mode_inited;
ulong sql_mode; /* must be same as THD.variables.sql_mode */
ulong auto_increment_increment, auto_increment_offset;
+ bool charset_inited;
+ char charset[6]; // 3 variables, each of them storable in 2 bytes
st_last_event_info()
- :flags2_inited(0), flags2(0), sql_mode_inited(0), sql_mode(0),
- auto_increment_increment(1),auto_increment_offset(1)
+ :flags2_inited(0), sql_mode_inited(0),
+ auto_increment_increment(1),auto_increment_offset(1), charset_inited(0)
{
- db[0]= 0; /* initially, the db is unknown */
+ /*
+ Currently we only use static LAST_EVENT_INFO objects, so zeroed at
+ program's startup, but these explicit bzero() is for the day someone
+ creates dynamic instances.
+ */
+ bzero(db, sizeof(db));
+ bzero(charset, sizeof(charset));
}
} LAST_EVENT_INFO;
#endif
@@ -634,7 +643,7 @@ public:
status_vars on disk is a sequence of pairs (code, value) where 'code' means
'sql_mode', 'affected' etc. Sometimes 'value' must be a short string, so
its first byte is its length. For now the order of status vars is:
- flags2 - sql_mode - catalog.
+ flags2 - sql_mode - catalog - autoinc - charset
We should add the same thing to Load_log_event, but in fact
LOAD DATA INFILE is going to be logged with a new type of event (logging of
the plain text query), so Load_log_event would be frozen, so no need. The
@@ -655,11 +664,13 @@ public:
*/
bool flags2_inited;
bool sql_mode_inited;
+ bool charset_inited;
uint32 flags2;
/* In connections sql_mode is 32 bits now but will be 64 bits soon */
ulong sql_mode;
ulong auto_increment_increment, auto_increment_offset;
+ char charset[6];
#ifndef MYSQL_CLIENT