Skip to content

Commit

Permalink
Merge pull request #61 from zendesk/ben/recover_from_lost_cx
Browse files Browse the repository at this point in the history
recover from lost cx
  • Loading branch information
Ben Osheroff committed Jun 16, 2015
2 parents 593a0b5 + b00114f commit 91b4ba5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>com.zendesk</groupId>
<artifactId>open-replicator</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void stop() {
mustStop.set(true);
}

@Override
public void onEvents(BinlogEventV4 event) {
while (mustStop.get() != true) {
try {
Expand Down
12 changes: 11 additions & 1 deletion src/main/java/com/zendesk/maxwell/MaxwellParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,23 @@ public void run() throws Exception {

for(;;) {
event = getEvent();

if ( !replicator.isRunning() ) {
LOGGER.warn("open-replicator stopped at position " + replicator.getBinlogFileName() + ":" + replicator.getBinlogPosition() + " -- restarting");
replicator.start();
}

if ( event == null )
continue;

if ( !skipEvent(event)) {
producer.push(event);
// TODO: we need to tell the producer to only store a stop-event on table-maps
// TODO: we need to tell the producer to only store a stop-event on table-maps; otherwise we can end up
// in the middle of multiple row events, which is a bug.
}

replicator.setBinlogFileName(event.getBinlogFilename());
replicator.setBinlogPosition(event.getHeader().getNextPosition());
}
}

Expand Down

0 comments on commit 91b4ba5

Please sign in to comment.