@@ -278,7 +278,7 @@ private void closeDirtyAndRevive(final Collection<Task> taskWithChangelogs, fina
278
278
// we do not need to take the returned offsets since we are not going to commit anyways;
279
279
// this call is only used for active tasks to flush the cache before suspending and
280
280
// closing the topology
281
- task .prepareCommit ();
281
+ task .prepareCommit (false );
282
282
} catch (final RuntimeException swallow ) {
283
283
log .warn ("Error flushing cache for corrupted task {}. " +
284
284
"Since the task is closing dirty, the following exception is swallowed: {}" ,
@@ -812,7 +812,7 @@ private Map<TaskId, RuntimeException> closeAndRecycleTasks(final Map<Task, Set<T
812
812
// and their changelog positions should not change at all postCommit would not write the checkpoint again.
813
813
// 2) for standby tasks prepareCommit should always return empty, and then in postCommit we would probably
814
814
// write the checkpoint file.
815
- final Map <TopicPartition , OffsetAndMetadata > offsets = task .prepareCommit ();
815
+ final Map <TopicPartition , OffsetAndMetadata > offsets = task .prepareCommit (true );
816
816
if (!offsets .isEmpty ()) {
817
817
log .error ("Task {} should have been committed when it was suspended, but it reports non-empty " +
818
818
"offsets {} to commit; this means it failed during last commit and hence should be closed dirty" ,
@@ -1264,7 +1264,7 @@ private void prepareCommitAndAddOffsetsToMap(final Set<Task> tasksToPrepare,
1264
1264
final Map <Task , Map <TopicPartition , OffsetAndMetadata >> consumedOffsetsPerTask ) {
1265
1265
for (final Task task : tasksToPrepare ) {
1266
1266
try {
1267
- final Map <TopicPartition , OffsetAndMetadata > committableOffsets = task .prepareCommit ();
1267
+ final Map <TopicPartition , OffsetAndMetadata > committableOffsets = task .prepareCommit (true );
1268
1268
if (!committableOffsets .isEmpty ()) {
1269
1269
consumedOffsetsPerTask .put (task , committableOffsets );
1270
1270
}
@@ -1479,7 +1479,7 @@ private void closeTaskDirty(final Task task, final boolean removeFromTasksRegist
1479
1479
try {
1480
1480
// we call this function only to flush the case if necessary
1481
1481
// before suspending and closing the topology
1482
- task .prepareCommit ();
1482
+ task .prepareCommit (false );
1483
1483
} catch (final RuntimeException swallow ) {
1484
1484
log .warn ("Error flushing cache of dirty task {}. " +
1485
1485
"Since the task is closing dirty, the following exception is swallowed: {}" ,
@@ -1630,7 +1630,7 @@ private Collection<Task> tryCloseCleanActiveTasks(final Collection<Task> activeT
1630
1630
// first committing all tasks and then suspend and close them clean
1631
1631
for (final Task task : activeTasksToClose ) {
1632
1632
try {
1633
- final Map <TopicPartition , OffsetAndMetadata > committableOffsets = task .prepareCommit ();
1633
+ final Map <TopicPartition , OffsetAndMetadata > committableOffsets = task .prepareCommit (true );
1634
1634
tasksToCommit .add (task );
1635
1635
if (!committableOffsets .isEmpty ()) {
1636
1636
consumedOffsetsAndMetadataPerTask .put (task , committableOffsets );
@@ -1719,7 +1719,7 @@ private Collection<Task> tryCloseCleanStandbyTasks(final Collection<Task> standb
1719
1719
// first committing and then suspend / close clean
1720
1720
for (final Task task : standbyTasksToClose ) {
1721
1721
try {
1722
- task .prepareCommit ();
1722
+ task .prepareCommit (true );
1723
1723
task .postCommit (true );
1724
1724
task .suspend ();
1725
1725
closeTaskClean (task );
0 commit comments