Neo4J ID Recycling

298 views
Skip to first unread message

Cres

unread,
Jan 27, 2012, 1:18:16 PM1/27/12
to Neo4j
Hi.
I'm trying to figure out how exactly the ID recycling mechanism works
in Neo4J.
Searching for an answer online, I found a few contradicting replies:

1) http://stackoverflow.com/questions/8359735/deleted-node-reappears-in-neo4j
the above link says that ID Recycling has to be enabled, and isn't
enabled by default. On the other hand, it says the exact opposite
(plus that ID recycling can't be disabled at all) on this link-
http://neo4j.org/nabble/#nabble-td2874501

2) http://neo4j.org/nabble/#nabble-td3493935
One of the comments in the above link mentions that IDs that were
deleted in one instance of Neo4J won't be reused in the same run, but
instead will be saved to the disk, and can only get recycled at the
earliest in the next run (when a new instance is created). I've dived
into the code in IdGeneratorImpl and I'm pretty sure that's not the
case - meaning, I think ID recycling can happen within the context of
one run, i.e. an ID which was removed will get reused without taking
down and restarting the application.

So my question is, which is correct? Can ID Recycling be disabled? If
not, can it happen within the same run?

Thank you.

Peter Neubauer

unread,
Feb 8, 2012, 8:19:19 AM2/8/12
to ne...@googlegroups.com
Hi Ran,
right now ID-recycling cannot be disabled, just checked with Matthias.
However, it should not be a big deal to introduce a setting not to
reclaim IDs. Could you please raise a feature request?

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.6 released                 - dzone.com/6S4K
The Neo4j Heroku Challenge   - http://neo4j-challenge.herokuapp.com/

Cres

unread,
Feb 8, 2012, 8:31:14 AM2/8/12
to Neo4j
Hi Peter,
yes, I will.
I was wondering though, if you could possibly verify with Matthias
whether I'm also correct about ID-recycling possibly occurring for IDs
which were freed during the same run? as I mentioned in the original
question, I've seen some who claim otherwise, but I think they're
mistaken (even though I'd be happy if this was actually the case,
since then I could "ignore" the ID recycling mechanism for my
purposes...)

Thanks,
Ran.


On Feb 8, 3:19 pm, Peter Neubauer <peter.neuba...@neotechnology.com>
wrote:
> Hi Ran,
> right now ID-recycling cannot be disabled, just checked with Matthias.
> However, it should not be a big deal to introduce a setting not to
> reclaim IDs. Could you please raise a feature request?
>
> Cheers,
>
> /peter neubauer
>
> G:  neubauer.peter
> S:  peter.neubauer
> P:  +46 704 106975
> L:   http://www.linkedin.com/in/neubauer
> T:   @peterneubauer
>
> Neo4j 1.6 released                 - dzone.com/6S4K
> The Neo4j Heroku Challenge   -http://neo4j-challenge.herokuapp.com/
>
>
>
>
>
>
>
> On Fri, Jan 27, 2012 at 7:18 PM, Cres <cre...@gmail.com> wrote:
> > Hi.
> > I'm trying to figure out how exactly the ID recycling mechanism works
> > in Neo4J.
> > Searching for an answer online, I found a few contradicting replies:
>
> > 1)http://stackoverflow.com/questions/8359735/deleted-node-reappears-in-...
> > the above link says that ID Recycling has to be enabled, and isn't
> > enabled by default. On the other hand, it says the exact opposite
> > (plus that ID recycling can't be disabled at all) on this link-
> >http://neo4j.org/nabble/#nabble-td2874501
>
> > 2)http://neo4j.org/nabble/#nabble-td3493935

Mattias Persson

unread,
Feb 9, 2012, 4:20:09 AM2/9/12
to ne...@googlegroups.com
Hi,

Pre 1.5 all recycling of ids would have to wait for the next clean db restart. In 1.5 and up to now id reuse within the same session is enabled for properties, main reasons being less disk space and that it's ok since properties hasn't got their ids publicly visible.

2012/2/8 Cres <cre...@gmail.com>



--
Mattias Persson, [mat...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com

Cres

unread,
Feb 12, 2012, 4:13:41 AM2/12/12
to Neo4j
Hi,
thank you for your response,
one final question I have on this subject is whether there are any
plans to make node/relationship IDs also be reused in the same session
in the future? and if so will there be any way to disable this?
Thank you again,
Ran.
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technologywww.neotechnology.com

Mattias Persson

unread,
Feb 13, 2012, 4:32:29 PM2/13/12
to ne...@googlegroups.com
I don't think so, but ids will perhaps vanish completely from the API in favor of other/external means of identifying entities... that way it would be a non-issue.

2012/2/12 Cres <cre...@gmail.com>

Tomas Teicher

unread,
May 3, 2012, 8:27:42 AM5/3/12
to ne...@googlegroups.com
What if I have mutliple sessions opened at once? when one of clients close his session and create new one, it is safe to use node IDs from second client who had open session whole time?

Tomas

Is it safe to use 

Dňa pondelok, 13. februára 2012 22:32:29 UTC+1 Mattias Persson napísal(-a):

Mattias Persson

unread,
May 5, 2012, 4:50:37 AM5/5/12
to ne...@googlegroups.com
You mean as in an HA environment? In HA ids are pulled from the master so the slave doesn't generate them on their own.

2012/5/3 Tomas Teicher <tomast...@gmail.com>

Peter Neubauer

unread,
Jun 13, 2012, 12:00:32 AM6/13/12
to ne...@googlegroups.com

The default is for the id to be reused.

/peter

Send from mobile.

On Jun 12, 2012 11:42 PM, "Chris Lock" <chris....@gmail.com> wrote:
So I saw Properties addressed here.  What about Node and Relationships?

I have v1.7 Community.  If I delete a Node, can I expect the ID to be reused?  Is this default or must I enable it somehow?

Thanks

Mattias Persson

unread,
Jun 13, 2012, 2:36:55 AM6/13/12
to ne...@googlegroups.com


2012/6/13 Peter Neubauer <neubaue...@gmail.com>

The default is for the id to be reused.


But not in the same session, i.e. you need to do a clean shutdown in between deletion and reuse.
Reply all
Reply to author
Forward
0 new messages