PHOENIX-2731 Ensure upgrade from 4.7.0 RCx to 4.7.0 RC5 works
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f9c8fe8d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f9c8fe8d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f9c8fe8d Branch: refs/heads/calcite Commit: f9c8fe8df68bfd3b60b2a9d4ab83ff74b1fbd3de Parents: 1c06c5d Author: James Taylor <[email protected]> Authored: Wed Mar 2 10:28:34 2016 -0800 Committer: James Taylor <[email protected]> Committed: Wed Mar 2 10:40:30 2016 -0800 ---------------------------------------------------------------------- .../java/org/apache/phoenix/coprocessor/MetaDataProtocol.java | 2 +- .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f9c8fe8d/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java index fb9d228..7a7cf31 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataProtocol.java @@ -73,7 +73,7 @@ public abstract class MetaDataProtocol extends MetaDataService { public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0 = MIN_TABLE_TIMESTAMP + 7; public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_5_0 = MIN_TABLE_TIMESTAMP + 8; public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0 = MIN_TABLE_TIMESTAMP + 9; - public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = MIN_TABLE_TIMESTAMP + 14; + public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0 = MIN_TABLE_TIMESTAMP + 15; // MIN_SYSTEM_TABLE_TIMESTAMP needs to be set to the max of all the MIN_SYSTEM_TABLE_TIMESTAMP_* constants public static final long MIN_SYSTEM_TABLE_TIMESTAMP = MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0; // TODO: pare this down to minimum, as we don't need duplicates for both table and column errors, nor should we need http://git-wip-us.apache.org/repos/asf/phoenix/blob/f9c8fe8d/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 39118a3..a473cde 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 @@ -2436,13 +2436,16 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement metaConnection.createStatement().executeUpdate( QueryConstants.CREATE_STATS_TABLE_METADATA); } catch (NewerTableAlreadyExistsException ignore) { - } catch(TableAlreadyExistsException ignore) { - metaConnection = addColumnsIfNotExists( + } catch(TableAlreadyExistsException e) { + long currentServerSideTableTimeStamp = e.getTable().getTimeStamp(); + if (currentServerSideTableTimeStamp < MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0) { + metaConnection = addColumnsIfNotExists( metaConnection, PhoenixDatabaseMetaData.SYSTEM_STATS_NAME, MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP, PhoenixDatabaseMetaData.GUIDE_POSTS_ROW_COUNT + " " + PLong.INSTANCE.getSqlTypeName()); + } } try { metaConnection.createStatement().executeUpdate(
