phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-22 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.0 cb6787894 -> 62ee84eff


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/62ee84ef
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/62ee84ef
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/62ee84ef

Branch: refs/heads/4.8-HBase-1.0
Commit: 62ee84eff374130d9aba1dcc4a3d931fd413ed6c
Parents: cb67878
Author: Samarth 
Authored: Thu Sep 22 15:43:46 2016 -0700
Committer: Samarth 
Committed: Thu Sep 22 15:43:46 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  36 ++-
 .../phoenix/exception/SQLExceptionCode.java |   5 +-
 .../query/ConnectionQueryServicesImpl.java  | 289 +++
 .../apache/phoenix/query/QueryConstants.java|   3 +-
 .../org/apache/phoenix/util/UpgradeUtil.java|  18 +-
 5 files changed, 280 insertions(+), 71 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/62ee84ef/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 8982fe7..04bef92 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
@@ -20,6 +20,8 @@ package org.apache.phoenix.coprocessor;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -61,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -81,8 +83,26 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 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 + 15;
 public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0 = 
MIN_TABLE_TIMESTAMP + 18;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1 = 
MIN_TABLE_TIMESTAMP + 18;
 // 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_8_0;
+public static final long MIN_SYSTEM_TABLE_TIMESTAMP = 
MIN_SYSTEM_TABLE_TIMESTAMP_4_8_1;
+
+// ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
+// Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
+static {
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_1, "4.2.1");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_3_0, "4.3.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_5_0, "4.5.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_6_0, "4.6.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
+TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
+}
+
+public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
+
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
 // a different code for every type of error.
 // ENTITY_ALREADY_EXISTS, ENTITY_NOT_FOUND, NEWER_ENTITY_FOUND, 
ENTITY_NOT_IN_REGION, CONCURRENT_MODIFICATION
@@ -382,4 +402,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
-}
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to ru

[13/47] phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-20 Thread maryannxue
PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/df0d6117
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/df0d6117
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/df0d6117

Branch: refs/heads/calcite
Commit: df0d61179a97881b8b72595af198dbb346adfb9f
Parents: 36d500c
Author: Samarth 
Authored: Thu Sep 8 20:20:59 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 20:20:59 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 244 +++
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 164 insertions(+), 107 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/df0d6117/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/df0d6117/phoenix-core/src/main/java/org/apache/phoenix/exception/SQLExceptionCode.java

phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-08 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/master 36d500cb8 -> df0d61179


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/df0d6117
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/df0d6117
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/df0d6117

Branch: refs/heads/master
Commit: df0d61179a97881b8b72595af198dbb346adfb9f
Parents: 36d500c
Author: Samarth 
Authored: Thu Sep 8 20:20:59 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 20:20:59 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 244 +++
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 164 insertions(+), 107 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/df0d6117/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/df0d6117/phoenix-core/src/mai

phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-08 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 6d1f47438 -> 43b3ba8d6


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/43b3ba8d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/43b3ba8d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/43b3ba8d

Branch: refs/heads/4.x-HBase-1.1
Commit: 43b3ba8d67ce074f4afe6e22ba75ec4a6ca98ba6
Parents: 6d1f474
Author: Samarth 
Authored: Thu Sep 8 20:14:36 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 20:14:36 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 248 +++
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 166 insertions(+), 109 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/43b3ba8d/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/43b3ba8d/phoeni

phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-08 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 bbb3e9119 -> 18a0ef53b


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/18a0ef53
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/18a0ef53
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/18a0ef53

Branch: refs/heads/4.x-HBase-0.98
Commit: 18a0ef53b71be885af4cb2b5d4d1c77050db83e6
Parents: bbb3e91
Author: Samarth 
Authored: Thu Sep 8 20:01:19 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 20:01:19 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 240 ---
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 166 insertions(+), 101 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/18a0ef53/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/18a0ef53/phoe

phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-08 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.2 ce3533deb -> abde6ad67


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/abde6ad6
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/abde6ad6
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/abde6ad6

Branch: refs/heads/4.8-HBase-1.2
Commit: abde6ad67808ae39769dff708b2cf653de485e58
Parents: ce3533d
Author: Samarth 
Authored: Thu Sep 8 19:49:47 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 19:49:47 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 240 ---
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 166 insertions(+), 101 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/abde6ad6/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/abde6ad6/phoeni

phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-08 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-1.1 b8540e344 -> 750e796b7


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/750e796b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/750e796b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/750e796b

Branch: refs/heads/4.8-HBase-1.1
Commit: 750e796b784d3b122fa8f8cb97ea08cd84f8a662
Parents: b8540e3
Author: Samarth 
Authored: Thu Sep 8 19:47:01 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 19:47:01 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 240 ---
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 166 insertions(+), 101 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/750e796b/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/750e796b/phoeni

phoenix git commit: PHOENIX-3230 Upgrade code running concurrently on different JVMs could make clients unusuable

2016-09-08 Thread samarth
Repository: phoenix
Updated Branches:
  refs/heads/4.8-HBase-0.98 f754ea525 -> 0fddad0f3


PHOENIX-3230 Upgrade code running concurrently on different JVMs could make 
clients unusuable


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0fddad0f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0fddad0f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0fddad0f

Branch: refs/heads/4.8-HBase-0.98
Commit: 0fddad0f3dfad8e601c61ba97c1f1de3e3a5e054
Parents: f754ea5
Author: Samarth 
Authored: Thu Sep 8 19:40:45 2016 -0700
Committer: Samarth 
Committed: Thu Sep 8 19:41:29 2016 -0700

--
 .../phoenix/coprocessor/MetaDataProtocol.java   |  20 +-
 .../phoenix/exception/SQLExceptionCode.java |   1 +
 .../query/ConnectionQueryServicesImpl.java  | 240 ---
 .../apache/phoenix/query/QueryConstants.java|   1 +
 .../org/apache/phoenix/util/UpgradeUtil.java|   5 +-
 5 files changed, 166 insertions(+), 101 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0fddad0f/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 dce89bd..20922e5 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
@@ -19,9 +19,9 @@ package org.apache.phoenix.coprocessor;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.NavigableMap;
+import java.util.TreeMap;
 
 import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos;
@@ -29,7 +29,6 @@ import 
org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataResponse;
 import org.apache.phoenix.coprocessor.generated.MetaDataProtos.MetaDataService;
 import org.apache.phoenix.coprocessor.generated.PFunctionProtos;
 import org.apache.phoenix.hbase.index.util.VersionUtil;
-import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
 import org.apache.phoenix.parse.PFunction;
 import org.apache.phoenix.parse.PSchema;
 import org.apache.phoenix.schema.PColumn;
@@ -64,7 +63,7 @@ import com.google.protobuf.ByteString;
 public abstract class MetaDataProtocol extends MetaDataService {
 public static final int PHOENIX_MAJOR_VERSION = 4;
 public static final int PHOENIX_MINOR_VERSION = 8;
-public static final int PHOENIX_PATCH_NUMBER = 0;
+public static final int PHOENIX_PATCH_NUMBER = 1;
 public static final int PHOENIX_VERSION =
 VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, 
PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER);
 
@@ -89,7 +88,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 
 // ALWAYS update this map whenever rolling out a new release (major, minor 
or patch release). 
 // Key is the SYSTEM.CATALOG timestamp for the version and value is the 
version string.
-public static final Map TIMESTAMP_VERSION_MAP = new 
HashMap<>(10);
+private static final NavigableMap TIMESTAMP_VERSION_MAP = 
new TreeMap<>();
 static {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_1_0, "4.1.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_2_0, "4.2.0");
@@ -100,6 +99,7 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_7_0, "4.7.x");
 TIMESTAMP_VERSION_MAP.put(MIN_SYSTEM_TABLE_TIMESTAMP_4_8_0, "4.8.x");
 }
+
 public static final String CURRENT_CLIENT_VERSION = PHOENIX_MAJOR_VERSION 
+ "." + PHOENIX_MINOR_VERSION + "." + PHOENIX_PATCH_NUMBER; 
 
 // TODO: pare this down to minimum, as we don't need duplicates for both 
table and column errors, nor should we need
@@ -401,4 +401,14 @@ public abstract class MetaDataProtocol extends 
MetaDataService {
 return schema;
 }
 }
+  
+public static String getVersion(long serverTimestamp) {
+/*
+ * It is possible that when clients are trying to run upgrades 
concurrently, we could be at an intermediate
+ * server timestamp. Using floorKey provides us a range based lookup 
where the timestamp range for a release is
+ * [timeStampForRelease, timestampForNextRelease).
+ */
+String version = 
TIMESTAMP_VERSION_MAP.get(TIMESTAMP_VERSION_MAP.floorKey(serverTimestamp));
+return version;
+}
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0fddad0f/phoe