This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch 5.1
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push:
new 3e94492d8f PHOENIX-7268 Namespace mapped system catalog table not
snapshotted before upgrade (#2012)
3e94492d8f is described below
commit 3e94492d8f359cf2ff4a86b35799c9349d39402e
Author: szucsvillo <[email protected]>
AuthorDate: Sun Oct 27 08:26:34 2024 +0100
PHOENIX-7268 Namespace mapped system catalog table not snapshotted before
upgrade (#2012)
---
.../org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java | 3 +++
.../phoenix/query/ConnectionQueryServicesImpl.java | 16 +++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index 34a2946359..0aa5f08c4e 100644
---
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -105,6 +105,9 @@ public class PhoenixDatabaseMetaData implements
DatabaseMetaData {
public static final String SYSTEM_CATALOG = SYSTEM_CATALOG_SCHEMA + ".\""
+ SYSTEM_CATALOG_TABLE + "\"";
public static final String SYSTEM_CATALOG_NAME =
SchemaUtil.getTableName(SYSTEM_CATALOG_SCHEMA,
SYSTEM_CATALOG_TABLE);
+ public static final String MAPPED_SYSTEM_CATALOG_NAME =
+ SYSTEM_CATALOG_NAME.replace(QueryConstants.NAME_SEPARATOR,
+ QueryConstants.NAMESPACE_SEPARATOR);
public static final TableName SYSTEM_CATALOG_HBASE_TABLE_NAME =
TableName.valueOf(SYSTEM_CATALOG_NAME);
public static final byte[] SYSTEM_CATALOG_NAME_BYTES =
Bytes.toBytes(SYSTEM_CATALOG_NAME);
public static final String SYSTEM_STATS_TABLE = "STATS";
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index def7f84bab..b6adfe07a1 100644
---
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -41,6 +41,7 @@ import static
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAM
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_ROW_TIMESTAMP;
import static
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_VIEW_REFERENCED;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.KEY_SEQ;
+import static
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.MAPPED_SYSTEM_CATALOG_NAME;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.NULLABLE;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ORDINAL_POSITION;
import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.PK_NAME;
@@ -4086,6 +4087,15 @@ public class ConnectionQueryServicesImpl extends
DelegateQueryServices implement
systemTableToSnapshotMap.put(SYSTEM_CATALOG_NAME,
snapshotName);
LOGGER.info("Created snapshot {} for {}", snapshotName,
SYSTEM_CATALOG_NAME);
+ // Snapshot qualifiers may only contain 'alphanumeric
characters' and
+ // digits, hence : cannot be part of snapshot name
+ String mappedSnapshotName =
getSysTableSnapshotName(currentServerSideTableTimeStamp,
+ "MAPPED." + SYSTEM_CATALOG_NAME);
+ createSnapshot(mappedSnapshotName, MAPPED_SYSTEM_CATALOG_NAME);
+ systemTableToSnapshotMap.put(MAPPED_SYSTEM_CATALOG_NAME,
mappedSnapshotName);
+ LOGGER.info("Created snapshot {} for {}",
+ mappedSnapshotName, MAPPED_SYSTEM_CATALOG_NAME);
+
if (caughtUpgradeRequiredException != null) {
if (SchemaUtil.isNamespaceMappingEnabled(
PTableType.SYSTEM,
ConnectionQueryServicesImpl.this.getProps())) {
@@ -4330,9 +4340,9 @@ public class ConnectionQueryServicesImpl extends
DelegateQueryServices implement
// Snapshot qualifiers may only contain 'alphanumeric characters' and
// digits, hence : cannot be part of snapshot name
if (snapshotName.contains(QueryConstants.NAMESPACE_SEPARATOR)) {
- snapshotName = snapshotName.replace(
- QueryConstants.NAMESPACE_SEPARATOR,
- QueryConstants.NAME_SEPARATOR);
+ snapshotName = getSysTableSnapshotName(
+ currentServerSideTableTimeStamp, "MAPPED." + tableName).
+ replace(QueryConstants.NAMESPACE_SEPARATOR,
QueryConstants.NAME_SEPARATOR);
}
createSnapshot(snapshotName, tableName);
systemTableToSnapshotMap.put(tableName, snapshotName);