Skip to content

Commit

Permalink
recover from a dead open-replicator
Browse files Browse the repository at this point in the history
occasionally a master will cut the CX from underneath us.  this allows
us to recover.
  • Loading branch information
Ben Osheroff committed Jun 16, 2015
1 parent aee0719 commit b00114f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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 b00114f

Please sign in to comment.