DBZ-1033 Mysql binlog reader lost data if restart task when last binlog event is QUERY event.
https://issues.jboss.org/browse/DBZ-1033 Reset restartEventsToSkip each time updating the restartBinlogPosition.
This commit is contained in:
parent
fcfc019b6b
commit
c58031582d
@ -211,6 +211,7 @@ public void setBinlogStartPoint(String binlogFilename, long positionOfFirstEvent
|
|||||||
this.restartBinlogPosition = positionOfFirstEvent;
|
this.restartBinlogPosition = positionOfFirstEvent;
|
||||||
this.currentRowNumber = 0;
|
this.currentRowNumber = 0;
|
||||||
this.restartRowsToSkip = 0;
|
this.restartRowsToSkip = 0;
|
||||||
|
this.restartEventsToSkip = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -224,6 +225,8 @@ public void setEventPosition(long positionOfCurrentEvent, long eventSizeInBytes)
|
|||||||
this.currentEventLengthInBytes = eventSizeInBytes;
|
this.currentEventLengthInBytes = eventSizeInBytes;
|
||||||
if (!inTransaction) {
|
if (!inTransaction) {
|
||||||
this.restartBinlogPosition = positionOfCurrentEvent + eventSizeInBytes;
|
this.restartBinlogPosition = positionOfCurrentEvent + eventSizeInBytes;
|
||||||
|
this.restartRowsToSkip = 0;
|
||||||
|
this.restartEventsToSkip = 0;
|
||||||
}
|
}
|
||||||
// Don't set anything else, since the row numbers are set in the offset(int,int) method called at least once
|
// Don't set anything else, since the row numbers are set in the offset(int,int) method called at least once
|
||||||
// for each processed event
|
// for each processed event
|
||||||
|
@ -728,8 +728,8 @@ public void shouldConsumeAllEventsFromDatabaseUsingSnapshot() throws SQLExceptio
|
|||||||
} else {
|
} else {
|
||||||
// the replica is not the same server as the master, so it will have a different binlog filename and position ...
|
// the replica is not the same server as the master, so it will have a different binlog filename and position ...
|
||||||
}
|
}
|
||||||
// Event number is 2 ...
|
// Last event is 'SHOW MASTER STATUS' which will reset the event number to 0 ...
|
||||||
assertThat(persistedOffsetSource.eventsToSkipUponRestart()).isEqualTo(2);
|
assertThat(persistedOffsetSource.eventsToSkipUponRestart()).isEqualTo(0);
|
||||||
// GTID set should match the before-inserts GTID set ...
|
// GTID set should match the before-inserts GTID set ...
|
||||||
// assertThat(persistedOffsetSource.gtidSet()).isEqualTo(positionBeforeInserts.gtidSet());
|
// assertThat(persistedOffsetSource.gtidSet()).isEqualTo(positionBeforeInserts.gtidSet());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user