Artem Ervits created PHOENIX-5398:
-------------------------------------

             Summary: DATA_BLOCK_ENCODING accepts ambiguous input
                 Key: PHOENIX-5398
                 URL: https://issues.apache.org/jira/browse/PHOENIX-5398
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.14.2
            Reporter: Artem Ervits


a user can pass any string to create statement and potentially break the 
machine.
{code:java}
DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST (MYKEY INTEGER PRIMARY KEY) DATA_BLOCK_ENCODING='DIFF';

{NAME => '0', BLOOMFILTER => 'NONE', VERSIONS => '1', IN_MEMORY => 'false', 
KEEP_DELET
ED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'DIFF', TTL => 'FOREVER', 
COMPRESSION => '
NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', 
REPLICATION_SC
OPE => '0'}

DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST (MYKEY INTEGER PRIMARY KEY) DATA_BLOCK_ENCODING='NONE';

{NAME => '0', BLOOMFILTER => 'NONE', VERSIONS => '1', IN_MEMORY => 'false', 
KEEP_DELET
ED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', 
COMPRESSION => '
NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', 
REPLICATION_SC
OPE => '0'}

DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST (MYKEY INTEGER PRIMARY KEY) DATA_BLOCK_ENCODING='FAST_DIFF';

{NAME => '0', BLOOMFILTER => 'NONE', VERSIONS => '1', IN_MEMORY => 'false', 
KEEP_DELET
ED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'FAST_DIFF', TTL => 'FOREVER', 
COMPRESSION
=> 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', 
REPLICATI
ON_SCOPE => '0'}

DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST (MYKEY INTEGER PRIMARY KEY) DATA_BLOCK_ENCODING='PREFIX';

{NAME => '0', BLOOMFILTER => 'NONE', VERSIONS => '1', IN_MEMORY => 'false', 
KEEP_DELET
ED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'PREFIX', TTL => 'FOREVER', 
COMPRESSION =>
'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', 
REPLICATION_
SCOPE => '0'}

DROP TABLE IF EXISTS TEST;
CREATE TABLE TEST (MYKEY INTEGER PRIMARY KEY) DATA_BLOCK_ENCODING='GARBAGE';

{NAME => '0', BLOOMFILTER => 'NONE', VERSIONS => '1', IN_MEMORY => 'false', 
KEEP_DELET
ED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'GARBAGE', TTL => 'FOREVER', 
COMPRESSION =
> 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', 
> REPLICATION
_SCOPE => '0'}{code}
After the 'GARBAGE' string is passed, sqlline freezes and doesn't let go off 
control. Only after issuing CTRL-C do you get an exception
{code:java}
0: jdbc:phoenix:> CREATE TABLE TEST (MYKEY INTEGER PRIMARY KEY) 
DATA_BLOCK_ENCODING='GARBAGE';
Traceback (most recent call last):
File "/opt/phoenix/bin/sqlline.py", line 120, in <module>
(output, error) = childProc.communicate()
File "/usr/lib/python2.7/subprocess.py", line 476, in communicate
self.wait()
File "/usr/lib/python2.7/subprocess.py", line 1073, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/usr/lib/python2.7/subprocess.py", line 121, in _eintr_retry_call
return func(*args)
KeyboardInterrupt
Exception in thread "SIGINT handler" java.lang.RuntimeException: 
java.sql.SQLFeatureNotSupportedException
at sqlline.SunSignalHandler.handle(SunSignalHandler.java:43)
at sun.misc.Signal$1.run(Signal.java:212)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLFeatureNotSupportedException
at org.apache.phoenix.jdbc.PhoenixStatement.cancel(PhoenixStatement.java:1691)
at sqlline.DispatchCallback.forceKillSqlQuery(DispatchCallback.java:83)
at sqlline.SunSignalHandler.handle(SunSignalHandler.java:38)
... 2 more{code}
After going to hbase shell and disabling/dropping the table was I able to 
return back to normal state.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to