You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Mariusz Szpatuśko (Jira)" <ji...@apache.org> on 2020/05/11 13:22:00 UTC

[jira] [Updated] (PHOENIX-5889) row_timestamp wrong column values for on duplicate key update

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

Mariusz Szpatuśko updated PHOENIX-5889:
---------------------------------------
    Description: 
{code:java}
CREATE TABLE STORE.TEST1(CREATE TABLE STORE.TEST1(eventStartTimestamp timestamp not null,val1 varchar, val2 varcharCONSTRAINT pk PRIMARY KEY (eventStartTimestamp desc ROW_TIMESTAMP))VERSIONS=1, DATA_BLOCK_ENCODING='FAST_DIFF', COMPRESSION='SNAPPY',BLOOMFILTER='ROW', UPDATE_CACHE_FREQUENCY=900000, SALT_BUCKETS=32;

hbase(main):054:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
ROW                                                           COLUMN+CELL0 row(s) in 0.0520 seconds  

hbase(main):037:0> describe 'STORE.TEST1'Table STORE.TEST1 is ENABLEDSTORE.TEST1, {TABLE_ATTRIBUTES => {coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|805306366|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver|805306366|', coprocessor$3 => '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|805306366|', coprocessor$4 => '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|805306366|', coprocessor$5 => '|org.apache.phoenix.hbase.index.IndexRegionObserver|805306366|org.apache.hadoop.hbase.index.codec.class=org.apache.phoenix.index.PhoenixIndexCodec,index.builder=org.apache.phoenix.index.PhoenixIndexBuilder'}COLUMN FAMILIES DESCRIPTION{NAME => '0', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'FAST_DIFF', TTL => 'FOREVER', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}

UPSERT INTO STORE.TEST1(EVENTSTARTTIMESTAMP, VAL1, VAL2) values ('2002-05-30 09:30:10','a','b');

{code}
For table with row_timestamp key
{code:java}
hbase(main):055:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
ROW                                                           COLUMN+CELL
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1022751010000, value=x
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1022751010000, value=a
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1022751010000, value=b
1 row(s) in 0.0340 seconds
upsert into store.test1(EVENTSTARTTIMESTAMP, VAL2) values('2002-05-30 09:30:10','test2111122') on duplicate key update val1='testa',val2='testb';hbase(main):058:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
ROW                                                           COLUMN+CELL
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1589202202193, value=x
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1589202202193, value=testa
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1589202202193, value=testb
1 row(s) in 0.0510 seconds

{code}
when data is upserted and after that updated for the same key timestamp is updated also.

means on duplicate keys deoesn work for row_timestamp
{code:java}
select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');2002-05-30 09:30:10.000000 testa testb
select * from store.test1 where eventstarttimestamp <to_timestamp('2008-05-30 09:30:10');no rows
{code}
after that select returns wrong values depends of key range

  was:
{code:java}
CREATE TABLE STORE.TEST1(CREATE TABLE STORE.TEST1(eventStartTimestamp timestamp not null,val1 varchar, val2 varcharCONSTRAINT pk PRIMARY KEY (eventStartTimestamp desc ROW_TIMESTAMP))VERSIONS=1, DATA_BLOCK_ENCODING='FAST_DIFF', COMPRESSION='SNAPPY',BLOOMFILTER='ROW', UPDATE_CACHE_FREQUENCY=900000, SALT_BUCKETS=32;
hbase(main):054:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}ROW                                                           COLUMN+CELL0 row(s) in 0.0520 seconds  
hbase(main):037:0> describe 'STORE.TEST1'Table STORE.TEST1 is ENABLEDSTORE.TEST1, {TABLE_ATTRIBUTES => {coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|805306366|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver|805306366|', coprocessor$3 => '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|805306366|', coprocessor$4 => '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|805306366|', coprocessor$5 => '|org.apache.phoenix.hbase.index.IndexRegionObserver|805306366|org.apache.hadoop.hbase.index.codec.class=org.apache.phoenix.index.PhoenixIndexCodec,index.builder=org.apache.phoenix.index.PhoenixIndexBuilder'}COLUMN FAMILIES DESCRIPTION{NAME => '0', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'FAST_DIFF', TTL => 'FOREVER', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}UPSERT INTO STORE.TEST1(EVENTSTARTTIMESTAMP, VAL1, VAL2) values ('2002-05-30 09:30:10','a','b');
hbase(main):055:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}ROW                                                           COLUMN+CELL \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1022751010000, value=x \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1022751010000, value=a \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1022751010000, value=b1 row(s) in 0.0340 secondsupsert into store.test1(EVENTSTARTTIMESTAMP, VAL2) values('2002-05-30 09:30:10','test2111122') on duplicate key update val1='testa',val2='testb';
hbase(main):058:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}ROW                                                           COLUMN+CELL \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1589202202193, value=x \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1589202202193, value=testa \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1589202202193, value=testb1 row(s) in 0.0510 seconds
select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');2002-05-30 09:30:10.000000 testa testb
select * from store.test1 where eventstarttimestamp <to_timestamp('2008-05-30 09:30:10');no rows
{code}
For table with row_timestamp key
{code:java}
hbase(main):055:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
ROW                                                           COLUMN+CELL
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1022751010000, value=x
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1022751010000, value=a
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1022751010000, value=b
1 row(s) in 0.0340 seconds
upsert into store.test1(EVENTSTARTTIMESTAMP, VAL2) values('2002-05-30 09:30:10','test2111122') on duplicate key update val1='testa',val2='testb';hbase(main):058:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
ROW                                                           COLUMN+CELL
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1589202202193, value=x
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1589202202193, value=testa
 \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1589202202193, value=testb
1 row(s) in 0.0510 seconds

{code}
when data is upserted and after that updated for the same key timestamp is updated also.

means on duplicate keys deoesn work for row_timestamp
{code:java}
select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');2002-05-30 09:30:10.000000 testa testb
select * from store.test1 where eventstarttimestamp <to_timestamp('2008-05-30 09:30:10');no rows
{code}
after that select returns wrong values depends of key range


> row_timestamp wrong column values for on duplicate key update
> -------------------------------------------------------------
>
>                 Key: PHOENIX-5889
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5889
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.14.3
>            Reporter: Mariusz Szpatuśko
>            Priority: Critical
>
> {code:java}
> CREATE TABLE STORE.TEST1(CREATE TABLE STORE.TEST1(eventStartTimestamp timestamp not null,val1 varchar, val2 varcharCONSTRAINT pk PRIMARY KEY (eventStartTimestamp desc ROW_TIMESTAMP))VERSIONS=1, DATA_BLOCK_ENCODING='FAST_DIFF', COMPRESSION='SNAPPY',BLOOMFILTER='ROW', UPDATE_CACHE_FREQUENCY=900000, SALT_BUCKETS=32;
> hbase(main):054:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
> ROW                                                           COLUMN+CELL0 row(s) in 0.0520 seconds  
> hbase(main):037:0> describe 'STORE.TEST1'Table STORE.TEST1 is ENABLEDSTORE.TEST1, {TABLE_ATTRIBUTES => {coprocessor$1 => '|org.apache.phoenix.coprocessor.ScanRegionObserver|805306366|', coprocessor$2 => '|org.apache.phoenix.coprocessor.UngroupedAggregateRegionObserver|805306366|', coprocessor$3 => '|org.apache.phoenix.coprocessor.GroupedAggregateRegionObserver|805306366|', coprocessor$4 => '|org.apache.phoenix.coprocessor.ServerCachingEndpointImpl|805306366|', coprocessor$5 => '|org.apache.phoenix.hbase.index.IndexRegionObserver|805306366|org.apache.hadoop.hbase.index.codec.class=org.apache.phoenix.index.PhoenixIndexCodec,index.builder=org.apache.phoenix.index.PhoenixIndexBuilder'}COLUMN FAMILIES DESCRIPTION{NAME => '0', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'FAST_DIFF', TTL => 'FOREVER', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
> UPSERT INTO STORE.TEST1(EVENTSTARTTIMESTAMP, VAL1, VAL2) values ('2002-05-30 09:30:10','a','b');
> {code}
> For table with row_timestamp key
> {code:java}
> hbase(main):055:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
> ROW                                                           COLUMN+CELL
>  \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1022751010000, value=x
>  \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1022751010000, value=a
>  \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1022751010000, value=b
> 1 row(s) in 0.0340 seconds
> upsert into store.test1(EVENTSTARTTIMESTAMP, VAL2) values('2002-05-30 09:30:10','test2111122') on duplicate key update val1='testa',val2='testb';hbase(main):058:0> scan 'STORE.TEST1',{RAW=>true,VERSIONS=>3}
> ROW                                                           COLUMN+CELL
>  \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x00\x00\x00\x00, timestamp=1589202202193, value=x
>  \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0B, timestamp=1589202202193, value=testa
>  \x1A\x7F\xFF\xFF\x11\xDFJ\x13/\xFF\xFF\xFF\xFF               column=0:\x80\x0C, timestamp=1589202202193, value=testb
> 1 row(s) in 0.0510 seconds
> {code}
> when data is upserted and after that updated for the same key timestamp is updated also.
> means on duplicate keys deoesn work for row_timestamp
> {code:java}
> select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');select * from store.test1 where eventstarttimestamp <to_timestamp('2028-05-30 09:30:10');2002-05-30 09:30:10.000000 testa testb
> select * from store.test1 where eventstarttimestamp <to_timestamp('2008-05-30 09:30:10');no rows
> {code}
> after that select returns wrong values depends of key range



--
This message was sent by Atlassian Jira
(v8.3.4#803005)