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 2022/08/03 17:35:32 UTC

[GitHub] [hive] DanielZhu58 commented on a diff in pull request #3477: HIVE-26012: HMS APIs to be enhanced for metadata replication

DanielZhu58 commented on code in PR #3477:
URL: https://github.com/apache/hive/pull/3477#discussion_r936963722


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java:
##########
@@ -3717,4 +3683,103 @@ public void testDropDataConnectorIfNotExistsTrue() throws Exception {
     // No such data connector, ignore NoSuchObjectException
     client.dropDataConnector("no_such_data_connector", true, false);
   }
+
+  @Test
+  public void testIfFSWritesIsSkippedForDatabase() throws Throwable {
+    // create a database, check if the directory is created or not
+    // with true, the directory is not created
+    // with false, the directory is created
+    try {
+      // clear up any existing databases
+      silentDropDatabase(TEST_DB1_NAME);
+
+      String dbLocation =
+              MetastoreConf.getVar(conf, ConfVars.WAREHOUSE_EXTERNAL) + "/testdb1.db";
+      String mgdLocation =
+              MetastoreConf.getVar(conf, ConfVars.WAREHOUSE) + "/testdb1.db";
+
+      CreateDatabaseRequest req = new CreateDatabaseRequest();
+      req.setSkipFSWrites(true);
+      Database db = new DatabaseBuilder()
+              .setName(TEST_DB1_NAME)
+              .setLocation(dbLocation)
+              .setManagedLocation(mgdLocation)
+              .build(conf);
+      req.setDatabase(db);
+      req.setDatabaseName(TEST_DB1_NAME);
+      client.createDatabase(req);
+
+      Path dbPath = new Path(db.getLocationUri());
+      FileSystem fs = FileSystem.get(new Path(dbLocation).toUri(), conf);
+      assertFalse("Database's file system directory is skipped", fs.exists(new Path(dbLocation)));
+      fs = FileSystem.get(new Path(mgdLocation).toUri(), conf);
+      assertTrue("Database's managed location is not skipped", fs.exists(new Path(mgdLocation)));
+    } catch (Throwable e) {
+      System.err.println(StringUtils.stringifyException(e));

Review Comment:
   Sure, I can change it to e.printStackTrace().



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