You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2021/09/08 10:32:44 UTC
[phoenix] branch 5.1 updated: PHOENIX-6534 Upgrades from pre 4.10
versions are broken
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 35d6de3 PHOENIX-6534 Upgrades from pre 4.10 versions are broken
35d6de3 is described below
commit 35d6de3ebfaa43d9d0256928980401557038ee83
Author: Istvan Toth <st...@apache.org>
AuthorDate: Tue Sep 7 18:24:21 2021 +0200
PHOENIX-6534 Upgrades from pre 4.10 versions are broken
---
.../java/org/apache/phoenix/schema/MetaDataClient.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 27d5d5f..a64c340 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -957,12 +957,15 @@ public class MetaDataClient {
} else {
colUpsert.setString(18, column.getExpressionStr());
}
- if (column.getColumnQualifierBytes() == null) {
- colUpsert.setNull(19, Types.VARBINARY);
- } else {
- colUpsert.setBytes(19, column.getColumnQualifierBytes());
+ //Do not try to set extra columns when using ALTER_SYSCATALOG_TABLE_UPGRADE
+ if (colUpsert.getParameterMetaData().getParameterCount() > 18) {
+ if (column.getColumnQualifierBytes() == null) {
+ colUpsert.setNull(19, Types.VARBINARY);
+ } else {
+ colUpsert.setBytes(19, column.getColumnQualifierBytes());
+ }
+ colUpsert.setBoolean(20, column.isRowTimestamp());
}
- colUpsert.setBoolean(20, column.isRowTimestamp());
colUpsert.execute();
}
@@ -3890,7 +3893,10 @@ public class MetaDataClient {
Map<String, Integer> changedCqCounters = new HashMap<>(numCols);
if (numCols > 0 ) {
StatementContext context = new StatementContext(new PhoenixStatement(connection), resolver);
- String addColumnSqlToUse = INSERT_COLUMN_CREATE_TABLE;
+ String addColumnSqlToUse = connection.isRunningUpgrade()
+ && tableName.equals(PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE)
+ && schemaName.equals(PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA) ? ALTER_SYSCATALOG_TABLE_UPGRADE
+ : INSERT_COLUMN_CREATE_TABLE;
try (PreparedStatement colUpsert = connection.prepareStatement(addColumnSqlToUse)) {
short nextKeySeq = SchemaUtil.getMaxKeySeq(table);
for ( ColumnDef colDef : columnDefs) {