This is an automated email from the ASF dual-hosted git repository.
stoty pushed a commit to branch 5.2
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.2 by this push:
new c3fdfab3e3 PHOENIX-7268 Namespace mapped system catalog table not
snapshotted before upgrade (#2012)
c3fdfab3e3 is described below
commit c3fdfab3e3574d7cdcf1fd82549360a4a3c63eca
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 | 4 +++-
.../phoenix/query/ConnectionQueryServicesImpl.java | 16 +++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
index a511c990b2..cd420c4ce3 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
+++
b/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixDatabaseMetaData.java
@@ -104,7 +104,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 OLD_SYSTEM_CATALOG_NAME =
SYSTEM_CATALOG_NAME.replace(QueryConstants.NAME_SEPARATOR,
QueryConstants.NAMESPACE_SEPARATOR);
+ 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-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
b/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index b05d352bc8..7ca4c42819 100644
---
a/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++
b/phoenix-core-client/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;
@@ -4336,6 +4337,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())) {
@@ -4587,9 +4597,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);