Right, I can leverage that. I could have a ConncurrentSkipListSet<Long> or something with the nodes unique Id in it. If I add() the nodes unique Id to the Set and it returns true, I know I can safely add children. If it returns false then I know another thread beat me to it, and I can requeue the thread
On , Rick Bullotta <[email protected]> wrote: > Not sure it applies, but also remember that the node id itself is > essentially a "unique key" across the entire set of nodes. > -----Original Message----- > From: [email protected] [mailto:[email protected]] > On Behalf Of [email protected] > Sent: Friday, June 10, 2011 3:10 PM > To: Neo4j user discussions > Subject: Re: [Neo4j] unique indexes > The only way I know of is to synchronize writes to the DB. This shouldn't > be a problem for me actually, even with a cluster, since what I really > need > is for each node with a particular relationship to have a unique "name" > property, like how good parents would ensure their children all have > unique > names. I could use terracottta and a concurrent data structure to ensure > there is only one thread writing to a particular node at any given time, > then I'd be guaranteed that checking for existence would work. > -Matt > On , Michael Hunger [email protected]> wrote: > > Another idea is a merge after the fact, so either in a nightly batch or > > during a get operation duplicates are discovered they are merged. > > Cheers > > Michael > > Am 10.06.2011 um 18:55 schrieb Rick Bullotta: > > > Good point. Same would apply to relationship-based indexing, I > suppose. > > In our use case, all of the entities that must be unique are maintained > > in a domain model that is managed by an in-memory hash, so we can > enforce > > it prior to persistence. > > > > > > I suppose that one brute force way would be to synchronize/pipeline > > writes that required a unique index so that the situation of uncommitted > > changes on another transaction could not occur. > > > > > > -----Original Message----- > > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Alexander Smirnov > > > Sent: Friday, June 10, 2011 12:48 PM > > > To: Neo4j user discussions > > > Subject: Re: [Neo4j] unique indexes > > > > > > Check befor update could not help there, because Neo4j does not show > > > uncommited changes to other transactions, so it's possible to store > > > the same value in concurrent transactions. > > > I also tried to figure out how to avoid duplicated values in database. > > > Seems that it needed some locks on database objects. > > > Can someone provide an example how to lock database objects properly ? > > > > > > On Fri, Jun 10, 2011 at 8:01 AM, Rick Bullotta > > > [email protected]> wrote: > > >> If you need to, you could check the existence of a match prior to > > every attempted add/insert/update. > > >> > > >> -----Original Message----- > > >> From: [email protected] > > [mailto:[email protected]] On Behalf Of Matt C > > >> Sent: Friday, June 10, 2011 10:25 AM > > >> To: Neo4j user discussions > > >> Subject: Re: [Neo4j] unique indexes > > >> > > >> An index that would enforce every value added to it be unique. I > don't > > even > > >> see support for that in Lucene, so, nevermind. Just something I'm > used > > to > > >> SQL handling for me. > > >> > > >> On Fri, Jun 10, 2011 at 1:05 AM, Peter Neubauer > > >> [email protected]> wrote: > > >> > > >>> Matt, > > >>> what do you mean by unique indexes? > > >>> > > >>> Cheers, > > >>> > > >>> /peter neubauer > > >>> > > >>> GTalk: neubauer.peter > > >>> Skype peter.neubauer > > >>> Phone +46 704 106975 > > >>> LinkedIn http://www.linkedin.com/in/neubauer > > >>> Twitter http://twitter.com/peterneubauer > > >>> > > >>> http://www.neo4j.org - Your high performance graph database. > > >>> http://startupbootcamp.org/ - Ă–resund - Innovation happens HERE. > > >>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing > > party. > > >>> > > >>> > > >>> > > >>> On Fri, Jun 10, 2011 at 7:30 AM, Matt C [email protected]> > wrote: > > >>>> Sorry if this is covered somewhere, I couldn't find it in the > docs. I > > >>> was > > >>>> wondering if its possible to create unique indexes with the > > >>>> LuceneIndexProvider? > > >>>> > > >>>> -Matt > > >>>> _______________________________________________ > > >>>> Neo4j mailing list > > >>>> [email protected] > > >>>> https://lists.neo4j.org/mailman/listinfo/user > > >>>> > > >>> _______________________________________________ > > >>> Neo4j mailing list > > >>> [email protected] > > >>> https://lists.neo4j.org/mailman/listinfo/user > > >>> > > >> _______________________________________________ > > >> Neo4j mailing list > > >> [email protected] > > >> https://lists.neo4j.org/mailman/listinfo/user > > >> _______________________________________________ > > >> Neo4j mailing list > > >> [email protected] > > >> https://lists.neo4j.org/mailman/listinfo/user > > >> > > > > > > > > > > > > -- > > > _________________ > > > entia non sunt multiplicanda praeter necessitatem, > > > (entities should not be multiplied beyond necessity.) > > > _______________________________________________ > > > Neo4j mailing list > > > [email protected] > > > https://lists.neo4j.org/mailman/listinfo/user > > > _______________________________________________ > > > Neo4j mailing list > > > [email protected] > > > https://lists.neo4j.org/mailman/listinfo/user > > _______________________________________________ > > Neo4j mailing list > > [email protected] > > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

