-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support async replication #88
Conversation
internal/config/config.go
Outdated
@@ -88,6 +88,8 @@ type Config struct { | |||
ReplicationChannel string `config:"replication_channel" yaml:"replication_channel"` | |||
ExternalReplicationChannel string `config:"external_replication_channel" yaml:"external_replication_channel"` | |||
ExternalReplicationType util.ExternalReplicationType `config:"external_replication_type" yaml:"external_replication_type"` | |||
ASync bool `config:"a_sync" yaml:"a_sync"` | |||
ASyncAllowedLag int64 `config:"a_sync_allowed_lag" yaml:"a_sync_allowed_lag"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a_sync
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New setting which will allow client to set server in async mode. In async mode in case of failover mysync will promote slave to new master even if it has replication delay, but only if delay less then ASyncAllowedLag
internal/mysql/queries.go
Outdated
@@ -123,4 +125,6 @@ var DefaultQueries = map[string]string{ | |||
querySetInnodbFlushLogAtTrxCommit: `SET GLOBAL innodb_flush_log_at_trx_commit = :level`, | |||
queryGetReplicationSettings: `SELECT @@innodb_flush_log_at_trx_commit as InnodbFlushLogAtTrxCommit, @@sync_binlog as SyncBinlog`, | |||
querySetSyncBinlog: `SET GLOBAL sync_binlog = :sync_binlog`, | |||
queryGetMdbReplMonTs: `SELECT UNIX_TIMESTAMP(ts) AS ts FROM mysql.mdb_repl_mon`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks very specific to your installation. Probably, we should use data from replication_applier_status_by_worker
table OR move mdb_repl_mon
to mysync.
internal/app/app.go
Outdated
@@ -700,6 +700,11 @@ func (app *App) stateManager() appState { | |||
app.logger.Errorf("failed to update active nodes in dcs: %v", err) | |||
} | |||
|
|||
err = app.updateMdbReplMonTS(master) | |||
if err != nil { | |||
app.logger.Errorf("failed to update mdb_repl_mon timestamp: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should explicitly mention "in dcs"
internal/app/app.go
Outdated
return false, nil | ||
} | ||
if app.config.ASync && switchover.Cause == CauseAuto { | ||
app.logger.Infof("async mode is active and this is auto switch so we checking new master delay") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we should move this to async file?
No description provided.