phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdsi...@apache.org
Subject phoenix git commit: PHOENIX-1813 Support reading your own writes
Date Thu, 16 Apr 2015 22:18:14 GMT
Repository: phoenix
Updated Branches:
  refs/heads/txn f0c4d0661 -> 324b566f4


PHOENIX-1813 Support reading your own writes


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/324b566f
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/324b566f
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/324b566f

Branch: refs/heads/txn
Commit: 324b566f4ece9d031e5fb1de7e3bd0ba9660fd1e
Parents: f0c4d06
Author: Thomas D'Silva <twdsilva@gmail.com>
Authored: Thu Apr 16 15:18:10 2015 -0700
Committer: Thomas D'Silva <twdsilva@gmail.com>
Committed: Thu Apr 16 15:18:10 2015 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/transactions/TransactionIT.java   | 11 +++++++----
 .../java/org/apache/phoenix/jdbc/PhoenixStatement.java   |  4 ++++
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/324b566f/phoenix-core/src/it/java/org/apache/phoenix/transactions/TransactionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/transactions/TransactionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/transactions/TransactionIT.java
index 35f88e4..807234d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/transactions/TransactionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/transactions/TransactionIT.java
@@ -86,7 +86,7 @@ public class TransactionIT extends BaseHBaseManagedTimeIT {
 	}
 	
 	@Test
-	public void testUpsert() throws Exception {
+	public void testReadOwnWrites() throws Exception {
 		String selectSql = "SELECT * FROM "+FULL_TABLE_NAME;
 		Connection conn = DriverManager.getConnection(getUrl());
 		try {
@@ -102,12 +102,15 @@ public class TransactionIT extends BaseHBaseManagedTimeIT {
 			setRowKeyColumns(stmt, 2);
 			stmt.execute();
 	        
-	        // verify no rows returned 
+	        // verify rows can be read even though commit has not been called
 			rs = conn.createStatement().executeQuery(selectSql);
-	     	assertFalse(rs.next());
+			validateRowKeyColumns(rs, 1);
+	        validateRowKeyColumns(rs, 2);
+	        assertFalse(rs.next());
+	        
 	        conn.commit();
 	        
-	        // verify row exists
+	        // verify rows can be read after commit
 	        rs = conn.createStatement().executeQuery(selectSql);
 	        validateRowKeyColumns(rs, 1);
 	        validateRowKeyColumns(rs, 2);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/324b566f/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
index 2c0021f..3ccc772 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java
@@ -243,6 +243,10 @@ public class PhoenixStatement implements Statement, SQLCloseable, org.apache.pho
                         if (connection.getAutoCommit()) {
                             connection.commit(); // Forces new read point for next statement
                         }
+                        else {
+                        	// send mutations to hbase, so they are visible to subsequent reads
+                        	connection.getMutationState().send();
+                        }
                         if (logger.isDebugEnabled()) {
                             String explainPlan = QueryUtil.getExplainPlan(resultIterator);
                             logger.debug(LogUtil.addCustomAnnotations("Explain plan: " +
explainPlan, connection));


Mime
View raw message