Synchronizing clocks in a partitioned database environment
To ensure that the log record time stamps reflect the sequence of transactions in a partitioned
database environment, Db2® uses the system clock
and the virtual timestamp stored in the SQLOGCTL.LFH
file on each machine as the
basis for the time stamps in the log records. If, however, the system clock is set ahead, the log
clock is automatically set ahead with it. Although the system clock can be set back, the clock for
the logs cannot, and remains at the same advanced time until the system clock matches this
time. The clocks are then in synchrony. The implication of this is that a short term system clock
error on a database node can have a long lasting effect on the time stamps of database logs.
For example, assume that the system clock on database partition server A is mistakenly set to November 7, 2005 when the year is 2003, and assume that the mistake is corrected after an update transaction is committed in the database partition at that database partition server. If the database is in continual use, and is regularly updated over time, any point between November 7, 2003 and November 7, 2005 is virtually unreachable through rollforward recovery. When the COMMIT on database partition server A completes, the time stamp in the database log is set to 2005, and the log clock remains at November 7, 2005 until the system clock matches this time. If you attempt to roll forward to a point in time within this time frame, the operation will stop at the first time stamp that is beyond the specified stop point, which is November 7, 2003.
- The configurable values for this parameter range from 1 minute to 24 hours.
- When the first connection request is made to a non-catalog partition, the database partition server sends its time to the catalog partition for the database. The catalog partition then checks that the time on the database partition requesting the connection, and its own time are within the range specified by the max_time_diff parameter. If this range is exceeded, the connection is refused.
- An update transaction that involves more than two database partition servers in the database must verify that the clocks on the participating database partition servers are in synchrony before the update can be committed. If two or more database partition servers have a time difference that exceeds the limit allowed by max_time_diff, the transaction is rolled back to prevent the incorrect time from being propagated to other database partition servers.