XComp commented on code in PR #23424:
URL: https://github.com/apache/flink/pull/23424#discussion_r1345865694
##########
flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java:
##########
@@ -498,12 +498,15 @@ protected CompletableFuture<Void>
stopClusterServices(boolean cleanupHaData) {
}
if (haServices != null) {
- try {
- if (cleanupHaData) {
- haServices.closeAndCleanupAllData();
- } else {
- haServices.close();
+ if (cleanupHaData) {
Review Comment:
Initially, I thought that it would be nicer code afterwards by just removing
the if/else. But you're right with having separate try/catch blocks as well
(which unfortunately, makes the code less readable).
We could introduce a default implementation
{{HighAvailabilityServices#closeWithOptionalClean(boolean)}} that does this
optional cleanup while closing the services. That would remove the redundant
code from {{MiniCluster}} and {{ClusterEntrypoint}}.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/HighAvailabilityServices.java:
##########
@@ -212,19 +212,17 @@ default LeaderRetrievalService
getClusterRestEndpointLeaderRetriever() {
void close() throws Exception;
/**
- * Closes the high availability services (releasing all resources) and
deletes all data stored
- * by these services in external stores.
+ * Deletes all data stored by high availability services in external
stores.
*
* <p>After this method was called, the any job or session that was
managed by these high
Review Comment:
```suggestion
* <p>After this method was called, any job or session that was managed
by these high
```
nit
##########
flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/HighAvailabilityServices.java:
##########
@@ -212,19 +212,17 @@ default LeaderRetrievalService
getClusterRestEndpointLeaderRetriever() {
void close() throws Exception;
Review Comment:
Keep the method to keep the JavaDoc. But we could make
{{HighAvailabilityServices}} extend {{AutoCloseable}}.
--
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]