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

Function queryGtid

binlogreplication/binlog_replication_test.go:623–642  ·  view source on GitHub ↗
(t *testing.T, database *sqlx.DB)

Source from the content-addressed store, hash-verified

621}
622
623func queryGtid(t *testing.T, database *sqlx.DB) string {
624 gtidEnabled := getGtidEnabled()
625 isPrimary := database == primaryDatabase
626 if gtidEnabled {
627 rows, err := database.Queryx("SELECT @@global.gtid_executed as gtid_executed;")
628 require.NoError(t, err)
629 defer rows.Close()
630 row := convertMapScanResultToStrings(readNextRow(t, rows))
631 if row["gtid_executed"] == nil {
632 t.Fatal("no value for @@GLOBAL.gtid_executed")
633 }
634 return row["gtid_executed"].(string)
635 } else if isPrimary {
636 sourceLogFile, sourceLogPos := getPrimaryLogPosition(t, gtidEnabled)
637 return fmt.Sprintf("%s:%s", sourceLogFile, sourceLogPos)
638 } else {
639 sourceLogFile, sourceLogPos := getReplicaLogPosition(t)
640 return fmt.Sprintf("%s:%s", sourceLogFile, sourceLogPos)
641 }
642}
643
644func readNextRow(t *testing.T, rows *sqlx.Rows) map[string]interface{} {
645 row := make(map[string]interface{})

Callers 2

waitForReplicaToCatchUpFunction · 0.85

Calls 6

getGtidEnabledFunction · 0.85
readNextRowFunction · 0.85
getPrimaryLogPositionFunction · 0.85
getReplicaLogPositionFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected