Source:
protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes) { if (_isFlushlessModeEnabled) { KafkaMirrorMakerCheckpoint sourceCheckpoint = new KafkaMirrorMakerCheckpoint(datastreamProducerRecord.getCheckpoint()); String topic = sourceCheckpoint.getTopic(); int partition = sourceCheckpoint.getPartition(); _flushlessProducer.send(datastreamProducerRecord, topic, partition, sourceCheckpoint.getOffset(), ((metadata, exception) -> { if (exception != null) { _logger.warn("Detect exception being throw from callback for src partition: while sending producer " + "record: {}, exception: ", srcTopicPartition, datastreamProducerRecord, exception); rewindAndPauseTopicPartitionWhenException(srcTopicPartition, exception); } _consumerMetrics.updateBytesProcessedRate(numBytes); })); if (_flowControlEnabled) { TopicPartition tp = new TopicPartition(topic, partition); long inFlightMessageCount = _flushlessProducer.getInFlightCount(topic, partition); if (inFlightMessageCount > _maxInFlightMessagesThreshold) { LOG.warn( "In-flight message count of for topic partition exceeded maxInFlightMessagesThreshold of {}. Will pause partition.", inFlightMessageCount, tp, _maxInFlightMessagesThreshold); _autoPausedSourcePartitions.put(tp, new PausedSourcePartitionMetadata( () -> _flushlessProducer.getInFlightCount(topic, partition) <= _minInFlightMessagesThreshold, PausedSourcePartitionMetadata.Reason.EXCEEDED_MAX_IN_FLIGHT_MSG_THRESHOLD)); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); _flowControlTriggerCount++; } } } else { super.sendDatastreamProducerRecord(datastreamProducerRecord, srcTopicPartition, numBytes); } }

Target:
protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes) { if (_isFlushlessModeEnabled) { KafkaMirrorMakerCheckpoint sourceCheckpoint = new KafkaMirrorMakerCheckpoint(datastreamProducerRecord.getCheckpoint()); String topic = sourceCheckpoint.getTopic(); int partition = sourceCheckpoint.getPartition(); _flushlessProducer.send(datastreamProducerRecord, topic, partition, sourceCheckpoint.getOffset(), ((metadata, exception) -> { if (exception != null) { _logger.warn("Detected exception being throw from callback for src partition: while sending producer " + "record: {}, exception: ", srcTopicPartition, datastreamProducerRecord, exception); rewindAndPausePartitionOnException(srcTopicPartition, exception); } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } })); if (_flowControlEnabled) { TopicPartition tp = new TopicPartition(topic, partition); long inFlightMessageCount = _flushlessProducer.getInFlightCount(topic, partition); if (inFlightMessageCount > _maxInFlightMessagesThreshold) { LOG.warn( "In-flight message count of for topic partition exceeded maxInFlightMessagesThreshold of {}. Will pause partition.", inFlightMessageCount, tp, _maxInFlightMessagesThreshold); _autoPausedSourcePartitions.put(tp, new PausedSourcePartitionMetadata( () -> _flushlessProducer.getInFlightCount(topic, partition) <= _minInFlightMessagesThreshold, PausedSourcePartitionMetadata.Reason.EXCEEDED_MAX_IN_FLIGHT_MSG_THRESHOLD)); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); _flowControlTriggerCount++; } } } else { super.sendDatastreamProducerRecord(datastreamProducerRecord, srcTopicPartition, numBytes); } }