From 4b957e8a91b1ebb9810721f5e87c872374fb49f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Pe=C3=B1a?= Date: Wed, 2 Dec 2020 14:15:51 -0600 Subject: [PATCH] fix: change locate() error message for a more user-friendly message --- .../ksql/execution/streams/materialization/ks/KsLocator.java | 5 +++-- .../execution/streams/materialization/ks/KsLocatorTest.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ksqldb-streams/src/main/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocator.java b/ksqldb-streams/src/main/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocator.java index 876457dc2d6..5d85c22007c 100644 --- a/ksqldb-streams/src/main/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocator.java +++ b/ksqldb-streams/src/main/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocator.java @@ -89,10 +89,11 @@ public List locate( // Fail fast if Streams not ready. Let client handle it if (metadata == KeyQueryMetadata.NOT_AVAILABLE) { - LOG.debug("KeyQueryMetadata not available for state store {} and key {}", + LOG.debug("KeyQueryMetadata not available for state store '{}' and key {}", stateStoreName, key); throw new MaterializationException(String.format( - "KeyQueryMetadata not available for state store %s and key %s", stateStoreName, key)); + "Materialized data for key %s is not available yet. " + + "Please try again later.", key)); } LOG.debug("Handling pull query for key {} in partition {} of state store {}.", diff --git a/ksqldb-streams/src/test/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocatorTest.java b/ksqldb-streams/src/test/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocatorTest.java index 75892e57f14..091e9d48acb 100644 --- a/ksqldb-streams/src/test/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocatorTest.java +++ b/ksqldb-streams/src/test/java/io/confluent/ksql/execution/streams/materialization/ks/KsLocatorTest.java @@ -164,7 +164,7 @@ public void shouldThrowIfMetadataNotAvailable() { // Then: assertThat(e.getMessage(), containsString( - "KeyQueryMetadata not available for state store someStoreName and key [1]")); + "Materialized data for key [1] is not available yet. Please try again later.")); } @Test