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/10/18 03:40:55 UTC
[3/4] git commit: PHOENIX-1365 Make sequence salt buckets configurable
PHOENIX-1365 Make sequence salt buckets configurable
Conflicts:
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cf07a5dd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cf07a5dd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cf07a5dd
Branch: refs/heads/3.0
Commit: cf07a5dd5981e0b6dbb5d1b562bd47fee32f97dc
Parents: 878570d
Author: James Taylor <jt...@salesforce.com>
Authored: Fri Oct 17 13:35:17 2014 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Fri Oct 17 18:44:13 2014 -0700
----------------------------------------------------------------------
.../phoenix/query/ConnectionQueryServicesImpl.java | 3 +--
.../java/org/apache/phoenix/schema/MetaDataClient.java | 11 +++++------
.../phoenix/schema/NewerTableAlreadyExistsException.java | 9 +++++++++
.../java/org/apache/phoenix/util/PhoenixRuntime.java | 3 +--
4 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf07a5dd/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 f1d12fc..688cf42 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
@@ -1343,8 +1343,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
} catch (NewerTableAlreadyExistsException e) {
// Ignore, as this will happen if the SYSTEM.SEQUENCE already exists at this fixed timestamp.
// A TableAlreadyExistsException is not thrown, since the table only exists *after* this fixed timestamp.
- PTable sequenceTable = ConnectionQueryServicesImpl.this.latestMetaData.getTable(new PTableKey(null, PhoenixDatabaseMetaData.SEQUENCE_FULLNAME));
- Integer sequenceSaltBuckets = sequenceTable.getBucketNum();
+ Integer sequenceSaltBuckets = e.getTable().getBucketNum();
nSequenceSaltBuckets = sequenceSaltBuckets == null ? 0 : sequenceSaltBuckets;
} catch (TableAlreadyExistsException e) {
// This will occur if we have an older SYSTEM.SEQUENCE, so we need to update it to include
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf07a5dd/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
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 e950903..712ef5c 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
@@ -1348,7 +1348,9 @@ public class MetaDataClient {
case PARENT_TABLE_NOT_FOUND:
throw new TableNotFoundException(schemaName, parent.getName().getString());
case NEWER_TABLE_FOUND:
- throw new NewerTableAlreadyExistsException(schemaName, tableName);
+ // Add table to ConnectionQueryServices so it's cached, but don't add
+ // it to this connection as we can't see it.
+ throw new NewerTableAlreadyExistsException(schemaName, tableName, result.getTable());
case UNALLOWED_TABLE_MUTATION:
throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_MUTATE_TABLE)
.setSchemaName(schemaName).setTableName(tableName).build().buildException();
@@ -1468,7 +1470,7 @@ public class MetaDataClient {
}
break;
case NEWER_TABLE_FOUND:
- throw new NewerTableAlreadyExistsException(schemaName, tableName);
+ throw new NewerTableAlreadyExistsException(schemaName, tableName, result.getTable());
case UNALLOWED_TABLE_MUTATION:
throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_MUTATE_TABLE)
.setSchemaName(schemaName).setTableName(tableName).build().buildException();
@@ -1579,10 +1581,7 @@ public class MetaDataClient {
}
throw new ConcurrentTableMutationException(schemaName, tableName);
case NEWER_TABLE_FOUND:
- if (result.getTable() != null) {
- connection.addTable(result.getTable());
- }
- throw new NewerTableAlreadyExistsException(schemaName, tableName);
+ throw new NewerTableAlreadyExistsException(schemaName, tableName, result.getTable());
case NO_PK_COLUMNS:
throw new SQLExceptionInfo.Builder(SQLExceptionCode.PRIMARY_KEY_MISSING)
.setSchemaName(schemaName).setTableName(tableName).build().buildException();
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf07a5dd/phoenix-core/src/main/java/org/apache/phoenix/schema/NewerTableAlreadyExistsException.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/NewerTableAlreadyExistsException.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/NewerTableAlreadyExistsException.java
index c5afcec..5404485 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/NewerTableAlreadyExistsException.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/NewerTableAlreadyExistsException.java
@@ -19,9 +19,18 @@ package org.apache.phoenix.schema;
public class NewerTableAlreadyExistsException extends TableAlreadyExistsException {
private static final long serialVersionUID = 1L;
+ private final PTable table;
public NewerTableAlreadyExistsException(String schemaName, String tableName) {
+ this(schemaName, tableName, null);
+ }
+
+ public NewerTableAlreadyExistsException(String schemaName, String tableName, PTable table) {
super(schemaName, tableName);
+ this.table = table;
}
+ public PTable getTable() {
+ return table;
+ }
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf07a5dd/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
index 36c3ede..3d19692 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
@@ -61,6 +61,7 @@ import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.schema.AmbiguousColumnException;
import org.apache.phoenix.schema.ColumnNotFoundException;
import org.apache.phoenix.schema.KeyValueSchema;
+import org.apache.phoenix.schema.KeyValueSchema.KeyValueSchemaBuilder;
import org.apache.phoenix.schema.MetaDataClient;
import org.apache.phoenix.schema.PColumn;
import org.apache.phoenix.schema.PColumnFamily;
@@ -70,10 +71,8 @@ import org.apache.phoenix.schema.PTableKey;
import org.apache.phoenix.schema.PTableType;
import org.apache.phoenix.schema.RowKeySchema;
import org.apache.phoenix.schema.TableNotFoundException;
-import org.apache.phoenix.schema.KeyValueSchema.KeyValueSchemaBuilder;
import org.apache.phoenix.schema.ValueBitSet;
-import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;