You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/05/12 14:47:15 UTC

[GitHub] [accumulo] dlmarion opened a new pull request #2098: Fixes #1628 - add test where selector throws an error

dlmarion opened a new pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] dlmarion commented on pull request #2098: Fixes #1628 - add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
dlmarion commented on pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#issuecomment-839883544


   QA build failed due to connection reset pulling down a jar - not related to the code changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] ctubbsii merged pull request #2098: Fix #1628 add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
ctubbsii merged pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] ctubbsii commented on a change in pull request #2098: Fixes #1628 - add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
ctubbsii commented on a change in pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#discussion_r631245845



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +115,67 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      NewTableConfiguration tc = new NewTableConfiguration();
+      // Ensure compactions don't kick off
+      tc.setProperties(Map.of(Property.TABLE_MAJC_RATIO.getKey(), "10.0"));
+      c.tableOperations().create(tableName, tc);
+      // Create multiple RFiles
+      BatchWriter bw = c.createBatchWriter(tableName);
+      Mutation m = new Mutation("1");
+      m.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m2 = new Mutation("2");
+      m2.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m2);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m3 = new Mutation("3");
+      m3.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m3);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m4 = new Mutation("4");
+      m4.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m4);
+      bw.close();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+
+      List<String> files = FunctionalTestUtils.getRFilePaths(c, tableName);
+      assertEquals(4, files.size());
+
+      String subset = files.get(0).substring(files.get(0).lastIndexOf('/') + 1) + ","
+          + files.get(3).substring(files.get(3).lastIndexOf('/') + 1);
+
+      CompactionConfig config = new CompactionConfig()
+          .setSelector(new PluginConfig(RandomErrorThrowingSelector.class.getName(),
+              Map.of(RandomErrorThrowingSelector.FILE_LIST_PARAM, subset)))
+          .setWait(true);
+      c.tableOperations().compact(tableName, config);
+
+      List<String> files2 = FunctionalTestUtils.getRFilePaths(c, tableName);
+      assertFalse(files2.contains(files.get(0)));
+      assertTrue(files2.contains(files.get(1)));
+      assertTrue(files2.contains(files.get(2)));
+      assertFalse(files2.contains(files.get(3)));

Review comment:
       ```suggestion
         // check that the subset of files selected are compacted, but the others remain untouched
         List<String> filesAfterCompact = FunctionalTestUtils.getRFilePaths(c, tableName);
         assertFalse(filesAfterCompact.contains(files.get(0)));
         assertTrue(filesAfterCompact.contains(files.get(1)));
         assertTrue(filesAfterCompact.contains(files.get(2)));
         assertFalse(filesAfterCompact.contains(files.get(3)));
   ```

##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +115,67 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      NewTableConfiguration tc = new NewTableConfiguration();
+      // Ensure compactions don't kick off
+      tc.setProperties(Map.of(Property.TABLE_MAJC_RATIO.getKey(), "10.0"));
+      c.tableOperations().create(tableName, tc);
+      // Create multiple RFiles
+      BatchWriter bw = c.createBatchWriter(tableName);
+      Mutation m = new Mutation("1");
+      m.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m2 = new Mutation("2");
+      m2.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m2);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m3 = new Mutation("3");
+      m3.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m3);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m4 = new Mutation("4");
+      m4.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m4);
+      bw.close();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+
+      List<String> files = FunctionalTestUtils.getRFilePaths(c, tableName);
+      assertEquals(4, files.size());
+
+      String subset = files.get(0).substring(files.get(0).lastIndexOf('/') + 1) + ","
+          + files.get(3).substring(files.get(3).lastIndexOf('/') + 1);
+
+      CompactionConfig config = new CompactionConfig()
+          .setSelector(new PluginConfig(RandomErrorThrowingSelector.class.getName(),
+              Map.of(RandomErrorThrowingSelector.FILE_LIST_PARAM, subset)))
+          .setWait(true);
+      c.tableOperations().compact(tableName, config);
+
+      List<String> files2 = FunctionalTestUtils.getRFilePaths(c, tableName);
+      assertFalse(files2.contains(files.get(0)));
+      assertTrue(files2.contains(files.get(1)));
+      assertTrue(files2.contains(files.get(2)));
+      assertFalse(files2.contains(files.get(3)));
+
+      List<Text> rows = new ArrayList<>();
+      rows.add(new Text("1"));
+      rows.add(new Text("2"));
+      rows.add(new Text("3"));
+      rows.add(new Text("4"));
+      c.createScanner(tableName).forEach((k, v) -> {
+        assertTrue(rows.remove(k.getRow()));
+      });
+      assertEquals(0, rows.size());

