You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2014/11/26 06:58:25 UTC
phoenix git commit: PHOENIX-1473 Connecting with Phoenix client when
Phoenix is not deployed on region server(s) takes down region server(s)
Repository: phoenix
Updated Branches:
refs/heads/4.2 09211a050 -> 383e484bc
PHOENIX-1473 Connecting with Phoenix client when Phoenix is not deployed on region server(s) takes down region server(s)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/383e484b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/383e484b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/383e484b
Branch: refs/heads/4.2
Commit: 383e484bcef70d5b2ac1e07877ba13e4645aab23
Parents: 09211a0
Author: James Taylor <jt...@salesforce.com>
Authored: Tue Nov 25 21:03:58 2014 -0800
Committer: James Taylor <jt...@salesforce.com>
Committed: Tue Nov 25 21:03:58 2014 -0800
----------------------------------------------------------------------
.../query/ConnectionQueryServicesImpl.java | 38 ++++++++++++++++++--
.../org/apache/phoenix/query/QueryServices.java | 1 +
.../phoenix/query/QueryServicesOptions.java | 12 +++++--
3 files changed, 47 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/383e484b/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 b73e2dc..8bd99b3 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
@@ -107,6 +107,7 @@ import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.ConnectionInfo;
import org.apache.phoenix.protobuf.ProtobufUtil;
import org.apache.phoenix.schema.EmptySequenceCacheException;
+import org.apache.phoenix.schema.MetaDataSplitPolicy;
import org.apache.phoenix.schema.NewerTableAlreadyExistsException;
import org.apache.phoenix.schema.PColumn;
import org.apache.phoenix.schema.PColumnFamily;
@@ -476,6 +477,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
latestMetaDataLock.wait(waitTime);
} catch (InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
throw new SQLExceptionInfo.Builder(SQLExceptionCode.INTERRUPTED_EXCEPTION)
.setRootCause(e).build().buildException(); // FIXME
}
@@ -733,6 +736,12 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
}
+ private boolean allowOnlineTableSchemaUpdate() {
+ return props.getBoolean(
+ QueryServices.ALLOW_ONLINE_TABLE_SCHEMA_UPDATE,
+ QueryServicesOptions.DEFAULT_ALLOW_ONLINE_TABLE_SCHEMA_UPDATE);
+ }
+
/**
*
* @param tableName
@@ -770,6 +779,10 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
if (newDesc.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES) != null && Boolean.TRUE.equals(PDataType.BOOLEAN.toObject(newDesc.getValue(MetaDataUtil.IS_LOCAL_INDEX_TABLE_PROP_BYTES)))) {
newDesc.setValue(HTableDescriptor.SPLIT_POLICY, IndexRegionSplitPolicy.class.getName());
}
+ // Remove the splitPolicy attribute to prevent HBASE-12570
+ if (isMetaTable) {
+ newDesc.remove(HTableDescriptor.SPLIT_POLICY);
+ }
try {
if (splits == null) {
admin.createTable(newDesc);
@@ -783,6 +796,20 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
if (isMetaTable) {
checkClientServerCompatibility();
+ /*
+ * Now we modify the table to add the split policy, since we know that the client and
+ * server and compatible. This works around HBASE-12570 which causes the cluster to be
+ * brought down.
+ */
+ newDesc.setValue(HTableDescriptor.SPLIT_POLICY, MetaDataSplitPolicy.class.getName());
+ if (allowOnlineTableSchemaUpdate()) {
+ // No need to wait/poll for this update
+ admin.modifyTable(tableName, newDesc);
+ } else {
+ admin.disableTable(tableName);
+ admin.modifyTable(tableName, newDesc);
+ admin.enableTable(tableName);
+ }
}
return null;
} else {
@@ -798,7 +825,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
admin.disableTable(tableName);
admin.modifyTable(tableName, newDesc);
admin.enableTable(tableName);
-
return newDesc;
}
@@ -823,7 +849,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
return null; // will never make it here
}
-
+
private static boolean isInvalidMutableIndexConfig(Long serverVersion) {
if (serverVersion == null) {
return false;
@@ -1671,6 +1697,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
} catch (IOException e) {
throw new PhoenixIOException(e);
} catch (InterruptedException e) {
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
throw new SQLExceptionInfo.Builder(SQLExceptionCode.INTERRUPTED_EXCEPTION).setRootCause(e).build()
.buildException();
} finally {
@@ -1861,6 +1889,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
} catch (IOException e){
sqlE = ServerUtil.parseServerException(e);
} catch (InterruptedException e){
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
sqlE = new SQLExceptionInfo.Builder(SQLExceptionCode.INTERRUPTED_EXCEPTION)
.setRootCause(e).build().buildException(); // FIXME ?
} finally {
@@ -1980,6 +2010,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
} catch (IOException e){
sqlE = ServerUtil.parseServerException(e);
} catch (InterruptedException e){
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
sqlE = new SQLExceptionInfo.Builder(SQLExceptionCode.INTERRUPTED_EXCEPTION)
.setRootCause(e).build().buildException(); // FIXME ?
} finally {
@@ -2030,6 +2062,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
} catch (IOException e){
sqlE = ServerUtil.parseServerException(e);
} catch (InterruptedException e){
+ // restore the interrupt status
+ Thread.currentThread().interrupt();
sqlE = new SQLExceptionInfo.Builder(SQLExceptionCode.INTERRUPTED_EXCEPTION)
.setRootCause(e).build().buildException(); // FIXME ?
} finally {
http://git-wip-us.apache.org/repos/asf/phoenix/blob/383e484b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
index ab1a8e5..a0c7f73 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServices.java
@@ -141,6 +141,7 @@ public interface QueryServices extends SQLCloseable {
public static final String SEQUENCE_SALT_BUCKETS_ATTRIB = "phoenix.sequence.saltBuckets";
public static final String COPROCESSOR_PRIORITY_ATTRIB = "phoenix.coprocessor.priority";
public static final String EXPLAIN_CHUNK_COUNT_ATTRIB = "phoenix.explain.displayChunkCount";
+ public static final String ALLOW_ONLINE_TABLE_SCHEMA_UPDATE = "hbase.online.schema.update.enable";
/**
* Get executor service used for parallel scans
http://git-wip-us.apache.org/repos/asf/phoenix/blob/383e484b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
index 460b199..615d61c 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryServicesOptions.java
@@ -17,6 +17,7 @@
*/
package org.apache.phoenix.query;
+import static org.apache.phoenix.query.QueryServices.ALLOW_ONLINE_TABLE_SCHEMA_UPDATE;
import static org.apache.phoenix.query.QueryServices.CALL_QUEUE_PRODUCER_ATTRIB_NAME;
import static org.apache.phoenix.query.QueryServices.CALL_QUEUE_ROUND_ROBIN_ATTRIB;
import static org.apache.phoenix.query.QueryServices.DATE_FORMAT_ATTRIB;
@@ -167,7 +168,8 @@ public class QueryServicesOptions {
*/
public static final int DEFAULT_COPROCESSOR_PRIORITY = Coprocessor.PRIORITY_SYSTEM/2 + Coprocessor.PRIORITY_USER/2; // Divide individually to prevent any overflow
public static final boolean DEFAULT_EXPLAIN_CHUNK_COUNT = true;
-
+ public static final boolean DEFAULT_ALLOW_ONLINE_TABLE_SCHEMA_UPDATE = true;
+
private final Configuration config;
private QueryServicesOptions(Configuration config) {
@@ -215,6 +217,7 @@ public class QueryServicesOptions {
.setIfUnset(GROUPBY_SPILL_FILES_ATTRIB, DEFAULT_GROUPBY_SPILL_FILES)
.setIfUnset(SEQUENCE_CACHE_SIZE_ATTRIB, DEFAULT_SEQUENCE_CACHE_SIZE)
.setIfUnset(SCAN_RESULT_CHUNK_SIZE, DEFAULT_SCAN_RESULT_CHUNK_SIZE)
+ .setIfUnset(ALLOW_ONLINE_TABLE_SCHEMA_UPDATE, DEFAULT_ALLOW_ONLINE_TABLE_SCHEMA_UPDATE)
;
// HBase sets this to 1, so we reset it to something more appropriate.
// Hopefully HBase will change this, because we can't know if a user set
@@ -413,7 +416,7 @@ public class QueryServicesOptions {
public int getSpillableGroupByNumSpillFiles() {
return config.getInt(GROUPBY_SPILL_FILES_ATTRIB, DEFAULT_GROUPBY_SPILL_FILES);
}
-
+
public QueryServicesOptions setMaxServerCacheTTLMs(int ttl) {
return set(MAX_SERVER_CACHE_TIME_TO_LIVE_MS_ATTRIB, ttl);
}
@@ -468,4 +471,9 @@ public class QueryServicesOptions {
return this;
}
+ public QueryServicesOptions setAllowOnlineSchemaUpdate(boolean allow) {
+ config.setBoolean(ALLOW_ONLINE_TABLE_SCHEMA_UPDATE, allow);
+ return this;
+ }
+
}