couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Newson (Commented) (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1405) error generating document id with utc_random
Date Thu, 09 Feb 2012 11:22:59 GMT


Robert Newson commented on COUCHDB-1405:

I know, from bitter experience, that timekeeping in some hypervisors is pretty lousy. Specifically,
I've experienced every kind of clock-goes-wrong event inside VMWare guests.

I doubt that erlang:now()'s behavior of never returning the same value twice is at fault here
(it's certainly *not* just returning the CMOS value but the difference should be negligible).
I'd further argue that attempting to get an absolute guarantee of consistent time across a
cluster is doomed to failure. You can get very close but unless you're prepared to synchronously
consult a single external time authority every time (and to fail when it's unavailable) there
will be mistakes. The only alternative I've found is to implement a fault-tolerant consensus
mechanism (oh, it's that easy, huh?). The better solution is to not require this kind of synchronization
in the first place.

In non-virtual situations, NTP is your friend. In virtual situations, NTP is your enemy. Your
virtual host should be configured to set the time in all guests and the guests should generally
*not* use NTP. Since the guests are not necessarily getting every clock cycle they believe
they are, the NTP auto correction algorithms can get confused, ironically making things worse,
not better.

> error generating document id with utc_random
> --------------------------------------------
>                 Key: COUCHDB-1405
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 1.1.1
>         Environment: Windows 7, 64-bit, running as virtual pc in hyper-v
>            Reporter: André Bögge
>              Labels: Hyper-V
> I use the utc_random algorithm for generating document ids. So it's possible for me to
calculate time and date out of the id in my client application. After running CouchDB for
about a month i got a difference between system time and calculated time of id of about half
an hour. I restarted the database and even then i got a difference about 1 minute.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message