You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ss...@apache.org on 2016/06/22 21:10:06 UTC

[1/4] phoenix git commit: PHOENIX-3015 Any metadata changes may cause unpredictable result when local indexes are using

Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 ea66af60f -> d2f2bade0
  refs/heads/4.x-HBase-1.0 37e8948ec -> a5caaeb89
  refs/heads/4.x-HBase-1.1 847e90c4b -> 7b9c34980
  refs/heads/master bfda226ee -> 557197ed6


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/557197ed
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/557197ed
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/557197ed

Branch: refs/heads/master
Commit: 557197ed6311356892b8f5144bb1a1d6731611ef
Parents: bfda226
Author: Sergey Soldatov <ss...@apache.org>
Authored: Tue Jun 21 18:02:56 2016 -0700
Committer: Sergey Soldatov <ss...@apache.org>
Committed: Wed Jun 22 13:53:06 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/557197ed/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/557197ed/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/557197ed/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


[4/4] phoenix git commit: PHOENIX-3015 Any metadata changes may cause unpredictable result when local indexes are using

Posted by ss...@apache.org.
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 <ss...@apache.org>
Authored: Tue Jun 21 18:02:56 2016 -0700
Committer: Sergey Soldatov <ss...@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


[3/4] phoenix git commit: PHOENIX-3015 Any metadata changes may cause unpredictable result when local indexes are using

Posted by ss...@apache.org.
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/a5caaeb8
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a5caaeb8
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a5caaeb8

Branch: refs/heads/4.x-HBase-1.0
Commit: a5caaeb897cc6500167f9ee45f4c9b24030443bd
Parents: 37e8948
Author: Sergey Soldatov <ss...@apache.org>
Authored: Tue Jun 21 18:02:56 2016 -0700
Committer: Sergey Soldatov <ss...@apache.org>
Committed: Wed Jun 22 13:54:04 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/a5caaeb8/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 f974a12..a54efc8 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
@@ -143,7 +143,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/a5caaeb8/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/a5caaeb8/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 8de1de6..a5aefda 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
@@ -380,6 +380,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


[2/4] phoenix git commit: PHOENIX-3015 Any metadata changes may cause unpredictable result when local indexes are using

Posted by ss...@apache.org.
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/d2f2bade
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d2f2bade
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d2f2bade

Branch: refs/heads/4.x-HBase-0.98
Commit: d2f2bade045cc8922f967a2594942cf077e9ef87
Parents: ea66af6
Author: Sergey Soldatov <ss...@apache.org>
Authored: Tue Jun 21 18:02:56 2016 -0700
Committer: Sergey Soldatov <ss...@apache.org>
Committed: Wed Jun 22 13:53:44 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/d2f2bade/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 cbd77bd..9861cad 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
@@ -142,7 +142,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/d2f2bade/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/d2f2bade/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 3d8e001..bae2d20 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
@@ -374,6 +374,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