phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [1/4] git commit: PHOENIX-1365 Make sequence salt buckets configurable
Date Sat, 18 Oct 2014 01:18:20 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.0 183b6ec04 -> 19d02fa5f


PHOENIX-1365 Make sequence salt buckets configurable


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

Branch: refs/heads/4.0
Commit: cc382992f32a7754133b59e8083ece4e1ff3d47c
Parents: 183b6ec
Author: James Taylor <jtaylor@salesforce.com>
Authored: Fri Oct 17 13:35:17 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Fri Oct 17 13:37:52 2014 -0700

----------------------------------------------------------------------
 .../phoenix/query/ConnectionQueryServicesImpl.java    |  3 +--
 .../org/apache/phoenix/schema/MetaDataClient.java     | 14 ++++++++------
 .../schema/NewerTableAlreadyExistsException.java      |  9 +++++++++
 3 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc382992/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 8a9e4c8..fe3ae0a 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
@@ -1531,8 +1531,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/cc382992/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 92fca0c..12a11bc 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
@@ -1461,7 +1461,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();
@@ -1588,7 +1590,7 @@ public class MetaDataClient {
                 if (!ifExists) { throw new TableNotFoundException(schemaName, tableName);
}
                 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)
 
@@ -1724,10 +1726,10 @@ 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);
+//            if (result.getTable() != null) {
+//                connection.addTable(result.getTable());
+//            }
+            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/cc382992/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;
+    }
 }


Mime
View raw message