[
https://issues.apache.org/jira/browse/PHOENIX-6673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17754375#comment-17754375
]
fanartoria commented on PHOENIX-6673:
-------------------------------------
[~stoty]
Maybe meet the similar problem. My scenario is to split the hotspot region.
Ways to reproduce:
{code:java}
# create table
create table manualsplittest(
k1 varchar not null,
k2 varchar not null,
k3 varchar not null,
v1 varchar,
constraint pk primary key(k1, k2, k3)
);
# create local index
create local index manualsplittest_localindex on manualsplittest(k1, k2, v1);
# split by hbase
split 'MANUALSPLITTEST', '1'
# query
select * from manualsplittest where k1 = '1' and k2 in ('1', '2');
{code}
The error stack trace is
{code:java}
java.lang.ArrayIndexOutOfBoundsException: 1
at
org.apache.phoenix.iterate.BaseResultIterators.clipKeyRangeBytes(BaseResultIterators.java:887)
at
org.apache.phoenix.iterate.BaseResultIterators.getParallelScans(BaseResultIterators.java:1076)
at
org.apache.phoenix.iterate.BaseResultIterators.getParallelScans(BaseResultIterators.java:679)
at
org.apache.phoenix.iterate.BaseResultIterators.<init>(BaseResultIterators.java:549)
at
org.apache.phoenix.iterate.ParallelIterators.<init>(ParallelIterators.java:63)
at org.apache.phoenix.execute.ScanPlan.newIterator(ScanPlan.java:280)
at
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:367)
at
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:222)
at
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:217)
at
org.apache.phoenix.execute.BaseQueryPlan.iterator(BaseQueryPlan.java:212)
at
org.apache.phoenix.execute.BaseQueryPlan.getExplainPlan(BaseQueryPlan.java:522)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:653)
at
org.apache.phoenix.jdbc.PhoenixStatement$ExecutableExplainStatement.compilePlan(PhoenixStatement.java:625)
at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:307)
at
org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:296)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:295)
at
org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:288)
at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1991)
at sqlline.Commands.executeSingleQuery(Commands.java:1054)
at sqlline.Commands.execute(Commands.java:1003)
at sqlline.Commands.sql(Commands.java:967)
at sqlline.SqlLine.dispatch(SqlLine.java:734)
at sqlline.SqlLine.begin(SqlLine.java:541)
at sqlline.SqlLine.start(SqlLine.java:267)
at sqlline.SqlLine.main(SqlLine.java:206)
{code}
Then I tried to explore how to combine primary keys as a legal split key.
{code:java}
# create another table with presplit
create table another(
k1 varchar not null,
k2 varchar not null,
k3 varchar not null,
v1 varchar,
constraint pk primary key(k1, k2, k3)
) split on ('1')
{code}
And I find that the split key will be extended to it's schema.
So my workaround here is using the extended split key
{code:java}
# wrong split 'MANUALSPLITTEST', '1'
# varchar will be filled with byte 0
split 'MANUALSPLITTEST', '"1\x00\x00\x00"'
{code}
> Local indexing broken by manually splitting table at arbitrary point
> --------------------------------------------------------------------
>
> Key: PHOENIX-6673
> URL: https://issues.apache.org/jira/browse/PHOENIX-6673
> Project: Phoenix
> Issue Type: Bug
> Components: core
> Affects Versions: 5.2.0
> Reporter: Istvan Toth
> Priority: Major
> Attachments: PHOENIX-6673-repro.patch
>
>
> While working on PHOENIX-6587, I found that splitting tables with local
> indexes on certain points will break the local indexing code, and result in
> incorrect query results.
> When a table is pre-split by Phoenix, or automatically split by HBase, then
> split points always have a minimum length that is equal to the possible
> minimum length of the table rowkey.
> The automatic split always happens at an existing rowkey, and
> SchemaUtil.processSplits() has code that approximates the same behaviour for
> pre-split tables.
> However, it is still possible to split the table manually from HBase at
> points that do not satisfy the above requirement, which breaks local indexing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)