Leap Second and MarkLogic Server
23 January 2015 06:10 PM
A leap second, as defined by wikipedia is "a one-second adjustment that is occasionally applied to Coordinated Universal Time (UTC) in order to keep its time of day close to the mean solar time. Without such a correction, time reckoned by Earth's rotation drifts away from atomic time because of irregularities in the Earth's rate of rotation." At the time of this writing, the next leap second to be inserted is on June 30, 2015 at 23:59:60 UTC.
For systems that use the Network Time Protocol (NTP) to synchronize the network time across all the host in their MarkLogic Cluster, the Marklogic Server Software is not impacted by the leap second (i.e. we expect everything to work fine at the MarkLogic layer)
For systems where the synchronization of their system clocks require UTC time to be set backwards, then anywhere time dependent data is stored, it must be accounted for. In this case, we recommend that our customers implement NTP in their environment. Otherwise, the application layer will need to handle discontinuous time.
The algorithm that MarkLogic Server uses to maintain transactional consistency of data is not wall clock dependent and, as such, is not affected by the leap second.
Network Time Protocol (NTP)
NTP generally works really really hard not to make time go backwards as clock readings are constrained to always increase - every reading increases the NTP clock. NTP adjusts things gradually by slowing down or speeding up the clock and not by making discrete changes unless time is off by a lot. A second is not a lot. An hour is a lot. Regardless of the leap second, adjustments for computer clock drift can easily be more than a second and happen frequently.
When Time Goes Backwards
Without NTP and left on their own, computer clocks are really not that accurate. If synchronization of the system clocks on the hosts of a MarkLogic cluster require the clocks to be set backwards, then the application layer will need to account for and handle discontinuous date-time in their data.
Beginning with MarkLogic Server version 8, the temporal feature was introduced. If the system clock is adjusted backwards, there are conditions where temporal document inserts and updates will fail with an appropriate error code. This is by design and expected.
Our recommendation is to implement NTP on all hosts of a MarkLogic cluster to eliminate the need to handle discontinuous time at the application layer.
Redhat article on the Leap Second - https://access.redhat.com/articles/15145 ;
Microsoft Support article on the Leap Second - http://support.microsoft.com/kb/909614 ;