soumyakanti3578 commented on code in PR #6383:
URL: https://github.com/apache/hive/pull/6383#discussion_r3018650920


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/tools/schematool/TestSchemaToolForMetastore.java:
##########
@@ -486,6 +486,161 @@ public void testMetastoreDbPropertiesAfterUpgrade() 
throws HiveMetaException, IO
     validateMetastoreDbPropertiesTable();
   }
 
+  /**
+   * Runs {@code ddlScripts} twice. The first run applies all DDL normally. 
The second run
+   * re-runs the same script from scratch — exactly as a re-run of a failed 
upgrade would —
+   * and must not throw, because {@link IdempotentDDLExecutor} swallows 
"already exists" and
+   * "already gone" errors via {@link DbErrorCodes}.
+   */
+  private void executeWithIdempotencyCheck(String testName, String[] 
ddlScripts) throws Exception {
+    File scriptFile = generateTestScript(ddlScripts);
+    try {
+      schemaTool.execSql(scriptFile.getPath());
+    } catch (Exception e) {
+      Assert.fail("[" + testName + "] First run failed for " + 
dbms.getDbType() + ": " + e.getMessage());
+    }
+    try {
+      schemaTool.execSql(scriptFile.getPath());
+    } catch (IOException e) {
+      Assert.fail("[" + testName + "] Idempotent retry failed for " + 
dbms.getDbType()
+          + " — DbErrorCodes did not cover the error: " + e.getMessage());

Review Comment:
   I will apply this change.



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