You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2016/04/25 20:53:00 UTC
[16/52] [abbrv] phoenix git commit: PHOENIX-2830 Upgrade code fails
when upgrading from a version before 4.3
PHOENIX-2830 Upgrade code fails when upgrading from a version before 4.3
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4efb4ddf
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4efb4ddf
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4efb4ddf
Branch: refs/heads/encodecolumns
Commit: 4efb4ddffc7f3065a22dc662baea7a796945de4f
Parents: fccbe56
Author: Samarth <sa...@salesforce.com>
Authored: Mon Apr 11 14:02:44 2016 -0700
Committer: Samarth <sa...@salesforce.com>
Committed: Mon Apr 11 14:02:44 2016 -0700
----------------------------------------------------------------------
.../phoenix/query/ConnectionQueryServicesImpl.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/4efb4ddf/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
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 a8595e9..ebc62de 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
@@ -2284,7 +2284,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
String columnsToAdd = "";
if(currentServerSideTableTimeStamp < MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0) {
// We know that we always need to add the STORE_NULLS column for 4.3 release
- columnsToAdd += "," + PhoenixDatabaseMetaData.STORE_NULLS + " " + PBoolean.INSTANCE.getSqlTypeName();
+ columnsToAdd = addColumn(columnsToAdd, PhoenixDatabaseMetaData.STORE_NULLS + " " + PBoolean.INSTANCE.getSqlTypeName());
try (HBaseAdmin admin = getAdmin()) {
HTableDescriptor[] localIndexTables = admin.listTables(MetaDataUtil.LOCAL_INDEX_TABLE_PREFIX+".*");
for (HTableDescriptor table : localIndexTables) {
@@ -2310,8 +2310,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
// we should just have a ALTER TABLE ADD IF NOT EXISTS statement with all
// the column names that have been added to SYSTEM.CATALOG since 4.0.
if (currentServerSideTableTimeStamp < MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0) {
- columnsToAdd += ", " + PhoenixDatabaseMetaData.INDEX_TYPE + " " + PUnsignedTinyint.INSTANCE.getSqlTypeName()
- + ", " + PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP + " " + PLong.INSTANCE.getSqlTypeName();
+ columnsToAdd = addColumn(columnsToAdd, PhoenixDatabaseMetaData.INDEX_TYPE + " " + PUnsignedTinyint.INSTANCE.getSqlTypeName()
+ + ", " + PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP + " " + PLong.INSTANCE.getSqlTypeName());
}
// If we have some new columns from 4.1-4.3 to add, add them now.
@@ -2486,6 +2486,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
}
+ private String addColumn(String columnsToAddSoFar, String columns) {
+ if (columnsToAddSoFar == null || columnsToAddSoFar.isEmpty()) {
+ return columns;
+ } else {
+ return columnsToAddSoFar + ", " + columns;
+ }
+ }
+
private void scheduleRenewLeaseTasks() {
if (isRenewingLeasesEnabled()) {
ThreadFactory threadFactory =