You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Gabriel Reid (JIRA)" <ji...@apache.org> on 2014/03/16 08:18:48 UTC

[jira] [Resolved] (PHOENIX-334) multiple read/write SQL with autocommit off do not give correct result

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

Gabriel Reid resolved PHOENIX-334.
----------------------------------

    Resolution: Fixed

Bulk resolve of closed issues imported from GitHub. This status was reached by first re-opening all closed imported issues and then resolving them in bulk.

> multiple read/write SQL with autocommit off do not give correct result
> ----------------------------------------------------------------------
>
>                 Key: PHOENIX-334
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-334
>             Project: Phoenix
>          Issue Type: Task
>            Reporter: Raymond Liu
>
> when autocommit is off, since before commit, the read operation is always run immediately by scan. thus the previous write operation that still not committed will not affect the later read operation. 
> I think this is wrong, no matter by what level of isolation, this is the wrong behavior. the statement inside the same transaction should be able to access the data mutated by previous statement. 
> I see that phoenix do not provide extra transaction upon HBASE other than batch. While as I understanding, that might mean concurrency or atomic is not guarantied. however the order of statement should be respect? If not, auto commit off mode is almost not use able.
> Though I had to agree that I seems to me a very hard task to implement this on top of HBase. But it seems that it is still possible to implement? 
> a not working example : 
>         String query = "UPSERT INTO source_table(row, col1) VALUES('row1', 1)";
>         PreparedStatement statement = conn.prepareStatement(query);
>         statement.executeUpdate();
>         conn.commit();
>         conn.setAutoCommit(false);
>         query = "UPSERT INTO source_table(row, col1) VALUES('row1', 100)";
>         statement = conn.prepareStatement(query);
>         statement.executeUpdate();
>         query = "UPSERT INTO dest_table(row, col1) SELECT row, col1 FROM source_table WHERE col1 > 10";
>         statement = conn.prepareStatement(query);
>         statement.executeUpdate();
>         conn.commit();
>         query = "SELECT * FROM dest_table";
>         statement = conn.prepareStatement(query);
>         ResultSet rs = statement.executeQuery();
>         assertTrue(rs.next());
>         assertEquals("row1", rs.getString(1));
>         assertEquals(100, rs.getInt(2));



--
This message was sent by Atlassian JIRA
(v6.2#6252)