Emmanuel Lecharny wrote:
More to come later, but in the mean time, thanks for your insights !
Fyi, this is why OpenLDAP's documentation states that tight clock
synchronization (thru NTP or similar) is required for MMR.
It makes sense, definitively.
You can have
atomic clocks or WWV radio clock receivers attached to all of your servers,
to achieve the same thing. Also, within the CSN, the numerical ServerID
field imposes an implicit prioritization of the servers...
There is one thing I would like to improve in the CSN definition found
in the draft, is that it's a second based timestamp. Using java 5, we
can have a 10ms accuracy with the System.currentMilis() method. I'm
afraid we can't get a better accuracy ...
The CSN used in OpenLDAP 2.4 uses a generalizedTime stamp with microsecond
resolution. *nix's gettimeofday() provides varying resolution in reality, but
at least the API is defined to the microsecond. If you want to make yourself
nauseous, look at the code I had to write to get equivalent resolution on
Windows...
libraries/liblutil/csn.c:
###
lutil_gettime( &tm );
n = snprintf( buf, len,
"%4d%02d%02d%02d%02d%02d.%06dZ#%06x#%03x#%06x",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_usub, replica, mod );
###
libraries/liblutil/utils.c:
###
/* return a broken out time, with microseconds
* Must be mutex-protected.
*/
#ifdef _WIN32
/* Windows SYSTEMTIME only has 10 millisecond resolution, so we
* also need to use a high resolution timer to get microseconds.
* This is pretty clunky.
*/
void
lutil_gettime( struct lutil_tm *tm )
###
The actual high resolution timer that the Windows HAL chooses varies with OS
revision and motherboard characteristics; in some cases it may be as low as
3.58MHz (NTSC colorburst, from ACPI) but is usually the APIC timer at 12.5MHz
or so. You're kinda lucky that your JVM authors had to deal with this so you
don't see the ugliness...
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/