Chia-Ping Tsai created KAFKA-21432:
--------------------------------------
Summary: RemotePartitionMetadataStore#getRemoteLogMetadataCache
should throw RemoteStorageNotReadyException instead of
ReplicaNotAvailableException
Key: KAFKA-21432
URL: https://issues.apache.org/jira/browse/KAFKA-21432
Project: Kafka
Issue Type: Improvement
Reporter: Chia-Ping Tsai
I noticed this when reviewing KIP-1385. The callers of
`getRemoteLogMetadataCache` declare `throws RemoteStorageException`, but
`ReplicaNotAvailableException` is not a subclass of it. That means we can't
just catch `RemoteStorageException` to handle this retriable error.
{code:java}
if (!remoteLogMetadataCache.isInitialized()) {
try {
boolean initialized =
remoteLogMetadataCache.awaitInitialized(100, TimeUnit.MILLISECONDS);
if (!initialized) {
// Throwing a retriable ReplicaNotAvailableException here
for clients retry.
throw new ReplicaNotAvailableException("Remote log metadata
cache is not initialized for partition: " + topicIdPartition);
}
} catch (InterruptedException ex) {
throw new RemoteResourceNotFoundException("Couldn't initialize
remote log metadata cache for partition: " + topicIdPartition);
}
}
{code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)