You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/07/26 11:15:10 UTC

[GitHub] [hive] ArkoSharma commented on a change in pull request #2519: HIVE-25374: Fix test TestReplicationOnHDFSEncryptedZones

ArkoSharma commented on a change in pull request #2519:
URL: https://github.com/apache/hive/pull/2519#discussion_r676511419



##########
File path: itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationOnHDFSEncryptedZones.java
##########
@@ -113,46 +129,96 @@ public void targetAndSourceHaveDifferentEncryptionZoneKeys() throws Throwable {
             "'" + HiveConf.ConfVars.HIVE_DISTCP_DOAS_USER.varname + "'='"
                     + UserGroupInformation.getCurrentUser().getUserName() +"'");
     WarehouseInstance.Tuple tuple =
-        primary.run("use " + primaryDbName)
-            .run("create table encrypted_table (id int, value string)")
-            .run("insert into table encrypted_table values (1,'value1')")
-            .run("insert into table encrypted_table values (2,'value2')")
+            primary.run("use " + primaryDbName)
+                    .run("create table encrypted_table (id int, value string)")
+                    .run("insert into table encrypted_table values (1,'value1')")
+                    .run("insert into table encrypted_table values (2,'value2')")
+                    .dump(primaryDbName, dumpWithClause);
+
+    replica
+            .run("repl load " + primaryDbName + " into " + replicatedDbName
+                    + " with('hive.repl.add.raw.reserved.namespace'='true', "
+                    + "'hive.repl.replica.external.table.base.dir'='" + replica.externalTableWarehouseRoot + "', "
+                    + "'hive.exec.copyfile.maxsize'='0', 'distcp.options.skipcrccheck'='')")
+            .run("use " + replicatedDbName)
+            .run("repl status " + replicatedDbName)
+            .verifyResult(tuple.lastReplicationId);
+
+    try {
+      replica
+              .run("select value from encrypted_table")
+              .verifyResults(new String[] { "value1", "value2" });
+      Assert.fail("Src EZKey shouldn't be present on target");
+    } catch (IOException e) {
+      Assert.assertTrue(e.getCause().getMessage().contains("KeyVersion name 'test_key@0' does not exist"));
+    }
+
+    //read should pass without raw-byte distcp
+    dumpWithClause = Arrays.asList( "'" + HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname + "'='"
+            + replica.externalTableWarehouseRoot + "'");
+    tuple = primary.run("use " + primaryDbName)
+            .run("create external table encrypted_table2 (id int, value string)")
+            .run("insert into table encrypted_table2 values (1,'value1')")
+            .run("insert into table encrypted_table2 values (2,'value2')")
             .dump(primaryDbName, dumpWithClause);
 
     replica
-        .run("repl load " + primaryDbName + " into " + replicatedDbName
-                + " with('hive.repl.add.raw.reserved.namespace'='true', "
-                + "'hive.repl.replica.external.table.base.dir'='" + replica.externalTableWarehouseRoot + "', "
-                + "'distcp.options.pugpbx'='', 'distcp.options.skipcrccheck'='')")
-        .run("use " + replicatedDbName)
-        .run("repl status " + replicatedDbName)
-        .verifyResult(tuple.lastReplicationId)
-        .run("select value from encrypted_table")
-        .verifyFailure(new String[] { "value1", "value2" });
+            .run("repl load " + primaryDbName + " into " + replicatedDbName
+                    + " with('hive.repl.replica.external.table.base.dir'='" + replica.externalTableWarehouseRoot + "', "
+                    + "'hive.exec.copyfile.maxsize'='0', 'distcp.options.skipcrccheck'='')")
+            .run("use " + replicatedDbName)
+            .run("repl status " + replicatedDbName)
+            .verifyResult(tuple.lastReplicationId)
+            .run("select value from encrypted_table2")
+            .verifyResults(new String[] { "value1", "value2" });
   }
 
   @Ignore("this is ignored as minidfs cluster as of writing this test looked like did not copy the "
               + "files correctly")
   @Test
   public void targetAndSourceHaveSameEncryptionZoneKeys() throws Throwable {
-    WarehouseInstance replica = new WarehouseInstance(LOG, miniDFSCluster,
+    String replicaBaseDir = Files.createTempDirectory("replica2").toFile().getAbsolutePath();
+    Configuration replicaConf = new Configuration();
+    replicaConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, replicaBaseDir);
+    replicaConf.set("dfs.client.use.datanode.hostname", "true");
+    replicaConf.set("hadoop.proxyuser." + Utils.getUGI().getShortUserName() + ".hosts", "*");
+    replicaConf.set("hadoop.security.key.provider.path", "jceks://file" + jksFile);
+    replicaConf.setBoolean("dfs.namenode.delegation.token.always-use", true);
+

Review comment:
       Done.




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org