phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sama...@apache.org
Subject phoenix git commit: PHOENIX-4141 Addendum to fix test failure
Date Thu, 31 Aug 2017 17:13:44 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 2d4daa629 -> 6e5f3152f


PHOENIX-4141 Addendum to fix test failure


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 6e5f3152f6940af714088ff4ab344690d22015ab
Parents: 2d4daa6
Author: Samarth Jain <samarth@apache.org>
Authored: Thu Aug 31 10:13:27 2017 -0700
Committer: Samarth Jain <samarth@apache.org>
Committed: Thu Aug 31 10:13:37 2017 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e5f3152/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 591f028..92a2bda 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,7 +70,6 @@ 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);
     }
 
@@ -90,7 +89,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().getDataTestDirOnTestFS(SNAPSHOT_NAME);
+        Path tmpDir = getUtility().getDataTestDir(SNAPSHOT_NAME);
 
         PhoenixMapReduceUtil.setInput(job, PhoenixIndexDBWritable.class, SNAPSHOT_NAME, tableName,
             tmpDir, null, FIELD1, FIELD2, FIELD3);
@@ -110,7 +109,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().getDataTestDirOnTestFS(SNAPSHOT_NAME);
+        Path tmpDir = getUtility().getDataTestDir(SNAPSHOT_NAME);
         PhoenixMapReduceUtil.setInput(job, PhoenixIndexDBWritable.class, SNAPSHOT_NAME, tableName,
             tmpDir, FIELD3 + " > 0001", FIELD1, FIELD2, FIELD3);
 
@@ -130,7 +129,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().getDataTestDirOnTestFS(SNAPSHOT_NAME);
+        Path tmpDir = getUtility().getDataTestDir(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,
@@ -156,6 +155,7 @@ 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,26 +178,13 @@ 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));
@@ -240,6 +227,23 @@ 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
@@ -257,4 +261,4 @@ public class TableSnapshotReadsMapReduceIT extends ParallelStatsDisabledIT
{
         }
     }
 
-}
+}
\ No newline at end of file


Mime
View raw message