@@ -1960,42 +1960,46 @@ void processConsumerActions(Store store) throws InterruptedException {
1960
1960
action .getFuture ().completeExceptionally (e );
1961
1961
throw e ;
1962
1962
} catch (Throwable e ) {
1963
- if (action .getAttemptsCount () <= MAX_CONSUMER_ACTION_ATTEMPTS ) {
1964
- LOGGER .warn ("Failed to process consumer action {}, will retry later." , action , e );
1963
+ if (!handleConsumerActionsError (e , action , actionProcessStartTimeInMs )) {
1965
1964
return ;
1966
1965
}
1967
- LOGGER .error (
1968
- "Failed to execute consumer action {} after {} attempts. Total elapsed time: {}ms" ,
1969
- action ,
1970
- action .getAttemptsCount (),
1971
- LatencyUtils .getElapsedTimeFromMsToMs (actionProcessStartTimeInMs ),
1972
- e );
1973
- // Mark action as failed since it has exhausted all the retries.
1974
- action .getFuture ().completeExceptionally (e );
1975
- // After MAX_CONSUMER_ACTION_ATTEMPTS retries we should give up and error the ingestion task.
1976
- PartitionConsumptionState state = partitionConsumptionStateMap .get (action .getPartition ());
1977
-
1978
- // Remove the action that is failed to execute recently (not necessarily the head of consumerActionsQueue).
1979
- if (consumerActionsQueue .remove (action )) {
1980
- partitionToPendingConsumerActionCountMap .get (action .getPartition ()).decrementAndGet ();
1981
- }
1982
- /**
1983
- * {@link state} can be null if the {@link OffsetRecord} from {@link storageMetadataService} was corrupted in
1984
- * {@link #processCommonConsumerAction}, so the {@link PartitionConsumptionState} was never created
1985
- */
1986
- if (state == null || !state .isCompletionReported ()) {
1987
- reportError (
1988
- "Error when processing consumer action: " + action ,
1989
- action .getPartition (),
1990
- new VeniceException (e ));
1991
- }
1992
1966
}
1993
1967
}
1994
1968
if (emitMetrics .get ()) {
1995
1969
hostLevelIngestionStats .recordProcessConsumerActionLatency (Duration .between (startTime , Instant .now ()).toMillis ());
1996
1970
}
1997
1971
}
1998
1972
1973
+ boolean handleConsumerActionsError (Throwable e , ConsumerAction action , long actionProcessStartTimeInMs ) {
1974
+ if (action .getAttemptsCount () <= MAX_CONSUMER_ACTION_ATTEMPTS ) {
1975
+ LOGGER .warn ("Failed to process consumer action {}, will retry later." , action , e );
1976
+ return false ;
1977
+ }
1978
+ LOGGER .error (
1979
+ "Failed to execute consumer action {} after {} attempts. Total elapsed time: {}ms" ,
1980
+ action ,
1981
+ action .getAttemptsCount (),
1982
+ LatencyUtils .getElapsedTimeFromMsToMs (actionProcessStartTimeInMs ),
1983
+ e );
1984
+ // Mark action as failed since it has exhausted all the retries.
1985
+ action .getFuture ().completeExceptionally (e );
1986
+ // After MAX_CONSUMER_ACTION_ATTEMPTS retries we should give up and error the ingestion task.
1987
+ PartitionConsumptionState state = partitionConsumptionStateMap .get (action .getPartition ());
1988
+
1989
+ // Remove the action that is failed to execute recently (not necessarily the head of consumerActionsQueue).
1990
+ if (consumerActionsQueue .remove (action )) {
1991
+ partitionToPendingConsumerActionCountMap .get (action .getPartition ()).decrementAndGet ();
1992
+ }
1993
+ /**
1994
+ * {@link state} can be null if the {@link OffsetRecord} from {@link storageMetadataService} was corrupted in
1995
+ * {@link #processCommonConsumerAction}, so the {@link PartitionConsumptionState} was never created
1996
+ */
1997
+ if (state == null || !state .isCompletionReported ()) {
1998
+ reportError ("Error when processing consumer action: " + action , action .getPartition (), new VeniceException (e ));
1999
+ }
2000
+ return true ;
2001
+ }
2002
+
1999
2003
/**
2000
2004
* Applies name resolution to all Kafka URLs in the provided TopicSwitch. Useful for translating URLs that came from
2001
2005
* a different runtime (e.g. from the controller, or from state persisted by a previous run of the same server).
0 commit comments