Bug 51350

GemStone/S 64 Bit

3.7.2, 3.7.1, 3.7, 3.6.8, 3.6.7, 3.6.6, 3.6.5, 3.6.4, 3.6.3, 3.6.2, 3.6.1, 3.6, 3.5.8, 3.5.7, 3.5.6, 3.5.5, 3.5.4, 3.5.3, 3.5.2, 3.5.1, 3.5.x, 3.4.x, earlier versions

SystemRepository restoreToPointInTime: may fail with GS and OS timezone mismatch

SystemRepository restoreToPointInTime: restores tranlogs, stopping at the next checkpoint after the specified time. This method is executed after a restoreFromBackup or earlier partial tranlog restore, and does a check that the time being restored to is not earlier than the last restore time.

This time check queries for the repository's restore time, which is reported in OS time, while the argument to this method is normally provided in the repository's configured time. If the repository is configured to be in a timezone other than the OS timezone, this test may fail depending on the direction of the timezone offset.

The query that fetches the restored-to time for the repository is not reported in a format that can be correctly used for the DateTime comparison, due to the difference in timezones.

Only the validation against a too-early DateTime argument fails; otherwise the restore operations are internally handled in seconds since the Repository's zero time, so tranlog records are restored correctly up to the next checkpoint.

Workaround

Comment out the check. As SystemUser, file in the code below and commit.  Note that for this to be available after a restore from backup, you must commit this method change to the image before making the backup.

With this validation removed, if you specify a DateTime earlier than the repository's restoreTo time, it will now restore the tranlog records in the first tranlog that are before first checkpoint in that tranlog. This should not be an issue for expected uses of restoreToPointInTime:.

method: Repository
_checkPointInTime: aDateTime

| checkpointTime aTimeT |
"self restoreStatusTimeRestoredTo ifNotNil:[ :tStr |
  checkpointTime := DateTime fromString: ((tStr) copyFrom: 1 to: 17) usingFormat: #( 1 2 3 $/ 1 2 $: true true false ).
  aDateTime < checkpointTime  ifTrue: [
    ImproperOperation signal: ( 'aDateTime ' , aDateTime asString ,
      ' is less than restoreStatusTimeRestoredTo ' ,
     self restoreStatusTimeRestoredTo)
  ].
]."

aTimeT := aDateTime asSecondsGmt - 2177452800.
(aTimeT < 0 or:[ aTimeT > 16r7fffffff]) ifTrue:[
  aDateTime _error: #rtErrArgOutOfRange args:{ 0 . 16r7fffffff }
  ].
^ aTimeT
%

Last updated: 3/18/25