Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 17C27200CA6 for ; Tue, 13 Jun 2017 15:32:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 16012160BDC; Tue, 13 Jun 2017 13:32:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 38900160BC9 for ; Tue, 13 Jun 2017 15:32:30 +0200 (CEST) Received: (qmail 60047 invoked by uid 500); 13 Jun 2017 13:32:29 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 60037 invoked by uid 99); 13 Jun 2017 13:32:29 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jun 2017 13:32:29 +0000 Received: from mail-yw0-f176.google.com (mail-yw0-f176.google.com [209.85.161.176]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 7C5B41A00A8 for ; Tue, 13 Jun 2017 13:32:27 +0000 (UTC) Received: by mail-yw0-f176.google.com with SMTP id l75so49078554ywc.3 for ; Tue, 13 Jun 2017 06:32:27 -0700 (PDT) X-Gm-Message-State: AKS2vOyMcyjKjmylMFK91mPZS08Fe3U2/MlbKS7dILZyyazDz+eoN/Ii yOs0cjvnloYxqhrW54reVaYwPRL3S/zw X-Received: by 10.129.168.131 with SMTP id f125mr3387374ywh.93.1497360746235; Tue, 13 Jun 2017 06:32:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.239.69 with HTTP; Tue, 13 Jun 2017 06:32:25 -0700 (PDT) In-Reply-To: References: From: Nikolai Tikhonov Date: Tue, 13 Jun 2017 16:32:25 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Grid/Cluster unique UUID possible with IgniteUuid? To: user@ignite.apache.org Content-Type: multipart/alternative; boundary="94eb2c13cbe261914c0551d7774b" archived-at: Tue, 13 Jun 2017 13:32:31 -0000 --94eb2c13cbe261914c0551d7774b Content-Type: text/plain; charset="UTF-8" Muthu, Look at Ignite Uuid#randomUuid() method. I think it will provide needed guarantees for your case. On Mon, Jun 12, 2017 at 9:53 PM, Muthu wrote: > Thanks Nikolai..this is what i am doing...not sure if this is too > much..what do you think..the goal is to make sure that a UUID is unique > across the entire application (the problem is each node that is part of the > cluster would be doing this for different entities that it owns) > > ... > ... > System.out.println("==== in ObjectCacheMgrService.insertDepartment ==== > for dept : " + dept); > long t1 = System.currentTimeMillis(); > *String uUID = new IgniteUuid(UUID.randomUUID(), > igniteAtomicSequence.incrementAndGet()).toString();* > long t2 = System.currentTimeMillis(); > System.out.println("Time for UUID generation (millis) : " + (t2 - t1)); > *dept.setId(uUID);* > * deptCache.getAndPut(uUID, dept);* > System.out.println("==== in ObjectCacheMgrService.insertDepartment : > department ==== inserted successfully : " + dept); > ... > ... > > Regards, > Muthu > > On Mon, Jun 12, 2017 at 3:24 AM, Nikolai Tikhonov > wrote: > >> Muthu, >> >> Yes, you can use IgniteUUID as unique ID generator. What you will use >> depends your requirements. IgniteAtomicSequence takes one long and >> IgniteUUID takes 3 long. But getting new range sequence is distributed >> operation. You need to decied what more critical for your. >> >> On Fri, Jun 9, 2017 at 8:46 PM, Muthu wrote: >> >>> >>> Missed adding this one...i know there is support for ID generation with >>> IgniteAtomicSequence @ https://apacheignite.readme.io/docs/id-generator >>> >>> The question is which one should i use...i want to use this to generate >>> unique ids for entities that are to be cached & persisted.. >>> >>> Regards, >>> Muthu >>> >>> >>> On Fri, Jun 9, 2017 at 10:27 AM, Muthu >>> wrote: >>> >>>> Hi Folks, >>>> >>>> Is it possible to generate a Grid/Cluster unique UUID using IgniteUuid. >>>> I looked at the source code & static factory method *randomUuid >>>> *(). >>>> It looks like it generates one with with a java.util.UUID (generated with >>>> its randomUUID) & an AutomicLong's incrementAndGet >>>> >>>> Can i safely assume that given that it uses a combination of UUID & >>>> long on the individual VMs that are part of the Grid/Cluster it will be >>>> unique or is there a better way? >>>> >>>> Regards, >>>> Muthu >>>> >>> >>> >> > --94eb2c13cbe261914c0551d7774b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Muthu,

Look at Ignite Uuid#randomUuid()= method. I think it will provide needed guarantees for your case.

On Mon, Jun 12, 2017 = at 9:53 PM, Muthu <muthu.kumaran.l@gmail.com> wrote:=
Thanks Nikolai..this is= what i am doing...not sure if this is too much..what do you think..the goa= l is to make sure that a UUID is unique across the entire application (the = problem is each node that is part of the cluster would be doing this for di= fferent entities that it owns)

...
...
<= div> System.out.println("=3D=3D=3D=3D in Object= CacheMgrService.insertDepartment =3D=3D=3D=3D for dept : " + dept= );
long t1 =3D System.currentTimeMillis()= ;
String uUID =3D new IgniteUuid(UUID.= randomUUID(), igniteAtomicSequence.incrementAndGet()).toString();<= /div>
long t2 =3D System.currentTimeMillis();=
System.out.println("Time for UUID = generation (millis) : " + (t2 - t1));
dept.setId(uUID);
deptCache.g= etAndPut(uUID, dept);
System.out.prin= tln("=3D=3D=3D=3D in ObjectCacheMgrService.insertDepartment : dep= artment =3D=3D=3D=3D inserted successfully : " + dept);
...
...

Regards,
Muth= u

On Mon, Jun 12, 2017 at 3:24 AM, Nikolai Tik= honov <ntikhonov@apache.org> wrote:
Muthu,

Yes, you can use IgniteUUID as unique ID generator. What you will use depe= nds your requirements. IgniteAtomicSequence takes one long and IgniteUUID t= akes 3 long. But getting new range sequence is distributed operation. You n= eed to decied what more critical for your.

On Fri, Jun 9, 2017= at 8:46 PM, Muthu <muthu.kumaran.l@gmail.com> wrote= :

Missed adding this one...i know there is support for ID ge= neration with IgniteAtomicSequence @ https://apacheignite.readme.io/docs/id-generator

The question is which one should i use...i want to use th= is to generate unique ids for entities that are to be cached & persiste= d..

Regards,
Muthu


On Fri, Jun 9, 2017 at 10:27 AM, Muthu <muthu.kumaran.l@gmail.com> wrote:
Hi Folks,
=
Is it possible to generate a Grid/Cluster unique UUID using = IgniteUuid. I looked at the source code & static factory method=C2=A0randomUu= id(). It looks like it generates one with with a java.util.UUI= D (generated with its randomUUID) & an AutomicLong's incrementAndGe= t

Can i safely assume that given that it uses a co= mbination of UUID & long on the individual VMs that are part of the Gri= d/Cluster it will be unique or is there a better way?

Reg= ards,
Muthu




--94eb2c13cbe261914c0551d7774b--