Source:
<code>private void runFirehoseV2(FirehoseV2 firehose) { final Period intermediatePersistPeriod = config.getIntermediatePersistPeriod(); try { firehose.start(); } catch (Exception e) { log.error(e, "Failed to start firehoseV2"); return; } <START> long nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); <END> boolean haveRow = true; while (haveRow) { InputRow inputRow = null; int numRows = 0; try { inputRow = firehose.currRow(); if (inputRow != null) { try { numRows = plumber.add(inputRow); } catch (IndexSizeExceededException e) { log.info("Index limit exceeded: %s", e.getMessage()); nextFlush = doIncrementalPersist(firehose.makeCommitter(), intermediatePersistPeriod); continue; } if (numRows < 0) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); } else { metrics.incrementProcessed(); } } } catch (Exception e) { log.makeAlert(e, "Some exception got thrown while processing rows. Ignoring and continuing.") .addData("inputRow", inputRow); } try { haveRow = firehose.advance(); } catch (Exception e) { log.debug(e, "thrown away line due to exception, considering unparseable"); metrics.incrementUnparseable(); continue; } try { if (numRows > config.getMaxRowsInMemory() || System.currentTimeMillis() > nextFlush) { nextFlush = doIncrementalPersist(firehose.makeCommitter(), intermediatePersistPeriod); } } catch (Exception e) { log.makeAlert(e, "An exception happened while queue to persist!? We hope it is transient. Ignore and continue."); } } }</code><technical_language>I log next flush</technical_language>

Target:
private void runFirehoseV2(FirehoseV2 firehose) { final Period intermediatePersistPeriod = config.getIntermediatePersistPeriod(); try { firehose.start(); } catch (Exception e) { log.error(e, "Failed to start firehoseV2"); return; } long nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); log.info("FirehoseV2 started with nextFlush [%s]", nextFlush); boolean haveRow = true; while (haveRow) { InputRow inputRow = null; int numRows = 0; try { inputRow = firehose.currRow(); if (inputRow != null) { try { numRows = plumber.add(inputRow); } catch (IndexSizeExceededException e) { log.info("Index limit exceeded: %s", e.getMessage()); nextFlush = doIncrementalPersist(firehose.makeCommitter(), intermediatePersistPeriod); continue; } if (numRows < 0) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); } else { metrics.incrementProcessed(); } } } catch (Exception e) { log.makeAlert(e, "Some exception got thrown while processing rows. Ignoring and continuing.") .addData("inputRow", inputRow); } try { haveRow = firehose.advance(); } catch (Exception e) { log.debug(e, "thrown away line due to exception, considering unparseable"); metrics.incrementUnparseable(); continue; } try { final Sink sink = plumber.getSink(inputRow.getTimestampFromEpoch()); if ((sink != null && !sink.canAppendRow()) || System.currentTimeMillis() > nextFlush) { nextFlush = doIncrementalPersist(firehose.makeCommitter(), intermediatePersistPeriod); } } catch (Exception e) { log.makeAlert(e, "An exception happened while queue to persist!? We hope it is transient. Ignore and continue."); } } }