[NO ISSUE][REP] Extensible Recovery Cleanup

- user model changes: no
- storage format changes: no
- interface changes: no

Details:

- Extensible recovery cleanup after replaying replica
  partitions log.

Change-Id: I57aa7e17026148d2e8d3307a2b82ef4dbc93b910
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12984
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
index ffde7d0..4f5a9f8 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/RecoveryManager.java
@@ -161,14 +161,12 @@
     public void startLocalRecovery(Set<Integer> partitions) throws IOException, ACIDException {
         state = SystemState.RECOVERING;
         LOGGER.info("starting recovery for partitions {}", partitions);
-
         long readableSmallestLSN = logMgr.getReadableSmallestLSN();
         Checkpoint checkpointObject = checkpointManager.getLatest();
         long lowWaterMarkLSN = checkpointObject.getMinMCTFirstLsn();
         if (lowWaterMarkLSN < readableSmallestLSN) {
             lowWaterMarkLSN = readableSmallestLSN;
         }
-
         //delete any recovery files from previous failed recovery attempts
         deleteRecoveryTemporaryFiles();
 
@@ -538,6 +536,7 @@
             if (flush) {
                 appCtx.getDatasetLifecycleManager().flushAllDatasets();
             }
+            cleanUp(partitions);
         } catch (IOException | ACIDException e) {
             throw HyracksDataException.create(e);
         } finally {
@@ -571,6 +570,10 @@
         FileUtils.deleteQuietly(recoveryFolderPath.toFile());
     }
 
+    protected void cleanUp(Set<Integer> partitions) throws HyracksDataException {
+        // the cleanup is currently done by PersistentLocalResourceRepository#clean
+    }
+
     private String getRecoveryDirPath() {
         String logDir = logMgr.getLogManagerProperties().getLogDir();
         if (!logDir.endsWith(File.separator)) {