You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/08/14 17:26:37 UTC

[GitHub] [phoenix] gjacoby126 opened a new pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

gjacoby126 opened a new pull request #857:
URL: https://github.com/apache/phoenix/pull/857


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on pull request #857:
URL: https://github.com/apache/phoenix/pull/857#issuecomment-674184771


   @stoty - I'm curious about your opinion on how I'm using your compatibility projects to get version-specific coproc logic, plus version-specific feature flags. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] stoty commented on a change in pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
stoty commented on a change in pull request #857:
URL: https://github.com/apache/phoenix/pull/857#discussion_r471926729



##########
File path: phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class ScanInfoUtil {

Review comment:
       This doesn't seem to reference anywhere.

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java
##########
@@ -367,4 +374,16 @@ RegionScanner getWrappedScanner(final ObserverContext<RegionCoprocessorEnvironme
                 dataRegion, indexMaintainer, null, viewConstants, null, null, projector, ptr, useQualiferAsListIndex);
     }
 
+    @Override
+    public void preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> ctx, Store store,

Review comment:
       This doesn't seem to do anything since the subclassing.

##########
File path: phoenix-hbase-compat-2.2.1/src/main/java/org/apache/phoenix/compat/hbase/HbaseCompatCapabilities.java
##########
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.compat.hbase;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class HbaseCompatCapabilities {
+
+    public static boolean isMaxLookbackTimeSupported() {
+        return false;
+    }
+
+    //In HBase 2.1 and 2.2, a lookback query won't return any results if covered by a future delete
+    public static boolean isLookbackBeyondDeletesSupported() { return false; }

Review comment:
       Nit: indent like above in both files?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #857:
URL: https://github.com/apache/phoenix/pull/857#discussion_r473348976



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
##########
@@ -172,6 +178,28 @@ public QueryPlan compile() throws SQLException{
         return plan;
     }
 
+    private void verifySCN() throws SQLException {
+        if (!HbaseCompatCapabilities.isMaxLookbackTimeSupported()) {
+            return;
+        }
+        PhoenixConnection conn = statement.getConnection();
+        Long scn = conn.getSCN();
+        if (scn == null) {
+            return;
+        }
+        ColumnResolver resolver =
+            FromCompiler.getResolverForQuery(select, conn);
+        int maxLookBackAge = conn.getQueryServices().
+            getConfiguration().getInt(CompatBaseScannerRegionObserver.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+            CompatBaseScannerRegionObserver.DEFAULT_PHOENIX_MAX_LOOKBACK_AGE);
+        long now = EnvironmentEdgeManager.currentTimeMillis();
+        if (maxLookBackAge > 0 && now - maxLookBackAge * 1000L > scn){

Review comment:
       Not sure I follow? The configuration property is in seconds (to correspond with HBase TTL, which is also in seconds), but we convert to ms in the if-block to compare with the current timestamp. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on pull request #857:
URL: https://github.com/apache/phoenix/pull/857#issuecomment-675097707


   @stoty - introduced HbaseCompatCapabilities and subclassed from ComaptBaseScannerRegionObserver, as you suggested. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] swaroopak commented on a change in pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
swaroopak commented on a change in pull request #857:
URL: https://github.com/apache/phoenix/pull/857#discussion_r473351996



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
##########
@@ -172,6 +178,28 @@ public QueryPlan compile() throws SQLException{
         return plan;
     }
 
+    private void verifySCN() throws SQLException {
+        if (!HbaseCompatCapabilities.isMaxLookbackTimeSupported()) {
+            return;
+        }
+        PhoenixConnection conn = statement.getConnection();
+        Long scn = conn.getSCN();
+        if (scn == null) {
+            return;
+        }
+        ColumnResolver resolver =
+            FromCompiler.getResolverForQuery(select, conn);
+        int maxLookBackAge = conn.getQueryServices().
+            getConfiguration().getInt(CompatBaseScannerRegionObserver.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+            CompatBaseScannerRegionObserver.DEFAULT_PHOENIX_MAX_LOOKBACK_AGE);
+        long now = EnvironmentEdgeManager.currentTimeMillis();
+        if (maxLookBackAge > 0 && now - maxLookBackAge * 1000L > scn){

Review comment:
       maxLookBackAge*1000 can be stored into a variable like done for ttl in other function. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on pull request #857:
URL: https://github.com/apache/phoenix/pull/857#issuecomment-676791543


   Thanks for the reviews, @stoty and @swaroopak . 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on pull request #857:
URL: https://github.com/apache/phoenix/pull/857#issuecomment-674182171


   Note that since HBase 2.1 and HBase 2.2 lack HBASE-24321, a lot of the logic is behind a 2.3 compatibility shim. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] stoty commented on a change in pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
stoty commented on a change in pull request #857:
URL: https://github.com/apache/phoenix/pull/857#discussion_r471926729



##########
File path: phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/ScanInfoUtil.java
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import org.apache.hadoop.conf.Configuration;
+
+public class ScanInfoUtil {

Review comment:
       This doesn't seem to be referenced anywhere.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] stoty commented on pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
stoty commented on pull request #857:
URL: https://github.com/apache/phoenix/pull/857#issuecomment-674203202


   In 4.x we use org.apache.phoenix.compat.hbase.HbaseCompatCapabilities for the feature flags, It would be more consistent to move the feature flags there.
   
   I did not go through the code in detail, but it seems that extending BaseScannerRegionObserver from CompatBaseScannerRegionObserver would be a more elegant , and perhaps marginally faster solution than calling it explicitly.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #857:
URL: https://github.com/apache/phoenix/pull/857#discussion_r473402594



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
##########
@@ -172,6 +178,28 @@ public QueryPlan compile() throws SQLException{
         return plan;
     }
 
+    private void verifySCN() throws SQLException {
+        if (!HbaseCompatCapabilities.isMaxLookbackTimeSupported()) {
+            return;
+        }
+        PhoenixConnection conn = statement.getConnection();
+        Long scn = conn.getSCN();
+        if (scn == null) {
+            return;
+        }
+        ColumnResolver resolver =
+            FromCompiler.getResolverForQuery(select, conn);
+        int maxLookBackAge = conn.getQueryServices().
+            getConfiguration().getInt(CompatBaseScannerRegionObserver.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+            CompatBaseScannerRegionObserver.DEFAULT_PHOENIX_MAX_LOOKBACK_AGE);
+        long now = EnvironmentEdgeManager.currentTimeMillis();
+        if (maxLookBackAge > 0 && now - maxLookBackAge * 1000L > scn){

Review comment:
       @swaroopak Switched to using an existing helper function to get the millisecond version of the max lookback config. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] swaroopak commented on a change in pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
swaroopak commented on a change in pull request #857:
URL: https://github.com/apache/phoenix/pull/857#discussion_r473310085



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
##########
@@ -172,6 +178,28 @@ public QueryPlan compile() throws SQLException{
         return plan;
     }
 
+    private void verifySCN() throws SQLException {
+        if (!HbaseCompatCapabilities.isMaxLookbackTimeSupported()) {
+            return;
+        }
+        PhoenixConnection conn = statement.getConnection();
+        Long scn = conn.getSCN();
+        if (scn == null) {
+            return;
+        }
+        ColumnResolver resolver =
+            FromCompiler.getResolverForQuery(select, conn);
+        int maxLookBackAge = conn.getQueryServices().
+            getConfiguration().getInt(CompatBaseScannerRegionObserver.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+            CompatBaseScannerRegionObserver.DEFAULT_PHOENIX_MAX_LOOKBACK_AGE);
+        long now = EnvironmentEdgeManager.currentTimeMillis();
+        if (maxLookBackAge > 0 && now - maxLookBackAge * 1000L > scn){

Review comment:
       nit: would be good in understanding if s -> ms conversion happens outside of if condition. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [phoenix] gjacoby126 merged pull request #857: PHOENIX-5881 - Port PHOENIX-5645 (MaxLookbackAge) to 5.x

Posted by GitBox <gi...@apache.org>.
gjacoby126 merged pull request #857:
URL: https://github.com/apache/phoenix/pull/857


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org