couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Kuprianov <andrey.koupria...@gmail.com>
Subject Re: are auto-generated uuids unique across server-instance
Date Fri, 09 Nov 2012 01:31:10 GMT
Add a postfix to uuid. Just as an idea: uuid+[timetamp in ms]+[server
identifier]

So you will get something
like cc606fe70aa52bd60da6c94835cda3ef-1349789839150-A for a document id.

Then if you output all ids into a view with:

function(doc) {
     emit(doc._id, null);
}

you will get your docs chronologically ordered as you will also know which
server they came from.


On Fri, Nov 9, 2012 at 3:12 AM, svilen <az@svilendobrev.com> wrote:

> i'm asking this because i do have a machine that is 4minutes ahead
> of others.. and thus a few things relying on (sorted-by) local
> clock() timestamp went plop. And everyone-with-own-idea-of-time is
> going to be the norm..
>
> so now i'm looking for some kind of autoincrementing suffix, additional
> to server-side clock being stamped on documents.. coz incoming order
> does matter (multiple in same microsecond). Looked at _local_seq for
> that (by copy into another field to unlocal it), but not sure if it
> is always increasing (or sufficienty "always"). probably is.
>
> anyway, thanks
> svil
>
> On Thu, 8 Nov 2012 10:36:13 -0800
> Mark Hahn <mark@hahnca.com> wrote:
>
> > I use utc_random.  It is really useful.  Easy to sort by creation
> > date. And you can even extract the creation date from the _id and
> > save a field.
> >
> > On Thu, Nov 8, 2012 at 10:21 AM, Robert Newson <rnewson@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > Here's the pertinent information on the various UUID algorithms
> > > CouchDB supports;
> > >
> > > [uuids]
> > > ; Known algorithms:
> > > ;   random - 128 bits of random awesome
> > > ;     All awesome, all the time.
> > > ;   sequential - monotonically increasing ids with random increments
> > > ;     First 26 hex characters are random. Last 6 increment in
> > > ;     random amounts until an overflow occurs. On overflow, the
> > > ;     random prefix is regenerated and the process starts over.
> > > ;   utc_random - Time since Jan 1, 1970 UTC with microseconds
> > > ;     First 14 characters are the time in hex. Last 18 are random.
> > > ;   utc_id - Time since Jan 1, 1970 UTC with microseconds, plus
> > > utc_id_suffix string
> > > ;     First 14 characters are the time in hex. uuids/utc_id_suffix
> > > string value is appended to these.
> > >
> > > The default is "sequential".
> > >
> > > B.
> > >
> > >
> > > On 8 November 2012 18:13, Mark Hahn <mark@hahnca.com> wrote:
> > >
> > > > http://en.wikipedia.org/wiki/Universally_unique_identifier
> > > >
> > > > On Thu, Nov 8, 2012 at 2:31 AM, Andrey Kuprianov <
> > > > andrey.kouprianov@gmail.com> wrote:
> > > >
> > > > > It's a uuid. It's unique wherever
> > > > >
> > > > >
> > > > > On Thu, Nov 8, 2012 at 6:32 PM, svilen <az@svilendobrev.com>
> > > > > wrote:
> > > > >
> > > > > > hi
> > > > > > are auto-generated uuids (when doc is saved without assigned
> > > > > > id) unique across server-instance, or only within the
> > > > > > database?
> > > > > >
> > > > > > i.e. can i take a doc from one database and write
> > > > > > it as-is-without-the-_rev into another database?
> > > > > > can that become a problem?
> > > > > >
> > > > > > ciao
> > > > > > svil
> > > > > >
> > > > > > www.notionery.com
> > > > > > www.svilendobrev.com
> > > > > >
> > > > >
> > > >
> > >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message