(t *testing.T, database *sqlx.DB)
| 621 | } |
| 622 | |
| 623 | func 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 | |
| 644 | func readNextRow(t *testing.T, rows *sqlx.Rows) map[string]interface{} { |
| 645 | row := make(map[string]interface{}) |
no test coverage detected