EdColeman commented on code in PR #4122:
URL: https://github.com/apache/accumulo/pull/4122#discussion_r1472861811


##########
test/src/main/java/org/apache/accumulo/test/ImportExportIT.java:
##########
@@ -380,6 +384,52 @@ private boolean verifyMappingsFile(String destTableId) 
throws IOException {
     return false;
   }
 
+  /**
+   * Validate that files exported with Accumulo 2.x without fence ranges can 
be imported into
+   * version that require the fenced ranges (3.1 and later)
+   */
+  @Test
+  public void importV2data() throws Exception {
+    final String dataRoot = "./target/classes/v2_import_test";
+    final String dataSrc = dataRoot + "/data";
+    final String importDir = dataRoot + "/import";
+
+    // copy files each run will "move the files" on import, allows multiple 
runs in IDE without
+    // rebuild
+    java.nio.file.Path importDirPath = Paths.get(importDir);
+    java.nio.file.Files.createDirectories(importDirPath);
+    FileUtils.copyDirectory(new File(dataSrc), new File(importDir));
+
+    String table = getUniqueNames(1)[0];
+
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      log.debug("importing from: {} into table: {}", importDir, table);
+      client.tableOperations().importTable(table, importDir);
+
+      int rowCount = 0;
+      try (Scanner s = client.createScanner(table, Authorizations.EMPTY)) {
+        for (Entry<Key,Value> entry : s) {
+          log.trace("data:{}", entry);
+          rowCount++;
+        }
+      }
+      assertEquals(7, rowCount);
+

Review Comment:
   Added check in 18e8a0ca3e



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