Class LogTruncationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.apache.kafka.common.KafkaException
org.apache.kafka.clients.consumer.InvalidOffsetException
org.apache.kafka.clients.consumer.OffsetOutOfRangeException
org.apache.kafka.clients.consumer.LogTruncationException
- All Implemented Interfaces:
- Serializable
In the event of an unclean leader election, the log will be truncated,
 previously committed data will be lost, and new data will be written
 over these offsets. When this happens, the consumer will detect the
 truncation and raise this exception (if no automatic reset policy
 has been defined) with the first offset known to diverge from what the
 consumer previously read.
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionLogTruncationException(String message, Map<TopicPartition, Long> fetchOffsets, Map<TopicPartition, OffsetAndMetadata> divergentOffsets) LogTruncationException(Map<TopicPartition, Long> fetchOffsets, Map<TopicPartition, OffsetAndMetadata> divergentOffsets) 
- 
Method SummaryModifier and TypeMethodDescriptionGet the divergent offsets for the partitions which were truncated.Methods inherited from class org.apache.kafka.clients.consumer.OffsetOutOfRangeExceptionoffsetOutOfRangePartitions, partitionsMethods inherited from class java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
- 
Constructor Details- 
LogTruncationExceptionpublic LogTruncationException(Map<TopicPartition, Long> fetchOffsets, Map<TopicPartition, OffsetAndMetadata> divergentOffsets) 
- 
LogTruncationExceptionpublic LogTruncationException(String message, Map<TopicPartition, Long> fetchOffsets, Map<TopicPartition, OffsetAndMetadata> divergentOffsets) 
 
- 
- 
Method Details- 
divergentOffsetsGet the divergent offsets for the partitions which were truncated. For each partition, this is the first offset which is known to diverge from what the consumer read. Note that there is no guarantee that this offset will be known. It is necessary to useOffsetOutOfRangeException.partitions()to see the set of partitions that were truncated and then check for the presence of a divergent offset in this map.
 
-