You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sh...@apache.org on 2024/01/08 17:47:26 UTC
(phoenix) branch PHOENIX-6883-feature updated: PHOENIX-7167 : Bootstrap LAST_DDL_TIMESTAMP for SYSTEM.CATALOG PTable object (#1779)
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 01e29020c2 PHOENIX-7167 : Bootstrap LAST_DDL_TIMESTAMP for SYSTEM.CATALOG PTable object (#1779)
01e29020c2 is described below
commit 01e29020c29bad15b0c7a7636275ca5cc697b569
Author: palash <pa...@gmail.com>
AuthorDate: Mon Jan 8 09:47:19 2024 -0800
PHOENIX-7167 : Bootstrap LAST_DDL_TIMESTAMP for SYSTEM.CATALOG PTable object (#1779)
---
.../phoenix/coprocessor/MetaDataEndpointImpl.java | 6 ++++++
.../apache/phoenix/cache/ServerMetadataCacheTest.java | 19 +++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index 50ffb9c07b..352ba5d969 100644
--- a/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -2506,6 +2506,12 @@ TABLE_FAMILY_BYTES, TABLE_SEQ_NUM_BYTES);
builder.setMutationTime(currentTimeStamp);
//send the newly built table back because we generated the DDL timestamp server
// side and the client doesn't have it.
+ if (clientTimeStamp != HConstants.LATEST_TIMESTAMP) {
+ // if a client uses a connection with currentSCN=t to create the table,
+ // the table is created with timestamp 't' but the timestamp range in the scan
+ // used by buildTable does not include 't' due to how SCN is implemented.
+ clientTimeStamp += 1;
+ }
PTable newTable = buildTable(tableKey, cacheKey, region,
clientTimeStamp, clientVersion);
if (newTable != null) {
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
index cc9d2f49c5..f857b670c8 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/cache/ServerMetadataCacheTest.java
@@ -803,6 +803,25 @@ public class ServerMetadataCacheTest extends ParallelStatsDisabledIT {
}
}
+ /**
+ * https://issues.apache.org/jira/browse/PHOENIX-7167
+ * Use the default connection to query system tables to confirm
+ * that the PTable object for SYSTEM tables is correctly bootstrapped.
+ */
+ @Test
+ public void testSystemTablesBootstrap() throws Exception {
+ Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+ String url = QueryUtil.getConnectionUrl(props, config);
+ ConnectionQueryServices cqs = driver.getConnectionQueryServices(url, props);
+
+ try (Connection conn = cqs.connect(url, props)) {
+ query(conn, PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME);
+ query(conn, PhoenixDatabaseMetaData.SYSTEM_TASK_NAME);
+ query(conn, PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_NAME);
+ query(conn, PhoenixDatabaseMetaData.SYSTEM_LOG_NAME);
+ }
+ }
+
/**
* Test query on index with stale last ddl timestamp.
* Client-1 creates a table and an index on it. Client-2 queries table to populate its cache.