-
Notifications
You must be signed in to change notification settings - Fork 188
utils: don't panic when no row returned for SHOW MASTER STATUS #1733
Conversation
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.
Rest LGTM
if len(rowColumns) == 5 { | ||
err = rows.Scan(&binlogName, &pos, &nullPtr, &nullPtr, >idStr) | ||
} else { | ||
err = rows.Scan(&binlogName, &pos, &nullPtr, &nullPtr) |
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.
Do we need gtidStr
for mariaDB?
https://github.com/pingcap/dumpling/blob/master/v4/export/metadata.go#L137
if rows.Next() { | ||
log.L().Warn("SHOW MASTER STATUS returns more than one row, will only use first row") | ||
} | ||
|
||
if rows.Err() != nil { |
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'd better close rows
before checking rows.Err()
.
@@ -201,26 +202,32 @@ func GetMasterStatus(ctx context.Context, db *sql.DB, flavor string) (gmysql.Pos | |||
pos uint32 |
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.
can we add show master status
result from mariadb in comment ?
something like
For MariaDB,SHOW MASTER STATUS:
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000016 | 475 | | |
+--------------------+----------+--------------+------------------+
SELECT @@global.gtid_binlog_pos;
+--------------------------+
| @@global.gtid_binlog_pos |
+--------------------------+
| 0-1-2 |
+--------------------------+
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.
LGTM
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
LGTM |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: e03ad76
|
In response to a cherrypick label: new pull request created: #1774. |
What problem does this PR solve?
close #1732
What is changed and how it works?
give an error with message, to maintain "When the returned error is nil, the gtid.Set must be not nil"
Check List
Tests
Code changes
Side effects
Related changes