DomGarguilo commented on a change in pull request #2236:
URL: https://github.com/apache/accumulo/pull/2236#discussion_r692457848



##########
File path: 
server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java
##########
@@ -1064,4 +1070,110 @@ public void testFileWithoutOpen() throws IOException {
     var e = assertThrows(IllegalStateException.class, () -> recover(logs, 
extent));
     assertTrue(e.getMessage().contains("not " + LogEvents.OPEN));
   }
+
+  @Test
+  public void testInvalidLogSortedProperties() {
+    ConfigurationCopy testConfig = new 
ConfigurationCopy(DefaultConfiguration.getInstance());
+    // test all the possible properties for tserver.sort.file. prefix
+    String prop = Property.TSERV_WAL_SORT_FILE_PREFIX + "invalid";
+    testConfig.set(prop, "snappy");
+    try {
+      new LogSorter(context, testConfig);
+      fail("Did not throw IllegalArgumentException for " + prop);
+    } catch (IllegalArgumentException e) {
+      // valid for test
+    }
+  }
+
+  @Test
+  public void testLogSortedProperties() throws Exception {
+    Mutation ignored = new ServerMutation(new Text("ignored"));
+    ignored.put(cf, cq, value);
+    Mutation m = new ServerMutation(new Text("row1"));
+    m.put(cf, cq, value);
+    ConfigurationCopy testConfig = new 
ConfigurationCopy(DefaultConfiguration.getInstance());
+    String sortFileCompression = "none";
+    // test all the possible properties for tserver.sort.file. prefix
+    String prefix = Property.TSERV_WAL_SORT_FILE_PREFIX.toString();
+    testConfig.set(prefix + "compress.type", sortFileCompression);
+    testConfig.set(prefix + "compress.blocksize", "50K");
+    testConfig.set(prefix + "compress.blocksize.index", "56K");
+    testConfig.set(prefix + "blocksize", "256B");
+    testConfig.set(prefix + "replication", "3");
+    LogSorter sorter = new LogSorter(context, testConfig);
+
+    final String workdir = tempFolder.newFolder().getAbsolutePath();
+
+    try (var vm = VolumeManagerImpl.getLocalForTesting(workdir)) {
+      expect(context.getVolumeManager()).andReturn(vm).anyTimes();
+      
expect(context.getCryptoService()).andReturn(CryptoServiceFactory.newDefaultInstance())
+          .anyTimes();
+      
expect(context.getConfiguration()).andReturn(DefaultConfiguration.getInstance()).anyTimes();
+      replay(context);
+      final Path workdirPath = new Path("file://" + workdir);
+      vm.deleteRecursively(workdirPath);
+
+      KeyValue[] events =
+          {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 
1, extent),
+              createKeyValue(COMPACTION_FINISH, 2, 1, null),
+              createKeyValue(COMPACTION_START, 4, 1, "/t1/f1"),
+              createKeyValue(COMPACTION_FINISH, 5, 1, null),
+              createKeyValue(MUTATION, 3, 1, ignored), 
createKeyValue(MUTATION, 5, 1, m),};

Review comment:
       Yea it looks like most if not all of the `KeyValue[]` have it as well 
for some reason :confused:




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to