[NO ISSUE][STO] Delete Resource Metadata Mask After Checkpoint

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

Details:
- Delete the resource metadata mask file only after
  the initial checkpoint has been created.

Change-Id: I2bd4412ed878dabbb470bab01a9430ed2b94d2db
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2768
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
index 7fe1d1f..7cd31bb 100644
--- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
+++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceRepository.java
@@ -202,9 +202,9 @@
         } catch (IOException e) {
             throw HyracksDataException.create(e);
         }
+        indexCheckpointManagerProvider.get(DatasetResourceReference.of(resource)).init(null, 0);
         deleteResourceFileMask(resourceFile);
         resourceCache.put(resource.getPath(), resource);
-        indexCheckpointManagerProvider.get(DatasetResourceReference.of(resource)).init(null, 0);
         //if replication enabled, send resource metadata info to remote nodes
         if (isReplicationEnabled) {
             createReplicationJob(ReplicationOperation.REPLICATE, resourceFile);