KAFKA-4163: NPE in StreamsMetadataState during re-balance operations
During rebalance operations the Cluster object gets set to Cluster.empty(). This can result in NPEs when doing certain operation on StreamsMetadataState. This should throw a StreamsException if the Cluster is empty as it is not yet (re-)initialized
Author: Damian Guy <damian.guy@gmail.com>
Reviewers: Eno Thereska, Guozhang Wang
Closes#1845 from dguy/streams-meta-hotfix
@ -48,10 +49,15 @@ public class CompositeReadOnlyKeyValueStore<K, V> implements ReadOnlyKeyValueSto
@@ -48,10 +49,15 @@ public class CompositeReadOnlyKeyValueStore<K, V> implements ReadOnlyKeyValueSto
thrownewInvalidStateStoreException("State store is not available anymore and may have been migrated to another instance; please re-discover its location from the state metadata.");
}
}
returnnull;
}
@ -61,7 +67,11 @@ public class CompositeReadOnlyKeyValueStore<K, V> implements ReadOnlyKeyValueSto
@@ -61,7 +67,11 @@ public class CompositeReadOnlyKeyValueStore<K, V> implements ReadOnlyKeyValueSto
thrownewInvalidStateStoreException("State store is not available anymore and may have been migrated to another instance; please re-discover its location from the state metadata.");
@ -73,7 +83,11 @@ public class CompositeReadOnlyKeyValueStore<K, V> implements ReadOnlyKeyValueSto
@@ -73,7 +83,11 @@ public class CompositeReadOnlyKeyValueStore<K, V> implements ReadOnlyKeyValueSto
thrownewInvalidStateStoreException("State store is not available anymore and may have been migrated to another instance; please re-discover its location from the state metadata.");
@ -44,11 +45,15 @@ public class CompositeReadOnlyWindowStore<K, V> implements ReadOnlyWindowStore<K
@@ -44,11 +45,15 @@ public class CompositeReadOnlyWindowStore<K, V> implements ReadOnlyWindowStore<K
thrownewInvalidStateStoreException("State store is not available anymore and may have been migrated to another instance; please re-discover its location from the state metadata.");
@ -39,14 +39,14 @@ public class StreamThreadStateStoreProvider implements StateStoreProvider {
@@ -39,14 +39,14 @@ public class StreamThreadStateStoreProvider implements StateStoreProvider {
@ -48,8 +48,7 @@ public class WrappingStoreProvider implements StateStoreProvider {
@@ -48,8 +48,7 @@ public class WrappingStoreProvider implements StateStoreProvider {
allStores.addAll(stores);
}
if(allStores.isEmpty()){
thrownewInvalidStateStoreException("Store "+storeName+" is currently "
+"unavailable");
thrownewInvalidStateStoreException("the state store, "+storeName+", may have migrated to another instance.");