[ https://issues.apache.org/jira/browse/PHOENIX-4658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16422785#comment-16422785 ]
James Taylor commented on PHOENIX-4658: --------------------------------------- Thanks for following up on this, [~brfrn169]. With or without a fix for HBASE-20219, we'll still need to workaround the issue in Phoenix since we need to support existing releases of HBase. My comment there was more about fixing the root cause. Barring that, your patch there seems fine. I think we should add the hint with this JIRA since this change is the entire reason we need the new hint. Adding the hint is trivial. Here's what you'd need to do: - Add new FORWARD_SCAN enum to HintNode. - Make this change in OrderByCompiler.compile(): {code} // If we're ordering by the order returned by the scan, we don't need an order by if (isInRowKeyOrder && tracker.isOrderPreserving()) { if (tracker.isReverse() && !statement.getHint().hasHint(Hint.FORWARD_SCAN)) { // Don't use reverse scan if: // 1) we're using a skip scan, as our skip scan doesn't support this yet. // 2) we have the FORWARD_SCAN hint set to choose to keep loading of column // families on demand versus doing a reverse scan // REV_ROW_KEY_ORDER_BY scan would not take effect for a projected table, so don't return it for such table types. if (context.getConnection().getQueryServices().getProps().getBoolean(QueryServices.USE_REVERSE_SCAN_ATTRIB, QueryServicesOptions.DEFAULT_USE_REVERSE_SCAN) && !context.getScanRanges().useSkipScanFilter() && context.getCurrentTable().getTable().getType() != PTableType.PROJECTED && context.getCurrentTable().getTable().getType() != PTableType.SUBQUERY) { return OrderBy.REV_ROW_KEY_ORDER_BY; } } else { return OrderBy.FWD_ROW_KEY_ORDER_BY; } } {code} > IllegalStateException: requestSeek cannot be called on ReversedKeyValueHeap > --------------------------------------------------------------------------- > > Key: PHOENIX-4658 > URL: https://issues.apache.org/jira/browse/PHOENIX-4658 > Project: Phoenix > Issue Type: Bug > Reporter: Toshihiro Suzuki > Assignee: Toshihiro Suzuki > Priority: Major > Fix For: 4.14.0 > > Attachments: PHOENIX-4658.patch, PHOENIX-4658.patch, > PHOENIX-4658.patch > > > Steps to reproduce are as follows: > 1. Create a table with multiple column families (default column family and > "FAM") > {code} > CREATE TABLE TBL ( > COL1 VARCHAR NOT NULL, > COL2 VARCHAR NOT NULL, > COL3 VARCHAR, > FAM.COL4 VARCHAR, > CONSTRAINT TRADE_EVENT_PK PRIMARY KEY (COL1, COL2) > ) > {code} > 2. Upsert a row > {code} > UPSERT INTO TBL (COL1, COL2) values ('AAA', 'BBB') > {code} > 3. Query with DESC for the table > {code} > SELECT * FROM TBL WHERE COL2 = 'BBB' ORDER BY COL1 DESC > {code} > By following the above steps, we face the following exception. > {code} > java.util.concurrent.ExecutionException: > org.apache.phoenix.exception.PhoenixIOException: > org.apache.hadoop.hbase.DoNotRetryIOException: > TBL,,1521251842845.153781990c0fb4bc34e3f2c721a6f415.: requestSeek cannot be > called on ReversedKeyValueHeap > at > org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:96) > at > org.apache.phoenix.util.ServerUtil.throwIOException(ServerUtil.java:62) > at > org.apache.phoenix.iterate.RegionScannerFactory$1.nextRaw(RegionScannerFactory.java:212) > at > org.apache.phoenix.coprocessor.DelegateRegionScanner.nextRaw(DelegateRegionScanner.java:82) > at > org.apache.phoenix.coprocessor.DelegateRegionScanner.nextRaw(DelegateRegionScanner.java:82) > at > org.apache.phoenix.coprocessor.BaseScannerRegionObserver$RegionScannerHolder.nextRaw(BaseScannerRegionObserver.java:294) > at > org.apache.hadoop.hbase.regionserver.RSRpcServices.scan(RSRpcServices.java:2808) > at > org.apache.hadoop.hbase.regionserver.RSRpcServices.scan(RSRpcServices.java:3045) > at > org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:36613) > at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2352) > at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:124) > at > org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:297) > at > org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:277) > Caused by: java.lang.IllegalStateException: requestSeek cannot be called on > ReversedKeyValueHeap > at > org.apache.hadoop.hbase.regionserver.ReversedKeyValueHeap.requestSeek(ReversedKeyValueHeap.java:65) > at > org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.joinedHeapMayHaveData(HRegion.java:6485) > at > org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextInternal(HRegion.java:6412) > at > org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextRaw(HRegion.java:6126) > at > org.apache.hadoop.hbase.regionserver.HRegion$RegionScannerImpl.nextRaw(HRegion.java:6112) > at > org.apache.phoenix.iterate.RegionScannerFactory$1.nextRaw(RegionScannerFactory.java:175) > ... 10 more > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)