I am working on a backup application where there are multiple objects to be backed up. When the backup is complete, I stop the backup process and record the end time. For example, if there are about 70 objects to be backed up, the log will contain
backup_id, objName, startTime, endTime
where the startTime
and endTime
will be specific to the backup_id
and not the objName. I wanted to know whether this approach would result in any issues for continuous backup.
In order to replicate the data from the previous backup date, I use
startTime = backup_old_endTime
endTime=backup_curr_startTime
Reading through the docs specified that the following fields have to be maintained for consistency: GetDeleted and GetUpdated.
Should I consider the fields
earliestDateAvailable
andlatestDateCovered
for this continuous backup process, i.e. make backupLog fields specific to each object?The docs under
getDeletedRecord
mentions:If this value is less than endDate, the call will fail, and you should resynch your data before performing another replication.
If I cover the endDate that is after the end date wouldn't that be a safer way? Can anyone give me an instance where it would fail?
EDIT: To make the question more clear, this is the snippet I use for updated and deleted records according to documentation:
GetDeletedResult deletedResult = soapConnection.getDeleted(sObjName, startTime, endTime);
Calendar earliestDate = deletedResult.getEarliestDateAvailable();
long latestDate = deletedResult.getLatestDateCovered().getTimeInMillis();
if (earliestDate.compareTo(endTime) < 0)
LOGGER.error("getDeleted() may fail for " + sObjName + " as it can cover deleted records till "
+ earliestDate.getTimeInMillis());
LOGGER.info("Use " + latestDate + " as the start time for retrieving deleted records for " + sObjName);
The startTime and endTime is the same for all the objects when I run the application. Will this cause an issue?
EDIT2 I got the part for the complete backup covered where I did the method as explained in the answer and mentioned here.
This is what I have:
FULL:
record start_time
for every object
run queryAll() where sysmodstamp <= start_time
write response()
end for
record end_time
for every object
run getUpdated(), getDeleted() with start_time, end_time
end for
for every object
insert into log(job_id, object_name, start_time, end_time)
end for
INCREMENTAL:
get recent_backup_time
record start_time
for every object
run getUpdated(), getDeleted() with recent_backup_time, start_time
insert into log(job_id, object_name, recent_backup_time, start_time)
end for
My main concern is where does the getLatestDateCovered()
and getEarliestDateAvailable()
fit here?