diff --git a/go/db/generate_patches.go b/go/db/generate_patches.go
index ca66f2c8b..d2c857347 100644
--- a/go/db/generate_patches.go
+++ b/go/db/generate_patches.go
@@ -546,4 +546,34 @@ var generateSQLPatches = []string{
database_instance
ADD COLUMN region varchar(32) CHARACTER SET ascii NOT NULL AFTER data_center
`,
+ `
+ ALTER TABLE
+ database_instance
+ ADD COLUMN semi_sync_master_timeout INT UNSIGNED NOT NULL DEFAULT 0 AFTER semi_sync_master_enabled
+ `,
+ `
+ ALTER TABLE
+ database_instance
+ ADD COLUMN semi_sync_master_wait_for_slave_count INT UNSIGNED NOT NULL DEFAULT 0 AFTER semi_sync_master_timeout
+ `,
+ `
+ ALTER TABLE
+ database_instance
+ ADD COLUMN semi_sync_master_status TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER semi_sync_master_wait_for_slave_count
+ `,
+ `
+ ALTER TABLE
+ database_instance
+ ADD COLUMN semi_sync_replica_status TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER semi_sync_master_status
+ `,
+ `
+ ALTER TABLE
+ database_instance
+ ADD COLUMN semi_sync_master_clients INT UNSIGNED NOT NULL DEFAULT 0 AFTER semi_sync_master_status
+ `,
+ `
+ ALTER TABLE
+ database_instance
+ ADD COLUMN semi_sync_available TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER semi_sync_enforced
+ `,
}
diff --git a/go/inst/analysis.go b/go/inst/analysis.go
index 4ff18f82b..c9853dfdb 100644
--- a/go/inst/analysis.go
+++ b/go/inst/analysis.go
@@ -66,6 +66,8 @@ const (
ErrantGTIDStructureWarning = "ErrantGTIDStructureWarning"
NoFailoverSupportStructureWarning = "NoFailoverSupportStructureWarning"
NoWriteableMasterStructureWarning = "NoWriteableMasterStructureWarning"
+ NoValidSemiSyncReplicasStructureWarning = "NoValidSemiSyncReplicasStructureWarning"
+ NotEnoughValidSemiSyncReplicasStructureWarning = "NotEnoughValidSemiSyncReplicasStructureWarning"
)
type InstanceAnalysis struct {
@@ -140,6 +142,8 @@ type ReplicationAnalysis struct {
OracleGTIDImmediateTopology bool
MariaDBGTIDImmediateTopology bool
BinlogServerImmediateTopology bool
+ SemiSyncMasterEnabled bool
+ CountSemiSyncReplicasEnabled uint
CountLoggingReplicas uint
CountStatementBasedLoggingReplicas uint
CountMixedBasedLoggingReplicas uint
diff --git a/go/inst/analysis_dao.go b/go/inst/analysis_dao.go
index 1823b8926..d2921becc 100644
--- a/go/inst/analysis_dao.go
+++ b/go/inst/analysis_dao.go
@@ -151,6 +151,12 @@ func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints)
MIN(
master_instance.supports_oracle_gtid
) AS supports_oracle_gtid,
+ MIN(
+ master_instance.semi_sync_master_enabled
+ ) AS semi_sync_master_enabled,
+ MIN(
+ master_instance.semi_sync_master_wait_for_slave_count
+ ) AS semi_sync_master_wait_for_slave_count,
SUM(
replica_instance.is_co_master
) AS count_co_master_replicas,
@@ -166,6 +172,12 @@ func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints)
IFNULL(SUM(replica_instance.last_checked <= replica_instance.last_seen
AND replica_instance.binlog_server != 0),
0) AS count_valid_binlog_server_replicas,
+ SUM(
+ replica_instance.semi_sync_replica_enabled
+ ) AS count_semi_sync_replicas,
+ IFNULL(SUM(replica_instance.last_checked <= replica_instance.last_seen
+ AND replica_instance.semi_sync_replica_enabled != 0),
+ 0) AS count_valid_semi_sync_replicas,
MIN(
master_instance.mariadb_gtid
) AS is_mariadb_gtid,
@@ -295,6 +307,10 @@ func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints)
countValidBinlogServerSlaves := m.GetUint("count_valid_binlog_server_replicas")
a.BinlogServerImmediateTopology = countValidBinlogServerSlaves == a.CountValidReplicas && a.CountValidReplicas > 0
a.PseudoGTIDImmediateTopology = m.GetBool("is_pseudo_gtid")
+ a.SemiSyncMasterEnabled = m.GetBool("semi_sync_master_enabled")
+ a.CountSemiSyncReplicasEnabled = m.GetUint("count_semi_sync_replicas")
+ countValidSemiSyncReplicasEnabled := m.GetUint("count_valid_semi_sync_replicas")
+ semiSyncMasterWaitForReplicaCount := m.GetUint("semi_sync_master_wait_for_slave_count")
a.MinReplicaGTIDMode = m.GetString("min_replica_gtid_mode")
a.MaxReplicaGTIDMode = m.GetString("max_replica_gtid_mode")
@@ -501,6 +517,13 @@ func GetReplicationAnalysis(clusterName string, hints *ReplicationAnalysisHints)
a.StructureAnalysis = append(a.StructureAnalysis, NoWriteableMasterStructureWarning)
}
+ if a.IsMaster && a.SemiSyncMasterEnabled && countValidSemiSyncReplicasEnabled == 0 {
+ a.StructureAnalysis = append(a.StructureAnalysis, NoValidSemiSyncReplicasStructureWarning)
+ }
+ if a.IsMaster && a.SemiSyncMasterEnabled && countValidSemiSyncReplicasEnabled > 0 && countValidSemiSyncReplicasEnabled < semiSyncMasterWaitForReplicaCount {
+ a.StructureAnalysis = append(a.StructureAnalysis, NotEnoughValidSemiSyncReplicasStructureWarning)
+ }
+
}
appendAnalysis(&a)
diff --git a/go/inst/instance.go b/go/inst/instance.go
index f92443327..3d5487500 100644
--- a/go/inst/instance.go
+++ b/go/inst/instance.go
@@ -74,20 +74,26 @@ type Instance struct {
masterExecutedGtidSet string // Not exported
- SlaveLagSeconds sql.NullInt64
- SlaveHosts InstanceKeyMap
- ClusterName string
- SuggestedClusterAlias string
- DataCenter string
- Region string
- PhysicalEnvironment string
- ReplicationDepth uint
- IsCoMaster bool
- HasReplicationCredentials bool
- ReplicationCredentialsAvailable bool
- SemiSyncEnforced bool
- SemiSyncMasterEnabled bool
- SemiSyncReplicaEnabled bool
+ SlaveLagSeconds sql.NullInt64
+ SlaveHosts InstanceKeyMap
+ ClusterName string
+ SuggestedClusterAlias string
+ DataCenter string
+ Region string
+ PhysicalEnvironment string
+ ReplicationDepth uint
+ IsCoMaster bool
+ HasReplicationCredentials bool
+ ReplicationCredentialsAvailable bool
+ SemiSyncAvailable bool // when both semi sync plugins (master & replica) are loaded
+ SemiSyncEnforced bool
+ SemiSyncMasterEnabled bool
+ SemiSyncReplicaEnabled bool
+ SemiSyncMasterTimeout uint
+ SemiSyncMasterWaitForReplicaCount uint
+ SemiSyncMasterStatus bool
+ SemiSyncMasterClients uint
+ SemiSyncReplicaStatus bool
LastSeenTimestamp string
IsLastCheckValid bool
diff --git a/go/inst/instance_dao.go b/go/inst/instance_dao.go
index 14cee64ba..7fa8af5af 100644
--- a/go/inst/instance_dao.go
+++ b/go/inst/instance_dao.go
@@ -422,14 +422,41 @@ func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool,
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
- err := sqlutils.QueryRowsMap(db, "show global status like 'rpl_semi_sync_%_status'", func(m sqlutils.RowMap) error {
- if m.GetString("Variable_name") == "Rpl_semi_sync_master_status" {
+ semiSyncMasterPluginLoaded := false
+ semiSyncReplicaPluginLoaded := false
+ err := sqlutils.QueryRowsMap(db, "show global variables like 'rpl_semi_sync_%'", func(m sqlutils.RowMap) error {
+ if m.GetString("Variable_name") == "rpl_semi_sync_master_enabled" {
instance.SemiSyncMasterEnabled = (m.GetString("Value") == "ON")
- } else if m.GetString("Variable_name") == "Rpl_semi_sync_slave_status" {
+ semiSyncMasterPluginLoaded = true
+ } else if m.GetString("Variable_name") == "rpl_semi_sync_master_timeout" {
+ instance.SemiSyncMasterTimeout = m.GetUint("Value")
+ } else if m.GetString("Variable_name") == "rpl_semi_sync_master_wait_for_slave_count" {
+ instance.SemiSyncMasterWaitForReplicaCount = m.GetUint("Value")
+ } else if m.GetString("Variable_name") == "rpl_semi_sync_slave_enabled" {
instance.SemiSyncReplicaEnabled = (m.GetString("Value") == "ON")
+ semiSyncReplicaPluginLoaded = true
}
return nil
})
+ instance.SemiSyncAvailable = (semiSyncMasterPluginLoaded && semiSyncReplicaPluginLoaded)
+ errorChan <- err
+ }()
+ }
+ {
+ waitGroup.Add(1)
+ go func() {
+ defer waitGroup.Done()
+ err := sqlutils.QueryRowsMap(db, "show global status like 'rpl_semi_sync_%'", func(m sqlutils.RowMap) error {
+ if m.GetString("Variable_name") == "Rpl_semi_sync_master_status" {
+ instance.SemiSyncMasterStatus = (m.GetString("Value") == "ON")
+ } else if m.GetString("Variable_name") == "Rpl_semi_sync_master_clients" {
+ instance.SemiSyncMasterClients = m.GetUint("Value")
+ } else if m.GetString("Variable_name") == "Rpl_semi_sync_slave_status" {
+ instance.SemiSyncReplicaStatus = (m.GetString("Value") == "ON")
+ }
+
+ return nil
+ })
errorChan <- err
}()
}
@@ -1110,8 +1137,14 @@ func readInstanceRow(m sqlutils.RowMap) *Instance {
instance.Region = m.GetString("region")
instance.PhysicalEnvironment = m.GetString("physical_environment")
instance.SemiSyncEnforced = m.GetBool("semi_sync_enforced")
+ instance.SemiSyncAvailable = m.GetBool("semi_sync_available")
instance.SemiSyncMasterEnabled = m.GetBool("semi_sync_master_enabled")
+ instance.SemiSyncMasterTimeout = m.GetUint("semi_sync_master_timeout")
+ instance.SemiSyncMasterWaitForReplicaCount = m.GetUint("semi_sync_master_wait_for_slave_count")
instance.SemiSyncReplicaEnabled = m.GetBool("semi_sync_replica_enabled")
+ instance.SemiSyncMasterStatus = m.GetBool("semi_sync_master_status")
+ instance.SemiSyncMasterClients = m.GetUint("semi_sync_master_clients")
+ instance.SemiSyncReplicaStatus = m.GetBool("semi_sync_replica_status")
instance.ReplicationDepth = m.GetUint("replication_depth")
instance.IsCoMaster = m.GetBool("is_co_master")
instance.ReplicationCredentialsAvailable = m.GetBool("replication_credentials_available")
@@ -2397,8 +2430,14 @@ func mkInsertOdkuForInstances(instances []*Instance, instanceWasActuallyFound bo
"has_replication_credentials",
"allow_tls",
"semi_sync_enforced",
+ "semi_sync_available",
"semi_sync_master_enabled",
+ "semi_sync_master_timeout",
+ "semi_sync_master_wait_for_slave_count",
"semi_sync_replica_enabled",
+ "semi_sync_master_status",
+ "semi_sync_master_clients",
+ "semi_sync_replica_status",
"instance_alias",
"last_discovery_latency",
}
@@ -2477,8 +2516,14 @@ func mkInsertOdkuForInstances(instances []*Instance, instanceWasActuallyFound bo
args = append(args, instance.HasReplicationCredentials)
args = append(args, instance.AllowTLS)
args = append(args, instance.SemiSyncEnforced)
+ args = append(args, instance.SemiSyncAvailable)
args = append(args, instance.SemiSyncMasterEnabled)
+ args = append(args, instance.SemiSyncMasterTimeout)
+ args = append(args, instance.SemiSyncMasterWaitForReplicaCount)
args = append(args, instance.SemiSyncReplicaEnabled)
+ args = append(args, instance.SemiSyncMasterStatus)
+ args = append(args, instance.SemiSyncMasterClients)
+ args = append(args, instance.SemiSyncReplicaStatus)
args = append(args, instance.InstanceAlias)
args = append(args, instance.LastDiscoveryLatency.Nanoseconds())
}
diff --git a/go/inst/instance_dao_test.go b/go/inst/instance_dao_test.go
index 4de3bb4ef..52e826866 100644
--- a/go/inst/instance_dao_test.go
+++ b/go/inst/instance_dao_test.go
@@ -60,15 +60,17 @@ func TestMkInsertOdkuSingle(t *testing.T) {
version, major_version, version_comment, binlog_server, read_only, binlog_format,
binlog_row_image, log_bin, log_slave_updates, binary_log_file, binary_log_pos, master_host, master_port,
slave_sql_running, slave_io_running, replication_sql_thread_state, replication_io_thread_state, has_replication_filters, supports_oracle_gtid, oracle_gtid, master_uuid, ancestry_uuid, executed_gtid_set, gtid_mode, gtid_purged, gtid_errant, mariadb_gtid, pseudo_gtid,
- master_log_file, read_master_log_pos, relay_master_log_file, exec_master_log_pos, relay_log_file, relay_log_pos, last_sql_error, last_io_error, seconds_behind_master, slave_lag_seconds, sql_delay, num_slave_hosts, slave_hosts, cluster_name, suggested_cluster_alias, data_center, region, physical_environment, replication_depth, is_co_master, replication_credentials_available, has_replication_credentials, allow_tls, semi_sync_enforced, semi_sync_master_enabled, semi_sync_replica_enabled, instance_alias, last_discovery_latency, last_seen)
+ master_log_file, read_master_log_pos, relay_master_log_file, exec_master_log_pos, relay_log_file, relay_log_pos, last_sql_error, last_io_error, seconds_behind_master, slave_lag_seconds, sql_delay, num_slave_hosts, slave_hosts, cluster_name, suggested_cluster_alias, data_center, region, physical_environment, replication_depth, is_co_master, replication_credentials_available, has_replication_credentials, allow_tls, semi_sync_enforced, semi_sync_available, semi_sync_master_enabled, semi_sync_master_timeout, semi_sync_master_wait_for_slave_count, semi_sync_replica_enabled, semi_sync_master_status, semi_sync_master_clients, semi_sync_replica_status, instance_alias, last_discovery_latency, last_seen)
VALUES
- (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())
+ (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())
ON DUPLICATE KEY UPDATE
- hostname=VALUES(hostname), port=VALUES(port), last_checked=VALUES(last_checked), last_attempted_check=VALUES(last_attempted_check), last_check_partial_success=VALUES(last_check_partial_success), uptime=VALUES(uptime), server_id=VALUES(server_id), server_uuid=VALUES(server_uuid), version=VALUES(version), major_version=VALUES(major_version), version_comment=VALUES(version_comment), binlog_server=VALUES(binlog_server), read_only=VALUES(read_only), binlog_format=VALUES(binlog_format), binlog_row_image=VALUES(binlog_row_image), log_bin=VALUES(log_bin), log_slave_updates=VALUES(log_slave_updates), binary_log_file=VALUES(binary_log_file), binary_log_pos=VALUES(binary_log_pos), master_host=VALUES(master_host), master_port=VALUES(master_port), slave_sql_running=VALUES(slave_sql_running), slave_io_running=VALUES(slave_io_running), replication_sql_thread_state=VALUES(replication_sql_thread_state), replication_io_thread_state=VALUES(replication_io_thread_state), has_replication_filters=VALUES(has_replication_filters), supports_oracle_gtid=VALUES(supports_oracle_gtid), oracle_gtid=VALUES(oracle_gtid), master_uuid=VALUES(master_uuid), ancestry_uuid=VALUES(ancestry_uuid), executed_gtid_set=VALUES(executed_gtid_set), gtid_mode=VALUES(gtid_mode), gtid_purged=VALUES(gtid_purged), gtid_errant=VALUES(gtid_errant), mariadb_gtid=VALUES(mariadb_gtid), pseudo_gtid=VALUES(pseudo_gtid), master_log_file=VALUES(master_log_file), read_master_log_pos=VALUES(read_master_log_pos), relay_master_log_file=VALUES(relay_master_log_file), exec_master_log_pos=VALUES(exec_master_log_pos), relay_log_file=VALUES(relay_log_file), relay_log_pos=VALUES(relay_log_pos), last_sql_error=VALUES(last_sql_error), last_io_error=VALUES(last_io_error), seconds_behind_master=VALUES(seconds_behind_master), slave_lag_seconds=VALUES(slave_lag_seconds), sql_delay=VALUES(sql_delay), num_slave_hosts=VALUES(num_slave_hosts), slave_hosts=VALUES(slave_hosts), cluster_name=VALUES(cluster_name), suggested_cluster_alias=VALUES(suggested_cluster_alias), data_center=VALUES(data_center), region=VALUES(region), physical_environment=VALUES(physical_environment), replication_depth=VALUES(replication_depth), is_co_master=VALUES(is_co_master), replication_credentials_available=VALUES(replication_credentials_available), has_replication_credentials=VALUES(has_replication_credentials), allow_tls=VALUES(allow_tls), semi_sync_enforced=VALUES(semi_sync_enforced), semi_sync_master_enabled=VALUES(semi_sync_master_enabled), semi_sync_replica_enabled=VALUES(semi_sync_replica_enabled), instance_alias=VALUES(instance_alias), last_discovery_latency=VALUES(last_discovery_latency), last_seen=VALUES(last_seen)
+ hostname=VALUES(hostname), port=VALUES(port), last_checked=VALUES(last_checked), last_attempted_check=VALUES(last_attempted_check), last_check_partial_success=VALUES(last_check_partial_success), uptime=VALUES(uptime), server_id=VALUES(server_id), server_uuid=VALUES(server_uuid), version=VALUES(version), major_version=VALUES(major_version), version_comment=VALUES(version_comment), binlog_server=VALUES(binlog_server), read_only=VALUES(read_only), binlog_format=VALUES(binlog_format), binlog_row_image=VALUES(binlog_row_image), log_bin=VALUES(log_bin), log_slave_updates=VALUES(log_slave_updates), binary_log_file=VALUES(binary_log_file), binary_log_pos=VALUES(binary_log_pos), master_host=VALUES(master_host), master_port=VALUES(master_port), slave_sql_running=VALUES(slave_sql_running), slave_io_running=VALUES(slave_io_running), replication_sql_thread_state=VALUES(replication_sql_thread_state), replication_io_thread_state=VALUES(replication_io_thread_state), has_replication_filters=VALUES(has_replication_filters), supports_oracle_gtid=VALUES(supports_oracle_gtid), oracle_gtid=VALUES(oracle_gtid), master_uuid=VALUES(master_uuid), ancestry_uuid=VALUES(ancestry_uuid), executed_gtid_set=VALUES(executed_gtid_set), gtid_mode=VALUES(gtid_mode), gtid_purged=VALUES(gtid_purged), gtid_errant=VALUES(gtid_errant), mariadb_gtid=VALUES(mariadb_gtid), pseudo_gtid=VALUES(pseudo_gtid), master_log_file=VALUES(master_log_file), read_master_log_pos=VALUES(read_master_log_pos), relay_master_log_file=VALUES(relay_master_log_file), exec_master_log_pos=VALUES(exec_master_log_pos), relay_log_file=VALUES(relay_log_file), relay_log_pos=VALUES(relay_log_pos), last_sql_error=VALUES(last_sql_error), last_io_error=VALUES(last_io_error), seconds_behind_master=VALUES(seconds_behind_master), slave_lag_seconds=VALUES(slave_lag_seconds), sql_delay=VALUES(sql_delay), num_slave_hosts=VALUES(num_slave_hosts), slave_hosts=VALUES(slave_hosts), cluster_name=VALUES(cluster_name), suggested_cluster_alias=VALUES(suggested_cluster_alias), data_center=VALUES(data_center), region=VALUES(region), physical_environment=VALUES(physical_environment), replication_depth=VALUES(replication_depth), is_co_master=VALUES(is_co_master), replication_credentials_available=VALUES(replication_credentials_available), has_replication_credentials=VALUES(has_replication_credentials), allow_tls=VALUES(allow_tls),
+ semi_sync_enforced=VALUES(semi_sync_enforced), semi_sync_available=VALUES(semi_sync_available), semi_sync_master_enabled=VALUES(semi_sync_master_enabled), semi_sync_master_timeout=VALUES(semi_sync_master_timeout), semi_sync_master_wait_for_slave_count=VALUES(semi_sync_master_wait_for_slave_count), semi_sync_replica_enabled=VALUES(semi_sync_replica_enabled), semi_sync_master_status=VALUES(semi_sync_master_status), semi_sync_master_clients=VALUES(semi_sync_master_clients), semi_sync_replica_status=VALUES(semi_sync_replica_status),
+ instance_alias=VALUES(instance_alias), last_discovery_latency=VALUES(last_discovery_latency), last_seen=VALUES(last_seen)
`
a1 := `i710, 3306, 0, 710, , 5.6.7, 5.6, MySQL, false, false, STATEMENT,
FULL, false, false, , 0, , 0,
- false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 10, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, , 0, `
+ false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 10, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, 0, 0, false, false, 0, false, , 0, `
sql1, args1, err := mkInsertOdkuForInstances(instances[:1], false, true)
test.S(t).ExpectNil(err)
@@ -81,19 +83,22 @@ func TestMkInsertOdkuThree(t *testing.T) {
// three instances
s3 := `INSERT INTO database_instance
- (hostname, port, last_checked, last_attempted_check, last_check_partial_success, uptime, server_id, server_uuid, version, major_version, version_comment, binlog_server, read_only, binlog_format, binlog_row_image, log_bin, log_slave_updates, binary_log_file, binary_log_pos, master_host, master_port, slave_sql_running, slave_io_running, replication_sql_thread_state, replication_io_thread_state, has_replication_filters, supports_oracle_gtid, oracle_gtid, master_uuid, ancestry_uuid, executed_gtid_set, gtid_mode, gtid_purged, gtid_errant, mariadb_gtid, pseudo_gtid, master_log_file, read_master_log_pos, relay_master_log_file, exec_master_log_pos, relay_log_file, relay_log_pos, last_sql_error, last_io_error, seconds_behind_master, slave_lag_seconds, sql_delay, num_slave_hosts, slave_hosts, cluster_name, suggested_cluster_alias, data_center, region, physical_environment, replication_depth, is_co_master, replication_credentials_available, has_replication_credentials, allow_tls, semi_sync_enforced, semi_sync_master_enabled, semi_sync_replica_enabled, instance_alias, last_discovery_latency, last_seen)
+ (hostname, port, last_checked, last_attempted_check, last_check_partial_success, uptime, server_id, server_uuid, version, major_version, version_comment, binlog_server, read_only, binlog_format, binlog_row_image, log_bin, log_slave_updates, binary_log_file, binary_log_pos, master_host, master_port, slave_sql_running, slave_io_running, replication_sql_thread_state, replication_io_thread_state, has_replication_filters, supports_oracle_gtid, oracle_gtid, master_uuid, ancestry_uuid, executed_gtid_set, gtid_mode, gtid_purged, gtid_errant, mariadb_gtid, pseudo_gtid, master_log_file, read_master_log_pos, relay_master_log_file, exec_master_log_pos, relay_log_file, relay_log_pos, last_sql_error, last_io_error, seconds_behind_master, slave_lag_seconds, sql_delay, num_slave_hosts, slave_hosts, cluster_name, suggested_cluster_alias, data_center, region, physical_environment, replication_depth, is_co_master, replication_credentials_available, has_replication_credentials, allow_tls, semi_sync_enforced, semi_sync_available, semi_sync_master_enabled, semi_sync_master_timeout, semi_sync_master_wait_for_slave_count,
+ semi_sync_replica_enabled, semi_sync_master_status, semi_sync_master_clients, semi_sync_replica_status, instance_alias, last_discovery_latency, last_seen)
VALUES
- (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW()),
- (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW()),
- (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())
+ (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW()),
+ (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW()),
+ (?, ?, NOW(), NOW(), 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())
ON DUPLICATE KEY UPDATE
hostname=VALUES(hostname), port=VALUES(port), last_checked=VALUES(last_checked), last_attempted_check=VALUES(last_attempted_check), last_check_partial_success=VALUES(last_check_partial_success), uptime=VALUES(uptime), server_id=VALUES(server_id), server_uuid=VALUES(server_uuid), version=VALUES(version), major_version=VALUES(major_version), version_comment=VALUES(version_comment), binlog_server=VALUES(binlog_server), read_only=VALUES(read_only), binlog_format=VALUES(binlog_format), binlog_row_image=VALUES(binlog_row_image), log_bin=VALUES(log_bin), log_slave_updates=VALUES(log_slave_updates), binary_log_file=VALUES(binary_log_file), binary_log_pos=VALUES(binary_log_pos), master_host=VALUES(master_host), master_port=VALUES(master_port), slave_sql_running=VALUES(slave_sql_running), slave_io_running=VALUES(slave_io_running), replication_sql_thread_state=VALUES(replication_sql_thread_state), replication_io_thread_state=VALUES(replication_io_thread_state), has_replication_filters=VALUES(has_replication_filters), supports_oracle_gtid=VALUES(supports_oracle_gtid), oracle_gtid=VALUES(oracle_gtid), master_uuid=VALUES(master_uuid), ancestry_uuid=VALUES(ancestry_uuid), executed_gtid_set=VALUES(executed_gtid_set), gtid_mode=VALUES(gtid_mode), gtid_purged=VALUES(gtid_purged), gtid_errant=VALUES(gtid_errant), mariadb_gtid=VALUES(mariadb_gtid), pseudo_gtid=VALUES(pseudo_gtid), master_log_file=VALUES(master_log_file), read_master_log_pos=VALUES(read_master_log_pos), relay_master_log_file=VALUES(relay_master_log_file), exec_master_log_pos=VALUES(exec_master_log_pos), relay_log_file=VALUES(relay_log_file), relay_log_pos=VALUES(relay_log_pos), last_sql_error=VALUES(last_sql_error), last_io_error=VALUES(last_io_error), seconds_behind_master=VALUES(seconds_behind_master), slave_lag_seconds=VALUES(slave_lag_seconds), sql_delay=VALUES(sql_delay), num_slave_hosts=VALUES(num_slave_hosts), slave_hosts=VALUES(slave_hosts), cluster_name=VALUES(cluster_name), suggested_cluster_alias=VALUES(suggested_cluster_alias), data_center=VALUES(data_center), region=VALUES(region),
- physical_environment=VALUES(physical_environment), replication_depth=VALUES(replication_depth), is_co_master=VALUES(is_co_master), replication_credentials_available=VALUES(replication_credentials_available), has_replication_credentials=VALUES(has_replication_credentials), allow_tls=VALUES(allow_tls), semi_sync_enforced=VALUES(semi_sync_enforced), semi_sync_master_enabled=VALUES(semi_sync_master_enabled), semi_sync_replica_enabled=VALUES(semi_sync_replica_enabled), instance_alias=VALUES(instance_alias), last_discovery_latency=VALUES(last_discovery_latency), last_seen=VALUES(last_seen)
+ physical_environment=VALUES(physical_environment), replication_depth=VALUES(replication_depth), is_co_master=VALUES(is_co_master), replication_credentials_available=VALUES(replication_credentials_available), has_replication_credentials=VALUES(has_replication_credentials), allow_tls=VALUES(allow_tls), semi_sync_enforced=VALUES(semi_sync_enforced), semi_sync_available=VALUES(semi_sync_available),
+ semi_sync_master_enabled=VALUES(semi_sync_master_enabled), semi_sync_master_timeout=VALUES(semi_sync_master_timeout), semi_sync_master_wait_for_slave_count=VALUES(semi_sync_master_wait_for_slave_count), semi_sync_replica_enabled=VALUES(semi_sync_replica_enabled), semi_sync_master_status=VALUES(semi_sync_master_status), semi_sync_master_clients=VALUES(semi_sync_master_clients), semi_sync_replica_status=VALUES(semi_sync_replica_status),
+ instance_alias=VALUES(instance_alias), last_discovery_latency=VALUES(last_discovery_latency), last_seen=VALUES(last_seen)
`
a3 := `
- i710, 3306, 0, 710, , 5.6.7, 5.6, MySQL, false, false, STATEMENT, FULL, false, false, , 0, , 0, false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 10, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, , 0,
- i720, 3306, 0, 720, , 5.6.7, 5.6, MySQL, false, false, STATEMENT, FULL, false, false, , 0, , 0, false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 20, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, , 0,
- i730, 3306, 0, 730, , 5.6.7, 5.6, MySQL, false, false, STATEMENT, FULL, false, false, , 0, , 0, false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 30, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, , 0,
+ i710, 3306, 0, 710, , 5.6.7, 5.6, MySQL, false, false, STATEMENT, FULL, false, false, , 0, , 0, false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 10, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, 0, 0, false, false, 0, false, , 0,
+ i720, 3306, 0, 720, , 5.6.7, 5.6, MySQL, false, false, STATEMENT, FULL, false, false, , 0, , 0, false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 20, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, 0, 0, false, false, 0, false, , 0,
+ i730, 3306, 0, 730, , 5.6.7, 5.6, MySQL, false, false, STATEMENT, FULL, false, false, , 0, , 0, false, false, 0, 0, false, false, false, , , , , , , false, false, , 0, mysql.000007, 30, , 0, , , {0 false}, {0 false}, 0, 0, [], , , , , , 0, false, false, false, false, false, false, false, 0, 0, false, false, 0, false, , 0,
`
sql3, args3, err := mkInsertOdkuForInstances(instances[:3], true, true)
diff --git a/resources/public/js/orchestrator.js b/resources/public/js/orchestrator.js
index 7956056b8..34ec01744 100644
--- a/resources/public/js/orchestrator.js
+++ b/resources/public/js/orchestrator.js
@@ -877,10 +877,10 @@ function renderInstanceElement(popoverElement, instance, renderType) {
if (instance.HasReplicationFilters) {
popoverElement.find("h3 div.pull-right").prepend(' ');
}
- if (instance.SemiSyncMasterEnabled) {
+ if (instance.SemiSyncMasterStatus) {
popoverElement.find("h3 div.pull-right").prepend(' ');
}
- if (instance.SemiSyncReplicaEnabled) {
+ if (instance.SemiSyncReplicaStatus) {
popoverElement.find("h3 div.pull-right").prepend(' ');
}
if (instance.LogBinEnabled && instance.LogSlaveUpdatesEnabled) {
diff --git a/tests/integration/analysis-no-valid-semi-sync-replicas/create.sql b/tests/integration/analysis-no-valid-semi-sync-replicas/create.sql
new file mode 100644
index 000000000..bb8f0812b
--- /dev/null
+++ b/tests/integration/analysis-no-valid-semi-sync-replicas/create.sql
@@ -0,0 +1,2 @@
+UPDATE database_instance SET semi_sync_master_enabled=1, semi_sync_master_wait_for_slave_count=1 where port=22293;
+UPDATE database_instance SET semi_sync_replica_enabled=0;
diff --git a/tests/integration/analysis-no-valid-semi-sync-replicas/expect_output b/tests/integration/analysis-no-valid-semi-sync-replicas/expect_output
new file mode 100644
index 000000000..396f82726
--- /dev/null
+++ b/tests/integration/analysis-no-valid-semi-sync-replicas/expect_output
@@ -0,0 +1 @@
+testhost:22293 (cluster testhost:22293): NoValidSemiSyncReplicasStructureWarning
diff --git a/tests/integration/analysis-no-valid-semi-sync-replicas/extra_args b/tests/integration/analysis-no-valid-semi-sync-replicas/extra_args
new file mode 100644
index 000000000..e294ffff2
--- /dev/null
+++ b/tests/integration/analysis-no-valid-semi-sync-replicas/extra_args
@@ -0,0 +1 @@
+-c replication-analysis
diff --git a/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/create.sql b/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/create.sql
new file mode 100644
index 000000000..a04e368f0
--- /dev/null
+++ b/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/create.sql
@@ -0,0 +1,3 @@
+UPDATE database_instance SET semi_sync_master_enabled=1, semi_sync_master_wait_for_slave_count=2 where port=22293;
+UPDATE database_instance SET semi_sync_replica_enabled=1 where port in (22294, 22296);
+UPDATE database_instance SET last_seen=last_checked - interval 1 minute where port=22296;
diff --git a/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/expect_output b/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/expect_output
new file mode 100644
index 000000000..0cc2f0321
--- /dev/null
+++ b/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/expect_output
@@ -0,0 +1 @@
+testhost:22293 (cluster testhost:22293): NotEnoughValidSemiSyncReplicasStructureWarning
diff --git a/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/extra_args b/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/extra_args
new file mode 100644
index 000000000..e294ffff2
--- /dev/null
+++ b/tests/integration/analysis-not-enough-valid-semi-sync-replicas-invalid/extra_args
@@ -0,0 +1 @@
+-c replication-analysis
diff --git a/tests/integration/analysis-not-enough-valid-semi-sync-replicas/create.sql b/tests/integration/analysis-not-enough-valid-semi-sync-replicas/create.sql
new file mode 100644
index 000000000..6fb5c14c5
--- /dev/null
+++ b/tests/integration/analysis-not-enough-valid-semi-sync-replicas/create.sql
@@ -0,0 +1,2 @@
+UPDATE database_instance SET semi_sync_master_enabled=1, semi_sync_master_wait_for_slave_count=2 where port=22293;
+UPDATE database_instance SET semi_sync_replica_enabled=1 where master_port=22293 limit 1;
diff --git a/tests/integration/analysis-not-enough-valid-semi-sync-replicas/expect_output b/tests/integration/analysis-not-enough-valid-semi-sync-replicas/expect_output
new file mode 100644
index 000000000..0cc2f0321
--- /dev/null
+++ b/tests/integration/analysis-not-enough-valid-semi-sync-replicas/expect_output
@@ -0,0 +1 @@
+testhost:22293 (cluster testhost:22293): NotEnoughValidSemiSyncReplicasStructureWarning
diff --git a/tests/integration/analysis-not-enough-valid-semi-sync-replicas/extra_args b/tests/integration/analysis-not-enough-valid-semi-sync-replicas/extra_args
new file mode 100644
index 000000000..e294ffff2
--- /dev/null
+++ b/tests/integration/analysis-not-enough-valid-semi-sync-replicas/extra_args
@@ -0,0 +1 @@
+-c replication-analysis
diff --git a/tests/integration/analysis-semi-sync-ok/create.sql b/tests/integration/analysis-semi-sync-ok/create.sql
new file mode 100644
index 000000000..59905378f
--- /dev/null
+++ b/tests/integration/analysis-semi-sync-ok/create.sql
@@ -0,0 +1,2 @@
+UPDATE database_instance SET semi_sync_master_enabled=1, semi_sync_master_wait_for_slave_count=2 where port=22293;
+UPDATE database_instance SET semi_sync_replica_enabled=1 where master_port=22293 limit 2;
diff --git a/tests/integration/analysis-semi-sync-ok/expect_output b/tests/integration/analysis-semi-sync-ok/expect_output
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/integration/analysis-semi-sync-ok/extra_args b/tests/integration/analysis-semi-sync-ok/extra_args
new file mode 100644
index 000000000..e294ffff2
--- /dev/null
+++ b/tests/integration/analysis-semi-sync-ok/extra_args
@@ -0,0 +1 @@
+-c replication-analysis