phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [4/4] phoenix git commit: PHOENIX-3015 Any metadata changes may cause unpredictable result when local indexes are using
Date Wed, 22 Jun 2016 21:10:09 GMT
PHOENIX-3015 Any metadata changes may cause unpredictable result when local indexes are using


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 7b9c3498053add26f3ccb916e10bebbd0c959613
Parents: 847e90c
Author: Sergey Soldatov <ssa@apache.org>
Authored: Tue Jun 21 18:02:56 2016 -0700
Committer: Sergey Soldatov <ssa@apache.org>
Committed: Wed Jun 22 13:54:25 2016 -0700

----------------------------------------------------------------------
 .../IndexHalfStoreFileReaderGenerator.java             |  2 +-
 .../phoenix/index/PhoenixIndexFailurePolicy.java       |  2 +-
 .../java/org/apache/phoenix/util/PhoenixRuntime.java   | 13 +++++++++++++
 3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b9c3498/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
index 7b5287a..670bb82 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexHalfStoreFileReaderGenerator.java
@@ -144,7 +144,7 @@ public class IndexHalfStoreFileReaderGenerator extends BaseRegionObserver
{
             try {
                 conn = QueryUtil.getConnectionOnServer(ctx.getEnvironment().getConfiguration()).unwrap(
                             PhoenixConnection.class);
-                PTable dataTable = PhoenixRuntime.getTable(conn, tableName.getNameAsString());
+                PTable dataTable = PhoenixRuntime.getTableNoCache(conn, tableName.getNameAsString());
                 List<PTable> indexes = dataTable.getIndexes();
                 Map<ImmutableBytesWritable, IndexMaintainer> indexMaintainers =
                         new HashMap<ImmutableBytesWritable, IndexMaintainer>();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b9c3498/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
index d7850ba..67242f6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/PhoenixIndexFailurePolicy.java
@@ -224,7 +224,7 @@ public class PhoenixIndexFailurePolicy extends DelegateIndexFailurePolicy
{
         try {
             conn = QueryUtil.getConnectionOnServer(this.env.getConfiguration()).unwrap(
                     PhoenixConnection.class);
-            PTable dataTable = PhoenixRuntime.getTable(conn, ref.getTableName());
+            PTable dataTable = PhoenixRuntime.getTableNoCache(conn, ref.getTableName());
             List<PTable> indexes = dataTable.getIndexes();
             // local index used to get view id from index mutation row key.
             PTable localIndex = null;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7b9c3498/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 199c425..184288e 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
@@ -371,6 +371,19 @@ public class PhoenixRuntime {
         };
     }
 
+    public static PTable getTableNoCache(Connection conn, String name) throws SQLException
{
+        String schemaName = SchemaUtil.getSchemaNameFromFullName(name);
+        String tableName = SchemaUtil.getTableNameFromFullName(name);
+        PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
+        MetaDataMutationResult result = new MetaDataClient(pconn).updateCache(pconn.getTenantId(),
+                schemaName, tableName, true);
+        if(result.getMutationCode() != MutationCode.TABLE_ALREADY_EXISTS) {
+            throw new TableNotFoundException(schemaName, tableName);
+        }
+
+        return result.getTable();
+
+    }
     /**
      * 
      * @param conn


Mime
View raw message