Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue #187
  • Loading branch information
rsoika committed Jun 13, 2023
1 parent f30a710 commit 7d8c937
Showing 1 changed file with 42 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,45 +275,48 @@ void onTimeout(javax.ejb.Timer timer) throws Exception {
// print out the snapshotIDs we found
for (String snapshotID : snapshotIDs) {

String latestSnapshot = findLatestSnapshotID(snapshotID, restoreFrom, restoreTo);

// did we found a snapshot to restore?
ItemCollection snapshot;
if (latestSnapshot != null) {
// yes!
// lets see if this snapshot is already restored or synced?
String remoteSnapshotID = remoteAPIService
.readSnapshotIDByUniqueID(dataService.getUniqueID(latestSnapshot));
if (latestSnapshot.equals(remoteSnapshotID)) {
logger.finest(
"......no need to restore - snapshot:" + latestSnapshot + " is up to date!");
} else {
// test the filter options
if (matchFilterOptions(latestSnapshot, options)) {
long _tmpSize = -1;
try {
logger.finest("......restoring: " + latestSnapshot);
snapshot = dataService.loadSnapshot(latestSnapshot);
_tmpSize = dataService.calculateSize(XMLDocumentAdapter.getDocument(snapshot));
logger.finest("......size=: " + _tmpSize);

remoteAPIService.restoreSnapshot(snapshot);

restoreSize = restoreSize + _tmpSize;
restoreCount++;
snapshot = null;
} catch (Exception e) {
logger.severe("...Failed to restore '" + latestSnapshot + "' ("
+ messageService.userFriendlyBytes(_tmpSize) + ") - " + e.getMessage());
restoreErrors++;
}
}
}
} else {
logger.warning(
".... unexpected data situation: we found no latest snapthost matching our restore time range!");
}
}
String latestSnapshot = findLatestSnapshotID(snapshotID, restoreFrom, restoreTo);
// did we found a snapshot to restore?
ItemCollection snapshot;
String remoteSnapshotID = null;
if (latestSnapshot != null) {
// yes, lets see if this snapshot is already restored or synced?
try {
remoteSnapshotID = remoteAPIService
.readSnapshotIDByUniqueID(dataService.getUniqueID(latestSnapshot));
} catch (ArchiveException ae) {
// expected if not found
}
if (remoteSnapshotID != null && latestSnapshot.equals(remoteSnapshotID)) {
logger.finest(
"......no need to restore - snapshot:" + latestSnapshot + " is up to date!");
} else {
// test the filter options
if (matchFilterOptions(latestSnapshot, options)) {
long _tmpSize = -1;
try {
logger.info("......restoring: " + latestSnapshot);
snapshot = dataService.loadSnapshot(latestSnapshot);
_tmpSize = dataService.calculateSize(XMLDocumentAdapter.getDocument(snapshot));
logger.finest("......size=: " + _tmpSize);

remoteAPIService.restoreSnapshot(snapshot);

restoreSize = restoreSize + _tmpSize;
restoreCount++;
snapshot = null;
} catch (Exception e) {
logger.severe("...Failed to restore '" + latestSnapshot + "' ("
+ messageService.userFriendlyBytes(_tmpSize) + ") - " + e.getMessage());
restoreErrors++;
}
}
}
} else {
logger.warning(
".... unexpected data situation: no latest snapshot found, matching requested restore time range!");
}
}
}

// adjust snyncdate for one day....
Expand Down

0 comments on commit 7d8c937

Please sign in to comment.