[ 
https://issues.apache.org/jira/browse/PHOENIX-2276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Samarth Jain updated PHOENIX-2276:
----------------------------------
    Attachment: PHOENIX-2276.patch

Patch that fixes the NPE by changing the row key of shared indexes. I have 
manually tested that upgrading to 4.8 disables existing view and local indexes. 
The upgrade also successfully truncates the underlying hbase table. Also tested 
that rebuilding the indexes is repopulating the index table with the new row 
key. 

I am getting a test failure though in HashJoinMoreIT#testJoinWithMultitenancy. 
The query that is failing is doing a right join. The query with inner join is 
working successfully. Stacktrace:

{code}
org.apache.phoenix.exception.PhoenixIOException: 
org.apache.phoenix.exception.PhoenixIOException: 
org.apache.hadoop.hbase.DoNotRetryIOException: Could not find hash cache for 
joinId: dK�K_�. The cache might have expired and have been removed.
        at 
org.apache.phoenix.coprocessor.HashJoinRegionScanner.<init>(HashJoinRegionScanner.java:98)
        at 
org.apache.phoenix.coprocessor.ScanRegionObserver.doPostScannerOpen(ScanRegionObserver.java:229)
        at 
org.apache.phoenix.coprocessor.BaseScannerRegionObserver.postScannerOpen(BaseScannerRegionObserver.java:212)
        at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$52.call(RegionCoprocessorHost.java:1340)
        at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost$RegionOperation.call(RegionCoprocessorHost.java:1656)
        at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperation(RegionCoprocessorHost.java:1733)
        at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.execOperationWithResult(RegionCoprocessorHost.java:1695)
        at 
org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.postScannerOpen(RegionCoprocessorHost.java:1335)
        at 
org.apache.hadoop.hbase.regionserver.HRegionServer.scan(HRegionServer.java:3250)
        at 
org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:31190)
        at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2149)
        at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:104)
        at 
org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133)
        at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108)
        at java.lang.Thread.run(Thread.java:745)

        at 
org.apache.phoenix.util.ServerUtil.parseServerException(ServerUtil.java:111)
        at 
org.apache.phoenix.iterate.BaseResultIterators.getIterators(BaseResultIterators.java:775)
        at 
org.apache.phoenix.iterate.BaseResultIterators.getIterators(BaseResultIterators.java:721)
        at 
org.apache.phoenix.iterate.ConcatResultIterator.getIterators(ConcatResultIterator.java:50)
        at 
org.apache.phoenix.iterate.ConcatResultIterator.currentIterator(ConcatResultIterator.java:97)
        at 
org.apache.phoenix.iterate.ConcatResultIterator.next(ConcatResultIterator.java:117)
        at 
org.apache.phoenix.iterate.DelegateResultIterator.next(DelegateResultIterator.java:44)
        at 
org.apache.phoenix.jdbc.PhoenixResultSet.next(PhoenixResultSet.java:778)
        at 
org.apache.phoenix.end2end.HashJoinMoreIT.testJoinWithMultiTenancy(HashJoinMoreIT.java:575)
{code}

[~maryannxue] - any pointers as to why my change could be causing this failure. 
My patch basically changes the positions of index_id and tenant_id columns in 
the row key.




> Creating index on a global view on a multi-tenant table fails with NPE
> ----------------------------------------------------------------------
>
>                 Key: PHOENIX-2276
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2276
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>              Labels: SFDC
>             Fix For: 4.8.0
>
>         Attachments: PHOENIX-2276.patch
>
>
> {code}
> @Test
>     public void testCreatingIndexOnGlobalView() throws Exception {
>         String baseTable = "testRowTimestampColWithViews".toUpperCase();
>         String globalView = "globalView".toUpperCase();
>         String globalViewIdx = "globalView_idx".toUpperCase();
>         long ts = nextTimestamp();
>         try (Connection conn = getConnection(ts)) {
>             conn.createStatement().execute("CREATE TABLE " + baseTable + " 
> (TENANT_ID CHAR(15) NOT NULL, PK2 DATE NOT NULL, PK3 INTEGER NOT NULL, KV1 
> VARCHAR, KV2 VARCHAR, KV3 CHAR(15) CONSTRAINT PK PRIMARY KEY(TENANT_ID, PK2 
> ROW_TIMESTAMP, PK3)) MULTI_TENANT=true");
>         }
>         ts = nextTimestamp();
>         try (Connection conn = getConnection(ts)) {
>             conn.createStatement().execute("CREATE VIEW " + globalView + " AS 
> SELECT * FROM " + baseTable + " WHERE KV1 = 'KV1'");
>         }
>         ts = nextTimestamp();
>         try (Connection conn = getConnection(ts)) {
>             conn.createStatement().execute("CREATE INDEX " + globalViewIdx + 
> " ON " + globalView + " (PK3 DESC, KV3) INCLUDE (KV1)");
>         }
>     }
> java.lang.NullPointerException
>       at 
> org.apache.phoenix.util.StringUtil.escapeBackslash(StringUtil.java:392)
>       at 
> org.apache.phoenix.compile.PostIndexDDLCompiler.compile(PostIndexDDLCompiler.java:78)
>       at 
> org.apache.phoenix.schema.MetaDataClient.buildIndex(MetaDataClient.java:1027)
>       at 
> org.apache.phoenix.schema.MetaDataClient.buildIndexAtTimeStamp(MetaDataClient.java:903)
>       at 
> org.apache.phoenix.schema.MetaDataClient.createIndex(MetaDataClient.java:1321)
>       at 
> org.apache.phoenix.compile.CreateIndexCompiler$1.execute(CreateIndexCompiler.java:95)
>       at 
> org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:315)
>       at 
> org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:1)
>       at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>       at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:306)
>       at 
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1375)
> {code}



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

Reply via email to