Esempio n. 1
0
 /**
  * Return the Transaction for {@code destination} that is backed up to {@code file}. This method
  * will finish committing the transaction before returning.
  *
  * @param destination
  * @param file
  * @return The restored Transaction
  */
 public static void recover(Engine destination, String file) {
   try {
     Transaction transaction =
         new Transaction(
             destination,
             FileSystem.map(file, MapMode.READ_ONLY, 0, FileSystem.getFileSize(file)));
     transaction.invokeSuperDoCommit();
     FileSystem.deleteFile(file);
   } catch (Exception e) {
     Logger.warn(
         "Attempted to recover a transaction from {}, "
             + "but the data is corrupted. This indicates that "
             + "Concourse Server shutdown before the transaction "
             + "could properly commit, so none of the data "
             + "in the transaction has persisted.",
         file);
     Logger.debug("Transaction backup in {} is corrupt because " + "of {}", file, e);
     FileSystem.deleteFile(file);
   }
 }