validations to ensure database setup correctly and a clean slate before starting recovery process
@@ -155,6 +155,17 @@ class RecoveryImpl implements Recovery {
@Override
public int recover() {
+ try {
+ if (stagingEntityDAO.countAll() != 0) {
+ LOGGER.error(
+ "Staging tables are not empty. Please ensure database has been setup correctly for recovery process");
+ return RecoveryResult.FAILURE.getCode();
+ }
+ } catch (PersistenceException ex) {
+ LOGGER.error("Please ensure database has been setup correctly for recovery process");
+ return RecoveryResult.FAILURE.getCode();
+ }
+
final long startTime = System.nanoTime();
LOGGER.debug("Requesting transactions from other nodes");
