phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdsi...@apache.org
Subject phoenix git commit: PHOENIX-3907 Use LATEST_TIMESTAMP when UPDATE_CACHE_FREQUENCY is not zero
Date Wed, 07 Jun 2017 20:10:18 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master 65bd849be -> 7cb16d4dd


PHOENIX-3907 Use LATEST_TIMESTAMP when UPDATE_CACHE_FREQUENCY is not zero


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

Branch: refs/heads/master
Commit: 7cb16d4dd7f5fe11a10dfe4a58eb2bced313b6c1
Parents: 65bd849
Author: Thomas <tdsilva@salesforce.com>
Authored: Tue Jun 6 16:06:36 2017 -0700
Committer: Thomas <tdsilva@salesforce.com>
Committed: Wed Jun 7 13:10:09 2017 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/compile/CreateTableCompiler.java     | 2 +-
 .../java/org/apache/phoenix/compile/StatementContext.java   | 2 +-
 .../main/java/org/apache/phoenix/schema/MetaDataClient.java | 2 +-
 .../src/main/java/org/apache/phoenix/schema/TableRef.java   | 9 ++++++++-
 4 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/7cb16d4d/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
b/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
index b482998..6448edc 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/CreateTableCompiler.java
@@ -165,7 +165,7 @@ public class CreateTableCompiler {
                                     connection.addTable(table, resolvedTime);
                                 }
                             },
-                            connection, tableRef.getTimeStamp()+1);
+                            connection, tableRef.getCurrentTime()+1);
                     viewColumnConstantsToBe = new byte[nColumns][];
                     ViewWhereExpressionVisitor visitor = new ViewWhereExpressionVisitor(parentToBe,
viewColumnConstantsToBe);
                     where.accept(visitor);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7cb16d4d/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
index 9754313..39d8525 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/StatementContext.java
@@ -252,7 +252,7 @@ public class StatementContext {
     }
 
     public long getCurrentTime() throws SQLException {
-        long ts = this.getCurrentTable().getTimeStamp();
+        long ts = this.getCurrentTable().getCurrentTime();
         // if the table is transactional then it is only resolved once per query, so we can't
use the table timestamp
         if (this.getCurrentTable().getTable().getType() != PTableType.PROJECTED &&
!this
                 .getCurrentTable().getTable().isTransactional() && ts != QueryConstants

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7cb16d4d/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 3f6d98a..537d31b 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
@@ -1054,7 +1054,7 @@ public class MetaDataClient {
         // Since the table won't be added to the current connection.
         TableRef tableRef = new TableRef(null, table, ts, false);
         byte[] emptyCF = SchemaUtil.getEmptyColumnFamily(table);
-        MutationPlan plan = compiler.compile(Collections.singletonList(tableRef), emptyCF,
null, null, tableRef.getTimeStamp());
+        MutationPlan plan = compiler.compile(Collections.singletonList(tableRef), emptyCF,
null, null, ts);
         return connection.getQueryServices().updateData(plan);
     }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/7cb16d4d/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java
index 2ce5160..37cae22 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/TableRef.java
@@ -35,6 +35,7 @@ public class TableRef {
     private final String alias;
     private final long lowerBoundTimeStamp;
     private final boolean hasDynamicCols;
+    private final long currentTime;
 
     public TableRef(TableRef tableRef) {
         this(tableRef.alias, tableRef.table, tableRef.upperBoundTimeStamp, tableRef.lowerBoundTimeStamp,
tableRef.hasDynamicCols);
@@ -64,7 +65,9 @@ public class TableRef {
         boolean hasDynamicCols) {
         this.alias = alias;
         this.table = table;
-        this.upperBoundTimeStamp = upperBoundTimeStamp;
+        this.currentTime = upperBoundTimeStamp;
+        // if UPDATE_CACHE_FREQUENCY is set, always let the server set timestamps
+        this.upperBoundTimeStamp = table.getUpdateCacheFrequency()!=0 ? QueryConstants.UNSET_TIMESTAMP
: upperBoundTimeStamp;
         this.lowerBoundTimeStamp = lowerBoundTimeStamp;
         this.hasDynamicCols = hasDynamicCols;
     }
@@ -141,5 +144,9 @@ public class TableRef {
     public boolean hasDynamicCols() {
         return hasDynamicCols;
     }
+    
+    public long getCurrentTime() {
+        return this.currentTime;
+    }
 
 }


Mime
View raw message