Bug 39636

GemStone/S 64 Bit, 2.3.1, 2.3,,,,, 2.2.5, 2.2.x, 2.2, 2.1.4, 2.1.x, 2.0.4, 2.0.x, 1.2.x, 1.1.14, 1.x



Incorrect restore point in timeToRestoreTo:

When the DateTime specified as an argument to Repository >> timeToRestoreTo: has a different offset from GMT as the current time, the calculation of the seconds offset, used internally to perform the restore, is incorrect by the amount of offset.

This occurs for example when one time is during Daylight Savings Time and the other is not; in this case the results will be restored to a time that is incorrect by one hour.


The following is the version of the method containing the fix. File in as SystemUser and commit.
category: 'Backup and Restore'
method: Repository
timeToRestoreTo: aDateTime

"Sets the time at which restoreFromCurrentLogs , restoreFromArchiveLogs,
and restoreToEndOfLog: will stop.
The restore will stop at the first checkpoint which originally occurred at or
after aDateTime. If timeToRestoreTo: has not been used since
restoreFromBackup: completed, then restores will proceed to the end of the
specified transaction log(s).

An error is generated if aDateTime precedes the time of the last restored
checkpoint, as shown by restoreStatus. An error is generated if the receiver
is not in restore-from-log state.

Execution of restoreFromBackup: or commitRestore will cancel the effect of any
previous execution of timeToRestoreTo:.

If restore has stopped at a time specified by this method, then a subsequent
restore may be used to continue restoring past the time specified by the last
timeToRestoreTo:. Alternatively, timeToRestoreTo: can be used to specify
another point in time before continuing the restore.

This method requires the FileControl privilege."

| aTimeT |

"Convert offset from 1901 to 1970 using constant derived from
(DateTime newGmtWithYear: 1970 dayOfYear: 1 milliseconds: 0) asSecondsGmt"

aTimeT := aDateTime asSecondsGmt - 2177452800.

(aTimeT < 0 _or:[ aTimeT > 16r7fffffff]) ifTrue:[
aDateTime _error: #rtErrArgOutOfRange

^ self _restoreFrom: aTimeT opcode: 8

Last updated: 6/2/09