Revert "PHOENIX-4141 Addendum to fix test failure"

This reverts commit 6e5f3152f6940af714088ff4ab344690d22015ab.


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

Branch: refs/heads/4.x-HBase-1.1
Commit: eb72822f70a441c8cc581999f1bee83788cbdb2f
Parents: 147d22d
Author: Samarth Jain <[email protected]>
Authored: Sat Sep 2 15:47:04 2017 -0700
Committer: Samarth Jain <[email protected]>
Committed: Sat Sep 2 15:47:04 2017 -0700

----------------------------------------------------------------------
 .../end2end/TableSnapshotReadsMapReduceIT.java  | 42 +++++++++-----------
 1 file changed, 19 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/eb72822f/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
index 92a2bda..591f028 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TableSnapshotReadsMapReduceIT.java
@@ -70,6 +70,7 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
     @Before
     public void injectMyClock() {
         clock = new MyClock(1000);
+        // Use our own clock to prevent race between partial rebuilder and 
compaction
         EnvironmentEdgeManager.injectEdge(clock);
     }
 
@@ -89,7 +90,7 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
         // configure Phoenix M/R job to read snapshot
         final Configuration conf = getUtility().getConfiguration();
         Job job = Job.getInstance(conf);
-        Path tmpDir = getUtility().getDataTestDir(SNAPSHOT_NAME);
+        Path tmpDir = getUtility().getDataTestDirOnTestFS(SNAPSHOT_NAME);
 
         PhoenixMapReduceUtil.setInput(job, PhoenixIndexDBWritable.class, 
SNAPSHOT_NAME, tableName,
             tmpDir, null, FIELD1, FIELD2, FIELD3);
@@ -109,7 +110,7 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
         // configure Phoenix M/R job to read snapshot
         final Configuration conf = getUtility().getConfiguration();
         Job job = Job.getInstance(conf);
-        Path tmpDir = getUtility().getDataTestDir(SNAPSHOT_NAME);
+        Path tmpDir = getUtility().getDataTestDirOnTestFS(SNAPSHOT_NAME);
         PhoenixMapReduceUtil.setInput(job, PhoenixIndexDBWritable.class, 
SNAPSHOT_NAME, tableName,
             tmpDir, FIELD3 + " > 0001", FIELD1, FIELD2, FIELD3);
 
@@ -129,7 +130,7 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
         // configure Phoenix M/R job to read snapshot
         final Configuration conf = getUtility().getConfiguration();
         Job job = Job.getInstance(conf);
-        Path tmpDir = getUtility().getDataTestDir(SNAPSHOT_NAME);
+        Path tmpDir = getUtility().getDataTestDirOnTestFS(SNAPSHOT_NAME);
         // Running limit with order by on non pk column
         String inputQuery = "SELECT * FROM " + tableName + " ORDER BY FIELD2 
LIMIT 1";
         PhoenixMapReduceUtil.setInput(job, PhoenixIndexDBWritable.class, 
SNAPSHOT_NAME, tableName,
@@ -155,7 +156,6 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
             // verify the result, should match the values at the corresponding 
timestamp
             Properties props = new Properties();
             props.setProperty("CurrentSCN", Long.toString(clock.time));
-
             StringBuilder selectQuery = new StringBuilder("SELECT * FROM " + 
tableName);
             if (condition != null) {
                 selectQuery.append(" WHERE " + condition);
@@ -178,13 +178,26 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
             }
 
             assertFalse(
-                "Should only have stored" + result.size() + "rows in the table 
for the timestamp!",
+                "Should only have stored " + result.size() + "rows in the 
table for the timestamp!",
                 rs.next());
         } finally {
             deleteSnapshotAndTable(tableName);
         }
     }
 
+    private static class MyClock extends EnvironmentEdge {
+        public volatile long time;
+
+        public MyClock(long time) {
+            this.time = time;
+        }
+
+        @Override
+        public long currentTime() {
+            return time;
+        }
+    }
+
     private void upsertData(String tableName) throws SQLException {
         Connection conn = DriverManager.getConnection(getUrl());
         PreparedStatement stmt = conn.prepareStatement(String.format(UPSERT, 
tableName));
@@ -227,23 +240,6 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl());
         HBaseAdmin admin = 
conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin();
         admin.deleteSnapshot(SNAPSHOT_NAME);
-
-        conn.createStatement().execute("DROP TABLE " + tableName);
-        conn.close();
-
-    }
-
-    private static class MyClock extends EnvironmentEdge {
-        public volatile long time;
-
-        public MyClock(long time) {
-            this.time = time;
-        }
-
-        @Override
-        public long currentTime() {
-            return time;
-        }
     }
 
     public static class TableSnapshotMapper extends
@@ -261,4 +257,4 @@ public class TableSnapshotReadsMapReduceIT extends 
ParallelStatsDisabledIT {
         }
     }
 
-}
\ No newline at end of file
+}

Reply via email to