[jira] [Updated] (PHOENIX-2909) Surface checkAndPut through UPDATE statement

2016-09-28 Thread James Taylor (JIRA)

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

James Taylor updated PHOENIX-2909:
--
Assignee: (was: James Taylor)

> Surface checkAndPut through UPDATE statement
> 
>
> Key: PHOENIX-2909
> URL: https://issues.apache.org/jira/browse/PHOENIX-2909
> Project: Phoenix
>  Issue Type: Bug
>Reporter: James Taylor
>
> We can surface atomic checkAndPut like functionality through support of the 
> SQL UPSERT statement.
> For example, the following could use do a get under row lock to perform the 
> row update atomically
> {code}
> UPDATE  my_table SET counter=coalesce(counter,0) + 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> To force prior MVCC transactions to complete (making it serializable as an 
> Increment is), we'd have code like this:
> {code}
> mvcc = region.getMVCC();
> mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
> {code}
> By users setting auto commit to true and issuing an UPDATE statement over a 
> non transactional table, they'd get a way for row updates to be atomic. This 
> would work especially well to support counters.
> An UPDATE statement would simply be translated to an equivalent UPSERT SELECT 
> with a flag being passed to the server such that the row lock and read occurs 
> when executed. For example, the above statement would become:
> {code}
> UPSERT INTO  my_table(pk1,pk2,counter) SELECT pk1, pk2, coalesce(counter,0) + 
> 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> Note that the coalesce call above handles the case where counter is null. 
> This could be made prettier with support for the DEFAULT clause at CREATE 
> TABLE time (PHOENIX-476).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PHOENIX-2909) Surface checkAndPut through UPDATE statement

2016-09-28 Thread James Taylor (JIRA)

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

James Taylor updated PHOENIX-2909:
--
Fix Version/s: (was: 4.9.0)

> Surface checkAndPut through UPDATE statement
> 
>
> Key: PHOENIX-2909
> URL: https://issues.apache.org/jira/browse/PHOENIX-2909
> Project: Phoenix
>  Issue Type: Bug
>Reporter: James Taylor
>Assignee: James Taylor
>
> We can surface atomic checkAndPut like functionality through support of the 
> SQL UPSERT statement.
> For example, the following could use do a get under row lock to perform the 
> row update atomically
> {code}
> UPDATE  my_table SET counter=coalesce(counter,0) + 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> To force prior MVCC transactions to complete (making it serializable as an 
> Increment is), we'd have code like this:
> {code}
> mvcc = region.getMVCC();
> mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
> {code}
> By users setting auto commit to true and issuing an UPDATE statement over a 
> non transactional table, they'd get a way for row updates to be atomic. This 
> would work especially well to support counters.
> An UPDATE statement would simply be translated to an equivalent UPSERT SELECT 
> with a flag being passed to the server such that the row lock and read occurs 
> when executed. For example, the above statement would become:
> {code}
> UPSERT INTO  my_table(pk1,pk2,counter) SELECT pk1, pk2, coalesce(counter,0) + 
> 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> Note that the coalesce call above handles the case where counter is null. 
> This could be made prettier with support for the DEFAULT clause at CREATE 
> TABLE time (PHOENIX-476).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PHOENIX-2909) Surface checkAndPut through UPDATE statement

2016-08-18 Thread James Taylor (JIRA)

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

James Taylor updated PHOENIX-2909:
--
Fix Version/s: 4.9.0

> Surface checkAndPut through UPDATE statement
> 
>
> Key: PHOENIX-2909
> URL: https://issues.apache.org/jira/browse/PHOENIX-2909
> Project: Phoenix
>  Issue Type: Bug
>Reporter: James Taylor
> Fix For: 4.9.0
>
>
> We can surface atomic checkAndPut like functionality through support of the 
> SQL UPSERT statement.
> For example, the following could use do a get under row lock to perform the 
> row update atomically
> {code}
> UPDATE  my_table SET counter=coalesce(counter,0) + 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> To force prior MVCC transactions to complete (making it serializable as an 
> Increment is), we'd have code like this:
> {code}
> mvcc = region.getMVCC();
> mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
> {code}
> By users setting auto commit to true and issuing an UPDATE statement over a 
> non transactional table, they'd get a way for row updates to be atomic. This 
> would work especially well to support counters.
> An UPDATE statement would simply be translated to an equivalent UPSERT SELECT 
> with a flag being passed to the server such that the row lock and read occurs 
> when executed. For example, the above statement would become:
> {code}
> UPSERT INTO  my_table(pk1,pk2,counter) SELECT pk1, pk2, coalesce(counter,0) + 
> 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> Note that the coalesce call above handles the case where counter is null. 
> This could be made prettier with support for the DEFAULT clause at CREATE 
> TABLE time (PHOENIX-476).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PHOENIX-2909) Surface checkAndPut through UPDATE statement

2016-08-18 Thread James Taylor (JIRA)

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

James Taylor updated PHOENIX-2909:
--
Description: 
We can surface atomic checkAndPut like functionality through support of the SQL 
UPSERT statement.

For example, the following could use do a get under row lock to perform the row 
update atomically
{code}
UPDATE  my_table SET counter=coalesce(counter,0) + 1 
FROM my_table WHERE pk1 = 1 AND pk2 = 2;
{code}

To force prior MVCC transactions to complete (making it serializable as an 
Increment is), we'd have code like this:
{code}
mvcc = region.getMVCC();
mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
{code}

By users setting auto commit to true and issuing an UPDATE statement over a non 
transactional table, they'd get a way for row updates to be atomic. This would 
work especially well to support counters.

An UPDATE statement would simply be translated to an equivalent UPSERT SELECT 
with a flag being passed to the server such that the row lock and read occurs 
when executed. For example, the above statement would become:
{code}
UPSERT INTO  my_table(pk1,pk2,counter) SELECT pk1, pk2, coalesce(counter,0) + 1 
FROM my_table WHERE pk1 = 1 AND pk2 = 2;
{code}

Note that the coalesce call above handles the case where counter is null. This 
could be made prettier with support for the DEFAULT clause at CREATE TABLE time 
(PHOENIX-476).

  was:
We can surface atomic checkAndPut like functionality through support of the SQL 
UPSERT statement.

For example, the following could use do a get under row lock to perform the row 
update atomically
{code}
UPDATE  my_table SET counter=coalesce(counter,0) + 1 FROM my_table;
{code}

To force prior MVCC transactions to complete (making it serializable as an 
Increment is), we'd have code like this:
{code}
mvcc = region.getMVCC();
mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
{code}

By users setting auto commit to true and issuing an UPDATE statement over a non 
transactional table, they'd get a way for row updates to be atomic. This would 
work especially well to support counters.

Note that the coalesce call above handles the case where counter is null. This 
could be made prettier with support for the DEFAULT clause at CREATE TABLE time 
(PHOENIX-476).


> Surface checkAndPut through UPDATE statement
> 
>
> Key: PHOENIX-2909
> URL: https://issues.apache.org/jira/browse/PHOENIX-2909
> Project: Phoenix
>  Issue Type: Bug
>Reporter: James Taylor
>
> We can surface atomic checkAndPut like functionality through support of the 
> SQL UPSERT statement.
> For example, the following could use do a get under row lock to perform the 
> row update atomically
> {code}
> UPDATE  my_table SET counter=coalesce(counter,0) + 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> To force prior MVCC transactions to complete (making it serializable as an 
> Increment is), we'd have code like this:
> {code}
> mvcc = region.getMVCC();
> mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
> {code}
> By users setting auto commit to true and issuing an UPDATE statement over a 
> non transactional table, they'd get a way for row updates to be atomic. This 
> would work especially well to support counters.
> An UPDATE statement would simply be translated to an equivalent UPSERT SELECT 
> with a flag being passed to the server such that the row lock and read occurs 
> when executed. For example, the above statement would become:
> {code}
> UPSERT INTO  my_table(pk1,pk2,counter) SELECT pk1, pk2, coalesce(counter,0) + 
> 1 
> FROM my_table WHERE pk1 = 1 AND pk2 = 2;
> {code}
> Note that the coalesce call above handles the case where counter is null. 
> This could be made prettier with support for the DEFAULT clause at CREATE 
> TABLE time (PHOENIX-476).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (PHOENIX-2909) Surface checkAndPut through UPDATE statement

2016-08-18 Thread James Taylor (JIRA)

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

James Taylor updated PHOENIX-2909:
--
Summary: Surface checkAndPut through UPDATE statement  (was: Surface 
checkAndPut through UPDATE support)

> Surface checkAndPut through UPDATE statement
> 
>
> Key: PHOENIX-2909
> URL: https://issues.apache.org/jira/browse/PHOENIX-2909
> Project: Phoenix
>  Issue Type: Bug
>Reporter: James Taylor
>
> We can surface atomic checkAndPut like functionality through support of the 
> SQL UPSERT statement.
> For example, the following could use do a get under row lock to perform the 
> row update atomically
> {code}
> UPDATE  my_table SET counter=coalesce(counter,0) + 1 FROM my_table;
> {code}
> To force prior MVCC transactions to complete (making it serializable as an 
> Increment is), we'd have code like this:
> {code}
> mvcc = region.getMVCC();
> mvcc.completeMemstoreInsert(mvcc.beginMemstoreInsert());
> {code}
> By users setting auto commit to true and issuing an UPDATE statement over a 
> non transactional table, they'd get a way for row updates to be atomic. This 
> would work especially well to support counters.
> Note that the coalesce call above handles the case where counter is null. 
> This could be made prettier with support for the DEFAULT clause at CREATE 
> TABLE time (PHOENIX-476).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)