From 612b7db3954deeb690516bf902c5424971268472 Mon Sep 17 00:00:00 2001 From: Yuya Ebihara Date: Tue, 22 Feb 2022 12:37:16 +0900 Subject: [PATCH] Fix metadata listing failure in case of concurrent table deletion in Phoenix --- .../src/main/java/io/trino/plugin/phoenix/PhoenixClient.java | 4 ++++ .../src/main/java/io/trino/plugin/phoenix5/PhoenixClient.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixClient.java b/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixClient.java index 98ab578ab58f..6abbfbfdf75c 100644 --- a/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixClient.java +++ b/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixClient.java @@ -703,6 +703,10 @@ public Map getTableProperties(ConnectorSession session, JdbcTabl } } } + catch (org.apache.phoenix.schema.TableNotFoundException e) { + // Rethrow as Trino TableNotFoundException to suppress the exception during listing information_schema + throw new io.trino.spi.connector.TableNotFoundException(new SchemaTableName(handle.getSchemaName(), handle.getTableName())); + } catch (IOException | SQLException e) { throw new TrinoException(PHOENIX_METADATA_ERROR, "Couldn't get Phoenix table properties", e); } diff --git a/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixClient.java b/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixClient.java index 89434e2e22dd..7a04682ccddb 100644 --- a/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixClient.java +++ b/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixClient.java @@ -695,6 +695,10 @@ public Map getTableProperties(ConnectorSession session, JdbcTabl } } } + catch (org.apache.phoenix.schema.TableNotFoundException e) { + // Rethrow as Trino TableNotFoundException to suppress the exception during listing information_schema + throw new io.trino.spi.connector.TableNotFoundException(new SchemaTableName(handle.getSchemaName(), handle.getTableName())); + } catch (IOException | SQLException e) { throw new TrinoException(PHOENIX_METADATA_ERROR, "Couldn't get Phoenix table properties", e); }