summaryrefslogtreecommitdiff
path: root/sql/semisync_slave.h
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2017-11-22 17:10:34 +0200
committerMonty <monty@mariadb.org>2017-12-18 13:43:37 +0200
commite972125f11d8f37bc263b113e85ed064257a92ee (patch)
treef705082eec5bdb4f274b3e7ceee4714b86c96075 /sql/semisync_slave.h
parentabceaa75428f9b2d64ce64629d010af9aa6eae1f (diff)
downloadmariadb-git-e972125f11d8f37bc263b113e85ed064257a92ee.tar.gz
MDEV-13073 This part merges the Ali semisync related changes
and specifically the ack receiving functionality. Semisync is turned to be static instead of plugin so its functions are invoked at the same points as RUN_HOOKS. The RUN_HOOKS and the observer interface remain to be removed by later patch. Todo: React on killed status by repl_semisync_master.wait_after_sync(). Currently Repl_semi_sync_master::commit_trx does not check the killed status. There were few bugfixes found that are present in mysql and its unclear whether/how they are covered. Those include: Bug#15985893: GTID SKIPPED EVENTS ON MASTER CAUSE SEMI SYNC TIME-OUTS Bug#17932935 CALLING IS_SEMI_SYNC_SLAVE() IN EACH FUNCTION CALL HAS BAD PERFORMANCE Bug#20574628: SEMI-SYNC REPLICATION PERFORMANCE DEGRADES WITH A HIGH NUMBER OF THREADS
Diffstat (limited to 'sql/semisync_slave.h')
-rw-r--r--sql/semisync_slave.h50
1 files changed, 30 insertions, 20 deletions
diff --git a/sql/semisync_slave.h b/sql/semisync_slave.h
index 6bc10b0d479..0df4445ee4a 100644
--- a/sql/semisync_slave.h
+++ b/sql/semisync_slave.h
@@ -19,6 +19,10 @@
#define SEMISYNC_SLAVE_H
#include "semisync.h"
+#include "my_global.h"
+#include "sql_priv.h"
+#include "rpl_mi.h"
+#include "mysql.h"
/**
The extension class for the slave of semi-synchronous replication
@@ -44,49 +48,54 @@ public:
return slave_enabled_;
}
void setSlaveEnabled(bool enabled) {
- run_hooks_enabled|= enabled;
slave_enabled_ = enabled;
}
+
+ bool isDelayMaster(){
+ return delay_master_;
+ }
+
+ void setDelayMaster(bool enabled) {
+ delay_master_ = enabled;
+ }
+
+ void setKillConnTimeout(unsigned int timeout) {
+ kill_conn_timeout_ = timeout;
+ }
/* A slave reads the semi-sync packet header and separate the metadata
* from the payload data.
- *
+ *
* Input:
* header - (IN) packet header pointer
* total_len - (IN) total packet length: metadata + payload
- * need_reply - (IN) whether the master is waiting for the reply
+ * semi_flags - (IN) store flags: SEMI_SYNC_SLAVE_DELAY_SYNC and SEMI_SYNC_NEED_ACK
* payload - (IN) payload: the replication event
* payload_len - (IN) payload length
*
* Return:
* 0: success; non-zero: error
*/
- int slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply,
+ int slaveReadSyncHeader(const char *header, unsigned long total_len, int *semi_flags,
const char **payload, unsigned long *payload_len);
/* A slave replies to the master indicating its replication process. It
* indicates that the slave has received all events before the specified
* binlog position.
- *
- * Input:
- * mysql - (IN) the mysql network connection
- * binlog_filename - (IN) the reply point's binlog file name
- * binlog_filepos - (IN) the reply point's binlog file offset
- *
- * Return:
- * 0: success; non-zero: error
*/
- int slaveReply(MYSQL *mysql, const char *binlog_filename,
- my_off_t binlog_filepos);
-
- int slaveStart(Binlog_relay_IO_param *param);
- int slaveStop(Binlog_relay_IO_param *param);
+ int slaveReply(Master_info* mi);
+ int slaveStart(Master_info *mi);
+ int slaveStop(Master_info *mi);
+ int requestTransmit(Master_info*);
+ void killConnection(MYSQL *mysql);
+ int resetSlave(Master_info *mi);
private:
/* True when initObject has been called */
bool init_done_;
bool slave_enabled_; /* semi-sycn is enabled on the slave */
- MYSQL *mysql_reply; /* connection to send reply */
+ bool delay_master_;
+ unsigned int kill_conn_timeout_;
};
@@ -96,7 +105,8 @@ extern my_bool rpl_semi_sync_slave_status;
extern ulong rpl_semi_sync_slave_trace_level;
extern ReplSemiSyncSlave repl_semisync_slave;
-int semi_sync_slave_init();
-void semi_sync_slave_deinit();
+extern char rpl_semi_sync_slave_delay_master;
+extern unsigned int rpl_semi_sync_slave_kill_conn_timeout;
+extern unsigned long long rpl_semi_sync_slave_send_ack;
#endif /* SEMISYNC_SLAVE_H */