phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject phoenix git commit: Temporary fix for PHOENIX-3341 Data update is not visible to following statements of the same connection due to CalciteSchema caching.
Date Fri, 30 Sep 2016 19:47:15 GMT
Repository: phoenix
Updated Branches:
  refs/heads/calcite 12a2b22e3 -> 3b4b62383


Temporary fix for PHOENIX-3341 Data update is not visible to following statements of the same
connection due to CalciteSchema caching.


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

Branch: refs/heads/calcite
Commit: 3b4b623830f211ab502be6023c12ebf16d2c7a8b
Parents: 12a2b22
Author: maryannxue <maryann.xue@gmail.com>
Authored: Fri Sep 30 12:44:49 2016 -0700
Committer: maryannxue <maryann.xue@gmail.com>
Committed: Fri Sep 30 12:47:07 2016 -0700

----------------------------------------------------------------------
 .../apache/phoenix/calcite/BaseCalciteIT.java   | 14 ++++++++++++
 .../apache/phoenix/calcite/CalciteDMLIT.java    | 23 ++++++++++----------
 .../phoenix/calcite/rel/PhoenixTableScan.java   |  4 ++++
 3 files changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3b4b6238/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java
index 5f98f8d..e192dc6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/BaseCalciteIT.java
@@ -124,6 +124,16 @@ public class BaseCalciteIT extends BaseHBaseManagedTimeIT {
             return connection;
         }
 
+        public void commit() {
+            if (connection != null) {
+                try {
+                    connection.commit();
+                } catch (SQLException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+
         public void close() {
             if (connection != null) {
                 try {
@@ -195,6 +205,10 @@ public class BaseCalciteIT extends BaseHBaseManagedTimeIT {
             return start.getConnection().prepareStatement(sql);
         }
 
+        public void commit() {
+            start.commit();
+        }
+
         public void close() {
             start.close();
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3b4b6238/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteDMLIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteDMLIT.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteDMLIT.java
index 6705042..6417ad2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteDMLIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteDMLIT.java
@@ -62,21 +62,20 @@ public class CalciteDMLIT extends BaseCalciteIT {
         startPhoenixStandalone(PROPS).sql("create table tgtTable(pk0 integer not null, pk1
integer not null, f0 varchar(5), f1 varchar(5), f2 varchar(5) constraint pk primary key (pk0,
pk1))")
             .execute()
             .close();
-        start(PROPS).sql("upsert into srcTable values(1, 10, '00100', '01000')")
-            .executeUpdate()
-            .close();
-        start(PROPS).sql("upsert into srcTable values(2, 20, '00200', '02000')")
-            .executeUpdate()
-            .close();
-        start(PROPS).sql("upsert into srcTable values(3, 30, '00300', '03000')")
-            .executeUpdate()
-            .close();
-        final Sql sql = start(PROPS).sql("upsert into tgtTable(pk0, pk1, f0, f2) select *
from srcTable where pk1 <> ?");
+        Start start = start(PROPS);
+        start.sql("upsert into srcTable values(1, 10, '00100', '01000')")
+            .executeUpdate();
+        start.sql("upsert into srcTable values(2, 20, '00200', '02000')")
+            .executeUpdate();
+        start.sql("upsert into srcTable values(3, 30, '00300', '03000')")
+            .executeUpdate();
+        start.commit();
+        final Sql sql = start.sql("upsert into tgtTable(pk0, pk1, f0, f2) select * from srcTable
where pk1 <> ?");
         final PreparedStatement stmt = sql.prepareStatement();
         stmt.setInt(1, 20);
         stmt.executeUpdate();
-        sql.close();
-        start(false, 1L).sql("select * from tgtTable")
+        sql.commit();
+        start.sql("select * from tgtTable")
             .resultIs(0, new Object[][] {
                 {1, 10, "00100", null, "01000"},
                 {3, 30, "00300", null, "03000"}})

http://git-wip-us.apache.org/repos/asf/phoenix/blob/3b4b6238/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
index 4801999..253b368 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixTableScan.java
@@ -41,6 +41,7 @@ import org.apache.phoenix.iterate.BaseResultIterators;
 import org.apache.phoenix.iterate.ParallelIteratorFactory;
 import org.apache.phoenix.jdbc.PhoenixStatement;
 import org.apache.phoenix.parse.SelectStatement;
+import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.query.QueryServicesOptions;
 import org.apache.phoenix.schema.PColumn;
@@ -301,6 +302,9 @@ public class PhoenixTableScan extends TableScan implements PhoenixQueryRel
{
             TableRef tableRef = tableMapping.getTableRef();
             TableRef srcRef = tableMapping.getDataTableRef() == null ?
                     tableRef : tableMapping.getDataTableRef();
+            // FIXME this is just a temporary fix for schema caching problem.
+            tableRef.setTimeStamp(QueryConstants.UNSET_TIMESTAMP);
+            srcRef.setTimeStamp(QueryConstants.UNSET_TIMESTAMP);
             return new ScanPlan(context, select, tableRef, srcRef, RowProjector.EMPTY_PROJECTOR,
null, null, orderBy, iteratorFactory, true, dynamicFilter);
         } catch (SQLException e) {
             throw new RuntimeException(e);


Mime
View raw message