voonhous commented on code in PR #19575:
URL: https://github.com/apache/hudi/pull/19575#discussion_r3862990025


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/common/HoodieSparkEngineContext.java:
##########
@@ -278,11 +279,43 @@ public String getApplicationId() {
     return javaSparkContext.sc().applicationId();
   }
 
+  /**
+   * Drops a registry from both process-wide maps. Only for tests that create 
their own SparkContexts:
+   * without it they leave accumulators bound to stopped contexts behind for 
whatever runs next in the
+   * same JVM.
+   */
+  @VisibleForTesting
+  public static void removeMetricRegistryForTesting(String tableName, String 
registryName) {
+    DISTRIBUTED_REGISTRY_MAP.remove(tableName.isEmpty() ? registryName : 
tableName + "." + registryName);
+    Registry.REGISTRY_MAP.remove(Registry.makeKey(tableName, registryName));
+  }
+
   @Override
   public Registry getMetricRegistry(String tableName, String registryName) {

Review Comment:
   Agreed on scoping it out. Since 
[16](https://github.com/apache/hudi/pull/19575#discussion_r3853269022), 
[24](https://github.com/apache/hudi/pull/19575#discussion_r3853269071), 
[39](https://github.com/apache/hudi/pull/19575#discussion_r3853269157), 
[41](https://github.com/apache/hudi/pull/19575#discussion_r3853269168) and the 
`Metrics.shutdown` scrape on the `ExecutorMetricRegistry:78` thread all defer 
to this same change and none of them has a tracking artifact yet, could you add 
one checklist line to #19063 listing them, so they are not lost when this 
merges?
   



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

Reply via email to