I am using HBase 1.1.3 with Phoenix 4.8.0-SNAPSHOT. To talk to phoenix, I am using the phoenix query server with serialization set to JSON.

First, I create a non-transactional table:
CREATE TABLE my_table3 (k BIGINT PRIMARY KEY, v VARCHAR) TRANSACTIONAL=false;

I then send the following requests to the query server using curl:
curl localhost:8765 -XPOST --data '{"request": "openConnection","connectionId": "my-conn"}'

curl localhost:8765 -XPOST --data '{"request": "connectionSync","connectionId": "my-conn","connProps": {"connProps": "connPropsImpl","autoCommit": false,"transactionIsolation": 8}}'

curl localhost:8765 -XPOST --data '{"request": "createStatement","connectionId": "my-conn"}' curl localhost:8765 -XPOST --data '{"request": "prepareAndExecute","connectionId": "my-conn","statementId": 12345,"sql": "UPSERT INTO my_table3 VALUES (1,\'A\')","maxRowCount": 100}' #Update the statement id

curl localhost:8765 -XPOST --data '{"request": "createStatement","connectionId": "my-conn"}' curl localhost:8765 -XPOST --data '{"request": "prepareAndExecute","connectionId": "my-conn","statementId": 12345,"sql": "UPSERT INTO my_table3 VALUES (2,\'B\')","maxRowCount": 100}' #Update the statement id

Connect to the phoenix query server using Squirrel SQL and see no rows exist for the my_table3 table.

curl localhost:8765 -XPOST --data '{"request": "createStatement","connectionId": "my-conn"}' curl localhost:8765 -XPOST --data '{"request": "prepareAndExecute","connectionId": "my-conn","statementId": 12345,"sql": "SELECT * FROM my_table3","maxRowCount": 100}' # Shows no results

curl localhost:8765 -XPOST --data '{"request": "commit","connectionId": "my-conn"}'

Connect to the phoenix query server using Squirrel SQL and see 2 rows for the my_table3 table.

It seems a bit strange that the table exhibits some properties where it supports transactions to some extent. Is this something that should be fixed?

Ideally, if a connectionSync request turns off autocommit for a given connection, reading and writing to a non-transactional table using that connection should return an error.

Reply via email to