Merge pull request #85 from hchiorean/DBZ-95

DBZ-95 Adds support for `null` binlog filename in certain cases
This commit is contained in:
Randall Hauch 2016-08-10 15:15:24 -05:00 committed by GitHub
commit 774f105670
2 changed files with 8 additions and 2 deletions

View File

@ -194,7 +194,8 @@ protected void execute() {
// Obtain the binlog position and update the SourceInfo in the context. This means that all source records generated
// as part of the snapshot will contain the binlog position of the snapshot.
logger.info("Step 3: read binlog position of MySQL master");
sql.set("SHOW MASTER STATUS");
String showMasterStmt = "SHOW MASTER STATUS";
sql.set(showMasterStmt);
mysql.query(sql.get(), rs -> {
if (rs.next()) {
String binlogFilename = rs.getString(1);
@ -210,6 +211,8 @@ protected void execute() {
logger.info("\t using binlog '{}' at position '{}'", binlogFilename, binlogPosition);
}
source.startSnapshot();
} else {
throw new IllegalStateException("Cannot read the binlog filename and position via '" + showMasterStmt + "'. Make sure your server is correctly configured");
}
});

View File

@ -273,7 +273,10 @@ public void setGtidSet(String gtidSet) {
* @param positionOfFirstEvent the position in the binary log file to begin processing
*/
public void setBinlogStartPoint(String binlogFilename, long positionOfFirstEvent) {
this.binlogFilename = binlogFilename;
if (binlogFilename != null) {
this.binlogFilename = binlogFilename;
}
assert positionOfFirstEvent >= 0;
this.nextBinlogPosition = positionOfFirstEvent;
this.lastBinlogPosition = this.nextBinlogPosition;
this.nextEventRowNumber = 0;