MCPcopy Create free account
hub / github.com/apecloud/myduckserver / startReplication

Function startReplication

binlogreplication/binlog_replication_test.go:750–774  ·  view source on GitHub ↗

startReplication configures the replication source on the replica and runs the START REPLICA statement.

(t *testing.T, port int)

Source from the content-addressed store, hash-verified

748}
749
750func TestFilePositionConfigurationStatus(t *testing.T) {
751 if getGtidEnabled() {
752 t.Skip("file-position status requires GTID_ENABLED=false")
753 }
754
755 defer teardown(t)
756 startSqlServersWithSystemVars(t, duckReplicaSystemVars)
757 sourceLogFile, sourceLogPos := getPrimaryLogPosition(t, false)
758 replicaDatabase.MustExec(fmt.Sprintf(
759 "CHANGE REPLICATION SOURCE TO SOURCE_LOG_FILE='%s', SOURCE_LOG_POS=%s",
760 sourceLogFile,
761 sourceLogPos,
762 ))
763
764 status := showReplicaStatus(t)
765 require.Equal(t, sourceLogFile, status["Source_Log_File"])
766 require.Equal(t, sourceLogPos, status["Read_Source_Log_Pos"])
767 require.Equal(t, sourceLogFile+":"+sourceLogPos, status["Executed_Gtid_Set"])
768
769 var storedPosition string
770 require.NoError(t, replicaDatabase.Get(
771 &storedPosition,
772 "SELECT position FROM __sys__.binlog_position WHERE channel = ''",
773 ))
774 require.Equal(t, filePosFlavorID+"/"+sourceLogFile+":"+sourceLogPos, storedPosition)
775}
776
777// TestStopReplica tests that STOP REPLICA correctly stops the replication process, and that

Calls 2

getGtidEnabledFunction · 0.85
getPrimaryLogPositionFunction · 0.85

Tested by

no test coverage detected