You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/10/13 07:33:53 UTC

[GitHub] [iceberg] marton-bod commented on a change in pull request #1495: HiveMetaHook implementation to enable CREATE TABLE and DROP TABLE from Hive queries

marton-bod commented on a change in pull request #1495:
URL: https://github.com/apache/iceberg/pull/1495#discussion_r503728769



##########
File path: hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveMetastore.java
##########
@@ -66,26 +72,35 @@
   private ExecutorService executorService;
   private TServer server;
   private HiveMetaStore.HMSHandler baseHandler;
+  private HiveClientPool clientPool;
 
   public void start() {
     try {
-      hiveLocalDir = createTempDirectory("hive", asFileAttribute(fromString("rwxrwxrwx"))).toFile();
+      this.hiveLocalDir = createTempDirectory("hive", asFileAttribute(fromString("rwxrwxrwx"))).toFile();
       File derbyLogFile = new File(hiveLocalDir, "derby.log");
       System.setProperty("derby.stream.error.file", derbyLogFile.getAbsolutePath());
       setupMetastoreDB("jdbc:derby:" + getDerbyPath() + ";create=true");
 
       TServerSocket socket = new TServerSocket(0);
       int port = socket.getServerSocket().getLocalPort();
-      hiveConf = newHiveConf(port);
-      server = newThriftServer(socket, hiveConf);
-      executorService = Executors.newSingleThreadExecutor();
-      executorService.submit(() -> server.serve());
+      this.hiveConf = newHiveConf(port);
+      this.server = newThriftServer(socket, hiveConf);
+      this.executorService = Executors.newSingleThreadExecutor();
+      this.executorService.submit(() -> server.serve());
+
+      // in Hive3, setting this as a system prop ensures that it will be picked up whenever a new HiveConf is created
+      System.setProperty(HiveConf.ConfVars.METASTOREURIS.varname, hiveConf.getVar(HiveConf.ConfVars.METASTOREURIS));

Review comment:
       That's correct. The rationale is outlined here: https://github.com/apache/iceberg/pull/1478#issuecomment-704961465
   As you mentioned, when using Hive3, not all threads spawned during `HiveRunner` initialization receive our custom properties we set on the `HiveShell`, therefore using the system props is there to ensure they're picked up during `HiveConf` construction. This is needed to get the tests working properly on Hive3, without the `PersistenceManager`-related flaky tests.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org