[ 
https://issues.apache.org/jira/browse/PHOENIX-2903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15298535#comment-15298535
 ] 

Rajeshbabu Chintaguntla commented on PHOENIX-2903:
--------------------------------------------------

After PHOENIX-2628 actual region boundaries are scan boundaries and what ever 
the context scan boundaries are values of SCAN_START_ROW_SUFFIX and 
SCAN_STOP_ROW_SUFFIX so at server we prefix start key to these attribute 
values. Wonder all cases we set these values properly after split. Will look 
more deeper once again and come back to you.
like 
{noformat}
+    public static void setAggregateStartRow(QueryPlan queryPlan, Tuple tuple, 
Scan scan) throws SQLException {
+        if (tuple != null) {
+            byte[] newStartRow = getAggregationStartRow(queryPlan, tuple);
+            byte[] originalStartRow = 
queryPlan.getContext().getScan().getStartRow();
+            if (Bytes.compareTo(originalStartRow, newStartRow) > 0) {
+                logger.warn("Expected start row based on partial scan (" +
+                        Bytes.toStringBinary(newStartRow) + ") to be after 
original start row (" +
+                        Bytes.toStringBinary(originalStartRow) + ") when split 
occurs");
+            } else {
+                scan.setStartRow(newStartRow);
+            }
+        }
+    }
....
+
+        @Override
+        public void splitOccurred(QueryPlan queryPlan, Scan scan, Tuple tuple) 
throws SQLException {
+            if (tuple != null) {
+                ImmutableBytesWritable ptr = 
queryPlan.getContext().getTempPtr();
+                tuple.getKey(ptr);
+                byte[] startAfterRow = ByteUtil.copyKeyBytesIfNecessary(ptr);
+                // This will force our coprocessor to skip until the row 
*after* this one
+                // The server will properly take care of reverse or forward 
scan while us
+                // forming the row key *before* the current key is not 100% 
reliable.
+                
scan.setAttribute(BaseScannerRegionObserver.SCAN_START_AFTER_ROW, 
startAfterRow);
+                scan.setStartRow(startAfterRow);
+                // The scan stop row will be reset if necessary by other 
trackers
+            }
+        }
+
{noformat}

> Handle split during scan for row key ordered aggregations
> ---------------------------------------------------------
>
>                 Key: PHOENIX-2903
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2903
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: James Taylor
>             Fix For: 4.8.0
>
>         Attachments: PHOENIX-2903_v1.patch, PHOENIX-2903_v2.patch, 
> PHOENIX-2903_v3.patch, PHOENIX-2903_wip.patch
>
>
> Currently a hole in our split detection code



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to