mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Cleanup: make slave_exec_mode of its enum type and pack Log_event better
Pack these fields together: event_owns_temp_buf cache_type slave_exec_mode checksum_alg Make them bitfields to fit a single 2-byte hole. This saves 24 bytes per event. SLAVE_EXEC_MODE_LAST_BIT is rewritten as > SLAVE_EXEC_MODE_LAST= SLAVE_EXEC_MODE_IDEMPOTENT to avoid a false-positive -Wbitfield-enum-conversion warning: Bit-field 'slave_exec_mode' is not wide enough to store all enumerators of 'enum_slave_exec_mode'.
This commit is contained in:
committed by
Sergei Golubchik
parent
982b689566
commit
c373e6c3d6
@@ -54,6 +54,8 @@
|
|||||||
#include "rpl_record.h"
|
#include "rpl_record.h"
|
||||||
#include "rpl_reporting.h"
|
#include "rpl_reporting.h"
|
||||||
#include "sql_class.h" /* THD */
|
#include "sql_class.h" /* THD */
|
||||||
|
#else
|
||||||
|
typedef ulong enum_slave_exec_mode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "rpl_gtid.h"
|
#include "rpl_gtid.h"
|
||||||
@@ -1249,12 +1251,6 @@ public:
|
|||||||
event's type, and its content is distributed in the event-specific fields.
|
event's type, and its content is distributed in the event-specific fields.
|
||||||
*/
|
*/
|
||||||
uchar *temp_buf;
|
uchar *temp_buf;
|
||||||
|
|
||||||
/*
|
|
||||||
TRUE <=> this event 'owns' temp_buf and should call my_free() when done
|
|
||||||
with it
|
|
||||||
*/
|
|
||||||
bool event_owns_temp_buf;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Timestamp on the master(for debugging and replication of
|
Timestamp on the master(for debugging and replication of
|
||||||
@@ -1284,13 +1280,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
uint16 flags;
|
uint16 flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
true <=> this event 'owns' temp_buf and should call my_free() when done
|
||||||
|
with it
|
||||||
|
*/
|
||||||
|
bool event_owns_temp_buf;
|
||||||
|
|
||||||
enum_event_cache_type cache_type;
|
enum_event_cache_type cache_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A storage to cache the global system variable's value.
|
A storage to cache the global system variable's value.
|
||||||
Handling of a separate event will be governed its member.
|
Handling of a separate event will be governed its member.
|
||||||
*/
|
*/
|
||||||
ulong slave_exec_mode;
|
enum_slave_exec_mode slave_exec_mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The value is set by caller of FD constructor and
|
||||||
|
Log_event::write_header() for the rest.
|
||||||
|
In the FD case it's propagated into the last byte
|
||||||
|
of post_header_len[] at FD::write().
|
||||||
|
On the slave side the value is assigned from post_header_len[last]
|
||||||
|
of the last seen FD event.
|
||||||
|
*/
|
||||||
|
enum enum_binlog_checksum_alg checksum_alg;
|
||||||
|
|
||||||
Log_event_writer *writer;
|
Log_event_writer *writer;
|
||||||
|
|
||||||
@@ -1436,16 +1448,6 @@ public:
|
|||||||
return read_log_event(file, packet, fdle, checksum_alg, get_max_packet());
|
return read_log_event(file, packet, fdle, checksum_alg, get_max_packet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
The value is set by caller of FD constructor and
|
|
||||||
Log_event::write_header() for the rest.
|
|
||||||
In the FD case it's propagated into the last byte
|
|
||||||
of post_header_len[] at FD::write().
|
|
||||||
On the slave side the value is assigned from post_header_len[last]
|
|
||||||
of the last seen FD event.
|
|
||||||
*/
|
|
||||||
enum enum_binlog_checksum_alg checksum_alg;
|
|
||||||
|
|
||||||
static void *operator new(size_t size)
|
static void *operator new(size_t size)
|
||||||
{
|
{
|
||||||
extern PSI_memory_key key_memory_log_event;
|
extern PSI_memory_key key_memory_log_event;
|
||||||
|
@@ -544,8 +544,8 @@ int append_query_string(CHARSET_INFO *csinfo, String *to,
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
|
Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
|
||||||
:log_pos(0), temp_buf(0), exec_time(0), thd(thd_arg),
|
:log_pos(0), temp_buf(0), exec_time(0),
|
||||||
checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
|
checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF), thd(thd_arg)
|
||||||
{
|
{
|
||||||
server_id= thd->variables.server_id;
|
server_id= thd->variables.server_id;
|
||||||
when= thd->start_time;
|
when= thd->start_time;
|
||||||
@@ -569,7 +569,7 @@ Log_event::Log_event(THD* thd_arg, uint16 flags_arg, bool using_trans)
|
|||||||
|
|
||||||
Log_event::Log_event()
|
Log_event::Log_event()
|
||||||
:temp_buf(0), exec_time(0), flags(0), cache_type(EVENT_INVALID_CACHE),
|
:temp_buf(0), exec_time(0), flags(0), cache_type(EVENT_INVALID_CACHE),
|
||||||
thd(0), checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF)
|
checksum_alg(BINLOG_CHECKSUM_ALG_UNDEF), thd(0)
|
||||||
{
|
{
|
||||||
server_id= global_system_variables.server_id;
|
server_id= global_system_variables.server_id;
|
||||||
/*
|
/*
|
||||||
@@ -5099,7 +5099,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
|
|||||||
bitmap_set_bit(table->write_set, table->s->vers.end_fieldno);
|
bitmap_set_bit(table->write_set, table->s->vers.end_fieldno);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->slave_exec_mode= slave_exec_mode_options; // fix the mode
|
this->slave_exec_mode= (enum_slave_exec_mode)slave_exec_mode_options;
|
||||||
|
|
||||||
// Do event specific preparations
|
// Do event specific preparations
|
||||||
error= do_before_row_operations(rgi);
|
error= do_before_row_operations(rgi);
|
||||||
|
Reference in New Issue
Block a user