Review comment:
       ```suggestion
         List<String> rows = new ArrayList<>();
         c.createScanner(tableName).forEach((k, v) -> rows.add(k.getRow().toString()));
         assertEquals(List.of("1", "2", "3", "4"), actualRows);
   ```

##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +115,67 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      NewTableConfiguration tc = new NewTableConfiguration();
+      // Ensure compactions don't kick off
+      tc.setProperties(Map.of(Property.TABLE_MAJC_RATIO.getKey(), "10.0"));
+      c.tableOperations().create(tableName, tc);
+      // Create multiple RFiles
+      BatchWriter bw = c.createBatchWriter(tableName);
+      Mutation m = new Mutation("1");
+      m.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m2 = new Mutation("2");
+      m2.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m2);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m3 = new Mutation("3");
+      m3.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m3);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m4 = new Mutation("4");
+      m4.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m4);
+      bw.close();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);

Review comment:
       ```suggestion
         try (BatchWriter bw = c.createBatchWriter(tableName)) {
           for (int i = 1; i <= 4; i++) {
             Mutation m = new Mutation(Integer.toString(i));
             m.put("cf", "cq", new Value());
             bw.addMutation(m);
             bw.flush();
             c.tableOperations().flush(tableName, null, null, true);
           }
         }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] keith-turner commented on a change in pull request #2098: Fixes #1628 - add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
keith-turner commented on a change in pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#discussion_r631118585



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +116,54 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      // Ensure compactions don't kick off
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10.0");
+      // Create multiple RFiles
+      BatchWriter bw = c.createBatchWriter(tableName);
+      Mutation m = new Mutation("1");
+      m.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m2 = new Mutation("2");
+      m2.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m2);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m3 = new Mutation("3");
+      m3.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m3);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m4 = new Mutation("4");
+      m4.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m4);
+      bw.close();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+
+      List<String> files = FunctionalTestUtils.getRFileNames(c, tableName);
+      Assert.assertEquals(4, files.size());
+
+      String subset = files.get(0).substring(files.get(0).lastIndexOf('/') + 1) + ","
+          + files.get(3).substring(files.get(3).lastIndexOf('/') + 1);
+
+      CompactionConfig config = new CompactionConfig()
+          .setSelector(new PluginConfig(RandomErrorThrowingSelector.class.getName(),
+              Map.of(RandomErrorThrowingSelector.FILE_LIST_PARAM, subset)))
+          .setWait(true);
+      c.tableOperations().compact(tableName, config);
+
+      List<String> files2 = FunctionalTestUtils.getRFileNames(c, tableName);
+      Assert.assertFalse(files2.contains(files.get(0)));
+      Assert.assertFalse(files2.contains(files.get(3)));

Review comment:
       ```suggestion
         Assert.assertFalse(files2.contains(files.get(0)));
         Assert.assertTrue(files2.contains(files.get(1)));
         Assert.assertTrue(files2.contains(files.get(2)));
         Assert.assertFalse(files2.contains(files.get(3)));
   ```

##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +116,54 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      // Ensure compactions don't kick off
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10.0");

Review comment:
       setting these props are eventually consistent, so not sure when tserver will see the config update.  Could set the prop at table creation time instead, avoiding any possible race conditions in the test. 

##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +116,54 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      // Ensure compactions don't kick off
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10.0");
+      // Create multiple RFiles
+      BatchWriter bw = c.createBatchWriter(tableName);
+      Mutation m = new Mutation("1");
+      m.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m2 = new Mutation("2");
+      m2.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m2);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m3 = new Mutation("3");
+      m3.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m3);
+      bw.flush();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+      Mutation m4 = new Mutation("4");
+      m4.put("cf", "cq", new Value(new byte[0]));
+      bw.addMutation(m4);
+      bw.close();
+      c.tableOperations().flush(tableName, new Text("0"), new Text("9"), true);
+
+      List<String> files = FunctionalTestUtils.getRFileNames(c, tableName);
+      Assert.assertEquals(4, files.size());
+
+      String subset = files.get(0).substring(files.get(0).lastIndexOf('/') + 1) + ","
+          + files.get(3).substring(files.get(3).lastIndexOf('/') + 1);
+
+      CompactionConfig config = new CompactionConfig()
+          .setSelector(new PluginConfig(RandomErrorThrowingSelector.class.getName(),
+              Map.of(RandomErrorThrowingSelector.FILE_LIST_PARAM, subset)))
+          .setWait(true);
+      c.tableOperations().compact(tableName, config);
+
+      List<String> files2 = FunctionalTestUtils.getRFileNames(c, tableName);
+      Assert.assertFalse(files2.contains(files.get(0)));
+      Assert.assertFalse(files2.contains(files.get(3)));
+    }

Review comment:
       It would be nice to scan table and verify data is as expected.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] keith-turner commented on a change in pull request #2098: Fixes #1628 - add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
keith-turner commented on a change in pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#discussion_r631126872



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
##########
@@ -81,6 +83,19 @@ public static int countRFiles(AccumuloClient c, String tableName) throws Excepti
     }
   }
 
+  public static List<String> getRFileNames(AccumuloClient c, String tableName) throws Exception {

Review comment:
       This method name seems off.  Seems like its returning paths or URIs and not names.  Also could possible use Ample for the implementation, but not quite sure. It may not be easy to use Ample unless you have a ServerContext.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] ctubbsii commented on a change in pull request #2098: Fix #1628 add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
ctubbsii commented on a change in pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#discussion_r631297766



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
##########
@@ -68,6 +115,50 @@ protected int defaultTimeoutSeconds() {
     return 4 * 60;
   }
 
+  @Test
+  public void testBadSelector() throws Exception {
+    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
+      final String tableName = getUniqueNames(1)[0];
+      NewTableConfiguration tc = new NewTableConfiguration();
+      // Ensure compactions don't kick off
+      tc.setProperties(Map.of(Property.TABLE_MAJC_RATIO.getKey(), "10.0"));
+      c.tableOperations().create(tableName, tc);
+      // Create multiple RFiles
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        for (int i = 1; i <= 4; i++) {
+          Mutation m = new Mutation(Integer.toString(i));
+          m.put("cf", "cq", new Value());
+          bw.addMutation(m);
+          bw.flush();
+          c.tableOperations().flush(tableName, null, null, true);
+        }
+      }
+
+      List<String> files = FunctionalTestUtils.getRFilePaths(c, tableName);
+      assertEquals(4, files.size());
+
+      String subset = files.get(0).substring(files.get(0).lastIndexOf('/') + 1) + ","
+          + files.get(3).substring(files.get(3).lastIndexOf('/') + 1);
+
+      CompactionConfig config = new CompactionConfig()
+          .setSelector(new PluginConfig(RandomErrorThrowingSelector.class.getName(),
+              Map.of(RandomErrorThrowingSelector.FILE_LIST_PARAM, subset)))
+          .setWait(true);
+      c.tableOperations().compact(tableName, config);
+
+      // check that the subset of files selected are compacted, but the others remain untouched
+      List<String> filesAfterCompact = FunctionalTestUtils.getRFilePaths(c, tableName);
+      assertFalse(filesAfterCompact.contains(files.get(0)));
+      assertTrue(filesAfterCompact.contains(files.get(1)));
+      assertTrue(filesAfterCompact.contains(files.get(2)));
+      assertFalse(filesAfterCompact.contains(files.get(3)));
+
+      List<String> rows = new ArrayList<>();
+      c.createScanner(tableName).forEach((k, v) -> rows.add(k.getRow().toString()));
+      assertEquals(List.of("1", "2", "3", "4"), actualRows);

Review comment:
       Oops, my initial suggestion renamed this variable.
   
   ```suggestion
         assertEquals(List.of("1", "2", "3", "4"), rows);
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] keith-turner commented on a change in pull request #2098: Fixes #1628 - add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
keith-turner commented on a change in pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#discussion_r631126872



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
##########
@@ -81,6 +83,19 @@ public static int countRFiles(AccumuloClient c, String tableName) throws Excepti
     }
   }
 
+  public static List<String> getRFileNames(AccumuloClient c, String tableName) throws Exception {

Review comment:
       This name seems off.  Seems like its returning paths or URIs and not names.  Also could possible use Ample for this, but not quite sure. It may not be easy to use Ample unless you have a ServerContext.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [accumulo] keith-turner commented on a change in pull request #2098: Fixes #1628 - add test where selector throws an error

Posted by GitBox <gi...@apache.org>.
keith-turner commented on a change in pull request #2098:
URL: https://github.com/apache/accumulo/pull/2098#discussion_r631126872



##########
File path: test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
##########
@@ -81,6 +83,19 @@ public static int countRFiles(AccumuloClient c, String tableName) throws Excepti
     }
   }
 
+  public static List<String> getRFileNames(AccumuloClient c, String tableName) throws Exception {

Review comment:
       This method name seems off.  Seems like its returning paths or URIs and not names.  Also could possibly use Ample for the implementation, but not quite sure. It may not be easy to use Ample unless you have a ServerContext.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org