ayushtkn commented on code in PR #6991:
URL: https://github.com/apache/hive/pull/6991#discussion_r4773545524


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java:
##########
@@ -1405,6 +1407,74 @@ public void testDatabaseLocationOnDrop() throws 
Throwable {
     }
   }
 
+  /**
+   * HIVE-30284: DROP DATABASE CASCADE must delete the managed dir even when
+   * table count exceeds {@link ConfVars#BATCH_RETRIEVE_MAX} (i.e. the
+   * dropDatabaseCascadePerTable path). Uses txnId=0 + softDelete=false to
+   * match what Hive.dropDatabase sends on a non-ACID session.
+   */
+  @Test
+  public void testDropDatabaseCascadeDeletesManagedDirForLargeDb() throws 
Throwable {
+    silentDropDatabase(TEST_DB1_NAME);
+
+    String dbLocation =
+        MetastoreConf.getVar(conf, ConfVars.WAREHOUSE_EXTERNAL) + 
"/testdb_cascade.db";
+    String mgdLocation =
+        MetastoreConf.getVar(conf, ConfVars.WAREHOUSE) + "/testdb_cascade.db";
+    new DatabaseBuilder()
+        .setName(TEST_DB1_NAME)
+        .setLocation(dbLocation)
+        .setManagedLocation(mgdLocation)
+        .create(client, conf);
+
+    // Use the URI the server assigned so transformers / auth rewrites are 
honoured.
+    Path mgdPath = new 
Path(client.getDatabase(TEST_DB1_NAME).getManagedLocationUri());
+
+    // setUp() sets BATCH_RETRIEVE_MAX=2, so 3 tables forces 
dropDatabaseCascadePerTable.
+    int numTables = (int) MetastoreConf.getLongVar(conf, 
ConfVars.BATCH_RETRIEVE_MAX) + 1;
+    for (int i = 0; i < numTables; i++) {
+      new TableBuilder()
+          .setDbName(TEST_DB1_NAME)
+          .setTableName("t_" + i)
+          .addCol("id", ColumnType.INT_TYPE_NAME)
+          .create(client, conf);
+    }
+
+    FileSystem mgdFs = FileSystem.get(mgdPath.toUri(), conf);
+    org.junit.Assume.assumeTrue(

Review Comment:
   `Assume.assumeTrue` can silently skip the test and hide a regression — 
consider a hard assertTrue instead.
   
   `org.junit.Assume` is fully qualified inline; use a normal import in any 
case :-) 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to