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

Ievgen Nekrashevych updated PHOENIX-4911:
-----------------------------------------
    Description: 
When deleting data from main table index table seem to have stale data, and 
when the row upserted again - index has wrong values.

Reproducable with script:

{code}
create schema if not exists TS
create table if not exists TS.TEST (STR varchar not null,INTCOL bigint not 
null, STARTTIME integer, DUMMY integer default 0 CONSTRAINT PK PRIMARY KEY 
(STR, INTCOL))
create local index if not exists "TEST_INDEX" on TS.TEST (STR,STARTTIME)

-- optional delete
-- delete from TS.TEST
upsert into TS.TEST(STR,INTCOL,STARTTIME,DUMMY) values ('TEST',4,1,3)
delete from TS.TEST
upsert into TS.TEST(STR, INTCOL, STARTTIME, DUMMY) values ('TEST',4,2,4)
delete from TS.TEST
upsert into TS.TEST(STR, INTCOL, DUMMY) values ('TEST',4,5)
 
SELECT /*+NO_INDEX*/* FROM TS.TEST where STR = 'TEST'
-- yields: STARTTIME = null
SELECT /*+TEST_INDEX*/ * FROM TS.TEST where STR = 'TEST'
-- yields: STARTTIME = 2
{code}


  was:
When deleting data from main table index table seem to have stale data, and 
when the row upserted again - index has wrong values.

Reproducable with script:

{code}
create schema if not exists TS
create table if not exists TS.TEST (STR varchar not null,INTCOL bigint not 
null, STARTTIME integer, DUMMY integer default 0 CONSTRAINT PK PRIMARY KEY 
(STR, INTCOL))
create local index if not exists "TEST_INDEX" on TS.TEST (STR,STARTTIME)

-- optional delete
-- delete from TS.TEST
upsert into TS.TEST(STR,INTCOL,STARTTIME,DUMMY) values ('TEST',4,1,3)
delete from TS.TEST
upsert into TS.TEST(STR, INTCOL, STARTTIME, DUMMY) values ('TEST',4,2,4)
delete from TS.TEST
upsert into TS.TEST (STR, INTCOL, DUMMY) values ('TEST',4,5)
 
SELECT /*+NO_INDEX*/* FROM TS.TEST where STR = 'TEST'
-- yields: STARTTIME = null
SELECT /*+TEST_INDEX*/ * FROM TS.TEST where STR = 'TEST'
-- yields: STARTTIME = 2
{code}



> phoenix index has stale data upon deletion of rows
> --------------------------------------------------
>
>                 Key: PHOENIX-4911
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4911
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.13.2-cdh5.11.2, 5.0.0, 5.1.0
>            Reporter: Ievgen Nekrashevych
>            Priority: Major
>
> When deleting data from main table index table seem to have stale data, and 
> when the row upserted again - index has wrong values.
> Reproducable with script:
> {code}
> create schema if not exists TS
> create table if not exists TS.TEST (STR varchar not null,INTCOL bigint not 
> null, STARTTIME integer, DUMMY integer default 0 CONSTRAINT PK PRIMARY KEY 
> (STR, INTCOL))
> create local index if not exists "TEST_INDEX" on TS.TEST (STR,STARTTIME)
> -- optional delete
> -- delete from TS.TEST
> upsert into TS.TEST(STR,INTCOL,STARTTIME,DUMMY) values ('TEST',4,1,3)
> delete from TS.TEST
> upsert into TS.TEST(STR, INTCOL, STARTTIME, DUMMY) values ('TEST',4,2,4)
> delete from TS.TEST
> upsert into TS.TEST(STR, INTCOL, DUMMY) values ('TEST',4,5)
>  
> SELECT /*+NO_INDEX*/* FROM TS.TEST where STR = 'TEST'
> -- yields: STARTTIME = null
> SELECT /*+TEST_INDEX*/ * FROM TS.TEST where STR = 'TEST'
> -- yields: STARTTIME = 2
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to