This is an automated email from the ASF dual-hosted git repository.
shahrs87 pushed a commit to branch PHOENIX-6883-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/PHOENIX-6883-feature by this
push:
new d6a6147453 PHOENIX-7307 : Client should refresh its metadata cache
before running EXPLAIN if last_ddl_timestamp validation is enabled (#1881)
d6a6147453 is described below
commit d6a6147453e0b1664b72f2477d7e68b12ed735fd
Author: palash <[email protected]>
AuthorDate: Wed Apr 17 11:13:33 2024 -0700
PHOENIX-7307 : Client should refresh its metadata cache before running
EXPLAIN if last_ddl_timestamp validation is enabled (#1881)
---
.../main/java/org/apache/phoenix/jdbc/PhoenixStatement.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index c3c52255d2..897de9350a 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -867,6 +867,19 @@ public class PhoenixStatement implements
PhoenixMonitoredStatement, SQLCloseable
public QueryPlan compilePlan(PhoenixStatement stmt, Sequence.ValueOp
seqAction) throws SQLException {
CompilableStatement compilableStmt = getStatement();
StatementPlan compilePlan = compilableStmt.compilePlan(stmt,
Sequence.ValueOp.VALIDATE_SEQUENCE);
+ // if client is validating timestamps, ensure its metadata cache
is up to date.
+ if (ValidateLastDDLTimestampUtil
+ .getValidateLastDdlTimestampEnabled(stmt.getConnection()))
{
+ Set<TableRef> tableRefs = compilePlan.getSourceRefs();
+ for (TableRef tableRef : tableRefs) {
+ new MetaDataClient(stmt.getConnection()).updateCache(
+ stmt.getConnection().getTenantId(),
+ tableRef.getTable().getSchemaName().getString(),
+ tableRef.getTable().getTableName().getString(),
+ true);
+ }
+ compilePlan = compilableStmt.compilePlan(stmt,
Sequence.ValueOp.VALIDATE_SEQUENCE);
+ }
// For a QueryPlan, we need to get its optimized plan; for a
MutationPlan, its enclosed QueryPlan
// has already been optimized during compilation.
if (compilePlan instanceof QueryPlan) {