mirror of https://github.com/apache/kafka.git
				
				
				
			MINOR: Improve exception messages when state stores cannot be accessed. (#4383)
This commit is contained in:
		
							parent
							
								
									d63f94797c
								
							
						
					
					
						commit
						e1c407973f
					
				|  | @ -45,14 +45,16 @@ public class StreamThreadStateStoreProvider implements StateStoreProvider { | ||||||
|             return Collections.emptyList(); |             return Collections.emptyList(); | ||||||
|         } |         } | ||||||
|         if (!streamThread.isRunningAndNotRebalancing()) { |         if (!streamThread.isRunningAndNotRebalancing()) { | ||||||
|             throw new InvalidStateStoreException("the state store, " + storeName + ", may have migrated to another instance."); |             throw new InvalidStateStoreException("Cannot get state store " + storeName + " because the stream thread is " + | ||||||
|  |                     streamThread.state() + ", not RUNNING"); | ||||||
|         } |         } | ||||||
|         final List<T> stores = new ArrayList<>(); |         final List<T> stores = new ArrayList<>(); | ||||||
|         for (Task streamTask : streamThread.tasks().values()) { |         for (Task streamTask : streamThread.tasks().values()) { | ||||||
|             final StateStore store = streamTask.getStore(storeName); |             final StateStore store = streamTask.getStore(storeName); | ||||||
|             if (store != null && queryableStoreType.accepts(store)) { |             if (store != null && queryableStoreType.accepts(store)) { | ||||||
|                 if (!store.isOpen()) { |                 if (!store.isOpen()) { | ||||||
|                     throw new InvalidStateStoreException("the state store, " + storeName + ", may have migrated to another instance."); |                     throw new InvalidStateStoreException("Cannot get state store " + storeName + " for task " + streamTask + | ||||||
|  |                             " because the store is not open. The state store may have migrated to another instances."); | ||||||
|                 } |                 } | ||||||
|                 stores.add((T) store); |                 stores.add((T) store); | ||||||
|             } |             } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue