phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Hofhansl (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (PHOENIX-5233) Read-your-own writes causes incorrect visibility with transactional tables (with Omid).
Date Fri, 12 Apr 2019 19:05:00 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-5233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816576#comment-16816576
] 

Lars Hofhansl edited comment on PHOENIX-5233 at 4/12/19 7:04 PM:
-----------------------------------------------------------------

And so I can fix this in Phoenix, by simply always doing a checkpoint when reading/writing
from/to the same table:
{code}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTrans
actionContext.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
index 392de7801..1147e0722 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
@@ -153,12 +153,10 @@ public class OmidTransactionContext implements PhoenixTransactionContext
{
 
     @Override
     public void checkpoint(boolean hasUncommittedData) throws SQLException {
-        if (hasUncommittedData) {
-            try {
-                tx.checkpoint();
-            } catch (TransactionException e) {
-                throw new SQLException(e);
-            }
+        try {
+            tx.checkpoint();
+        } catch (TransactionException e) {
+            throw new SQLException(e);
         }
         tx.setVisibilityLevel(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT);
     }
{code}

Does this need an Omid fix?



was (Author: lhofhansl):
And so I can fix this in Phoenix, by simply always doing a checkpoint when reading/writing
from/to the same table:
{code}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTrans
actionContext.java b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
index 392de7801..1147e0722 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/transaction/OmidTransactionContext.java
@@ -153,12 +153,10 @@ public class OmidTransactionContext implements PhoenixTransactionContext
{
 
     @Override
     public void checkpoint(boolean hasUncommittedData) throws SQLException {
-        if (hasUncommittedData) {
-            try {
-                tx.checkpoint();
-            } catch (TransactionException e) {
-                throw new SQLException(e);
-            }
+        try {
+            tx.checkpoint();
+        } catch (TransactionException e) {
+            throw new SQLException(e);
         }
         tx.setVisibilityLevel(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT);
     }
{code}

Does this an Omid fix?


> Read-your-own writes causes incorrect visibility with transactional tables (with Omid).
> ---------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-5233
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5233
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.14.1
>            Reporter: Lars Hofhansl
>            Assignee: Yonatan Gottesman
>            Priority: Major
>         Attachments: 5233-tests.txt, 5233-v4.txt, 5233-v5.txt, 5233-v6.txt
>
>
> (copied from my last comment on PHOENIX-5090)
> Steps to reproduce (with Omid):
>  # {{!autocommit off}}
>  # {{create table test (pk1 integer not null, pk2 integer not null, pk3 integer not null,
v1 float, v2 float, v3 integer CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) DISABLE_WAL=true,
TRANSACTIONAL=true;}}
>  # {{upsert into test values(rand()*10000000, rand()*10000000, rand()*10000000, rand(),
rand(), rand()*1000000);}}
>  # {{upsert into test select rand()*10000000, rand()*10000000, rand()*10000000, rand(),
rand(), rand()*1000000 from test;}}
>  # {{select count\(*) from test; – this will cause uncommitted data to sent to the
server.}}
>  # Goto #4 a few time (until you inserted 131072 rows)
>  # {{!commit}}
> In a separate sqlline session just repeat after the commit was issued in the other session.
> * {{select count\(*) from test;}}
> You'll see that number will change until it finally settles.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message