Source:
<code>public RowMap getRow() throws Exception { BinlogEventV4 v4Event; if ( stopOnEOF && hitEOF ) return null; while (true) { if (rowBuffer != null && !rowBuffer.isEmpty()) { RowMap row = rowBuffer.removeFirst(); processHeartbeats(row); return row; } v4Event = pollV4EventFromQueue(); if (v4Event == null) { if ( stopOnEOF ) { if ( replicator.isRunning() ) continue; else return null; } else { ensureReplicatorThread(); return null; } } switch (v4Event.getHeader().getEventType()) { case MySQLConstants.WRITE_ROWS_EVENT: case MySQLConstants.WRITE_ROWS_EVENT_V2: case MySQLConstants.UPDATE_ROWS_EVENT: case MySQLConstants.UPDATE_ROWS_EVENT_V2: case MySQLConstants.DELETE_ROWS_EVENT: case MySQLConstants.DELETE_ROWS_EVENT_V2: LOGGER.warn("Started replication stream outside of transaction. This shouldn't normally happen."); queue.offerFirst(v4Event); rowBuffer = getTransactionRows(); break; case MySQLConstants.TABLE_MAP_EVENT: tableCache.processEvent(getSchema(), this.filter, (TableMapEvent) v4Event); setReplicatorPosition((AbstractBinlogEventV4) v4Event); break; case MySQLConstants.QUERY_EVENT: QueryEvent qe = (QueryEvent) v4Event; if (qe.getSql().toString().equals("BEGIN")) rowBuffer = getTransactionRows(); else { processQueryEvent((QueryEvent) v4Event); setReplicatorPosition((AbstractBinlogEventV4) v4Event); } break; <START> case MySQLConstants.ROTATE_EVENT: <END> if ( stopOnEOF ) { this.replicator.stopQuietly(100, TimeUnit.MILLISECONDS); setReplicatorPosition((AbstractBinlogEventV4) v4Event); this.hitEOF = true; return null; } break; default: setReplicatorPosition((AbstractBinlogEventV4) v4Event); break; } } }</code><technical_language>is a case stop log file rotation? understanding mysql send eof catching master (no more events process) <LINK_0>, necessarily log rotation</technical_language>

Target:
public RowMap getRow() throws Exception { BinlogEventV4 v4Event; if ( stopOnEOF && hitEOF ) return null; while (true) { if (rowBuffer != null && !rowBuffer.isEmpty()) { RowMap row = rowBuffer.removeFirst(); if ( row != null && isMaxwellRow(row) && row.getTable().equals("positions") ) return processHeartbeats(row); else return row; } v4Event = pollV4EventFromQueue(); if (v4Event == null) { if ( stopOnEOF ) { if ( replicator.isRunning() ) continue; else return null; } else { ensureReplicatorThread(); return null; } } switch (v4Event.getHeader().getEventType()) { case MySQLConstants.WRITE_ROWS_EVENT: case MySQLConstants.WRITE_ROWS_EVENT_V2: case MySQLConstants.UPDATE_ROWS_EVENT: case MySQLConstants.UPDATE_ROWS_EVENT_V2: case MySQLConstants.DELETE_ROWS_EVENT: case MySQLConstants.DELETE_ROWS_EVENT_V2: LOGGER.warn("Started replication stream outside of transaction. This shouldn't normally happen."); queue.offerFirst(v4Event); rowBuffer = getTransactionRows(); break; case MySQLConstants.TABLE_MAP_EVENT: tableCache.processEvent(getSchema(), this.filter, (TableMapEvent) v4Event); setReplicatorPosition((AbstractBinlogEventV4) v4Event); break; case MySQLConstants.QUERY_EVENT: QueryEvent qe = (QueryEvent) v4Event; if (qe.getSql().toString().equals("BEGIN")) rowBuffer = getTransactionRows(); else { processQueryEvent((QueryEvent) v4Event); setReplicatorPosition((AbstractBinlogEventV4) v4Event); } break; case MySQLConstants.ROTATE_EVENT: if ( stopOnEOF ) { this.replicator.stopQuietly(100, TimeUnit.MILLISECONDS); setReplicatorPosition((AbstractBinlogEventV4) v4Event); this.hitEOF = true; return null; } break; default: setReplicatorPosition((AbstractBinlogEventV4) v4Event); break; } } }