abstractdog commented on code in PR #3556:
URL: https://github.com/apache/hive/pull/3556#discussion_r963615346


##########
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java:
##########
@@ -3306,22 +3314,38 @@ public void testJDOPersistanceManagerCleanup() throws 
Exception {
       return;
     }
 
-    int numObjectsBeforeClose =  getJDOPersistanceManagerCacheSize();
+    int numObjectsBeforeUse = getJDOPersistanceManagerCacheSize();
     HiveMetaStoreClient closingClient = new HiveMetaStoreClient(conf);
     closingClient.getAllDatabases();
     closingClient.close();
-    Thread.sleep(5 * 1000); // give HMS time to handle close request
-    int numObjectsAfterClose =  getJDOPersistanceManagerCacheSize();
-    assertTrue(numObjectsBeforeClose == numObjectsAfterClose);
 
+    MetastoreTestUtils.waitForAssertion("Checking pm cachesize after client 
close", new Runnable() {
+      @Override
+      public void run() {
+        int numObjectsAfterClose = getJDOPersistanceManagerCacheSize();
+        assertTrue(String.format("numObjectsBeforeUse: %d != 
numObjectsAfterClose: %d", numObjectsBeforeUse,
+            numObjectsAfterClose), numObjectsBeforeUse == 
numObjectsAfterClose);
+      }
+    }, 500, 30000);

Review Comment:
   ack



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