I deleted root=node(0) by accident, now what?

953 views
Skip to first unread message

Mat Tyndall

unread,
Jun 5, 2012, 7:35:43 PM6/5/12
to Neo4j
So I accidentally deleted node 0 while deleting relationships in the
data browser since it defaults to 0 instead of an adjacent node
(follow the arrow by default instead?).

Unfortunately, I used node 0 as the root in my code (node.js) to find
everything else. I could create a new root but then I'll have problems
syncing between local and online databases. I could use indexes
instead but that still creates annoying initialization problems. It
doesn't help that looking up nodes that don't exist is bad with
Cypher.

I know I can fix this, but it seems like a much bigger headache than
necessary since there is no way to create a new node(0) or undelete a
node.

Michael Hunger

unread,
Jun 6, 2012, 3:06:09 AM6/6/12
to ne...@googlegroups.com
You're right that's annoying.

I think it would make sense to have a confirmation dialog in webadmin when deleting node 0.

Can you raise a github issue for that?

Sorry for the extra work. How big is your db and can your recreate it, or export / import it into another db?

A simple way to do that is just to iterate over all nodes and relationships and recreate them and their properties.

If you need help for that I can provide you with a tool.

Michael

TheOutlander

unread,
Jun 7, 2012, 3:07:37 AM6/7/12
to ne...@googlegroups.com
Can this be an issue in Production where we could delete the root accidentally in code?? Wonder how many people have faced that problem.

-Nick

Michael Hunger

unread,
Jun 7, 2012, 3:15:17 AM6/7/12
to ne...@googlegroups.com
So far we haven't see that issue in production, only in development but it is better to be safe than sorry.

So can you please add two issues to github.com/neo4j/community
# a confirmation dialog in webadmin for the ref-node
# configurable option that inhibits deleting the root node

Thanks a lot

Michael

Peter Neubauer

unread,
Jun 7, 2012, 3:16:01 AM6/7/12
to ne...@googlegroups.com

Mmh,
That is why cascading deletion is not the default on the Java and REST apis. Webadmin was considered to be mostly for testing and introspection.

If you want to reliable address nodes, then I would consider using and index to store your root node and look it up instead of having an absolute id?

Send from mobile.

TheOutlander

unread,
Jun 7, 2012, 5:05:57 AM6/7/12
to ne...@googlegroups.com
Created Issue #590 and #591. Feel free to add any details as I'm new here and haven't followed any format for opening this.

Thanks,
Nick

Michael Hunger

unread,
Jun 7, 2012, 5:11:45 AM6/7/12
to ne...@googlegroups.com
That's fine, thanks a lot

Were you able to fix your db?

Michael

Neil Barnwell

unread,
Jun 8, 2012, 10:03:11 AM6/8/12
to ne...@googlegroups.com
It's possibly not my place, but I just wanted to throw my ten-penneth in.

Rather than adding functionality to the web admin interface, what about the more general solution of "locked" nodes/relationships? In a fresh database node 0 would be locked (though locking would generally be opt-in). Cascading deletes and accidents like the OP described would then throw a "CannotDeleteLockedObject" exception of some sort.

This idea is borrowed from digital cameras, which often offer this feature so you don't accidentally delete a favourite shot from your memory card when trying to free-up space.

HTH.

Neil.

Rick Otten

unread,
Jun 8, 2012, 10:38:57 AM6/8/12
to ne...@googlegroups.com

This sounds almost like being able to set ACL’s on nodes and relationships (except without the users and roles bit).

 

Why not go all the way and mark them for read, update, and delete ?  Throw in an equivalent to “insert”  to mean you are not allowed to create a relationship to or from this node.  I can’t think of a case where with only one user you’d ever want to take away ‘read’ permissions, so that would be the most basic permission level.

 

By default node 0 would be read only.  All of the other nodes, unless otherwise specified would default to read,update,insert,delete.

 

The biggest issue I could see with this is the performance overhead of having to check permissions when you are mutating the graph.

Mat Tyndall

unread,
Jun 8, 2012, 2:35:40 PM6/8/12
to Neo4j
So the solution I wound up going with was to just create a new
database, it was the simplest solution since the db was small.

The main reason I went with a reset is because with a fresh db all I
can count on is that there's a node 0, indexes and other nodes may or
may not exist.

I'm all in favor of changes that protect a root/reference node.

Thanks for all the replies,

-Mat

On Jun 8, 7:38 am, Rick Otten <rot...@manta.com> wrote:
> This sounds almost like being able to set ACL’s on nodes and relationships (except without the users and roles bit).
>
> Why not go all the way and mark them for read, update, and delete ?  Throw in an equivalent to “insert”  to mean you are not allowed to create a relationship to or from this node.  I can’t think of a case where with only one user you’d ever want to take away ‘read’ permissions, so that would be the most basic permission level.
>
> By default node 0 would be read only.  All of the other nodes, unless otherwise specified would default to read,update,insert,delete.
>
> The biggest issue I could see with this is the performance overhead of having to check permissions when you are mutating the graph.
>
> From: ne...@googlegroups.com [mailto:ne...@googlegroups.com] On Behalf Of Neil Barnwell
> Sent: Friday, June 08, 2012 10:03 AM
> To: ne...@googlegroups.com
> Subject: Re: [Neo4j] I deleted root=node(0) by accident, now what?
>
> It's possibly not my place, but I just wanted to throw my ten-penneth in.
>
> Rather than adding functionality to the web admin interface, what about the more general solution of "locked" nodes/relationships? In a fresh database node 0 would be locked (though locking would generally be opt-in). Cascading deletes and accidents like the OP described would then throw a "CannotDeleteLockedObject" exception of some sort.
>
> This idea is borrowed from digital cameras, which often offer this feature so you don't accidentally delete a favourite shot from your memory card when trying to free-up space.
>
> HTH.
>
> Neil.
>
> On Thursday, June 7, 2012 8:15:17 AM UTC+1, Michael Hunger wrote:
>
> So far we haven't see that issue in production, only in development but it is better to be safe than sorry.
>
> So can you please add two issues to github.com/neo4j/community<http://github.com/neo4j/community>

Peter Neubauer

unread,
Jun 10, 2012, 4:24:21 AM6/10/12
to ne...@googlegroups.com

Mat,
Could you please raise a feature request for this?

Send from mobile.

Sean Sill

unread,
Jan 30, 2014, 8:58:44 AM1/30/14
to ne...@googlegroups.com
Any updates on this particular problem?

Michael Hunger

unread,
Jan 30, 2014, 9:33:41 AM1/30/14
to ne...@googlegroups.com
Sean,

the reference node was removed in Neo4j 2.0 so it shouldn't be a problem.

Otherwise just shut down your db, so that id's will be reused and after startup the next created node will get id 0.

Michael

-- 
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sean Sill

unread,
Jan 30, 2014, 9:34:56 AM1/30/14
to ne...@googlegroups.com
Fantastic!

Thanks!


--
You received this message because you are subscribed to a topic in the Google Groups "Neo4j" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/neo4j/Sb2ANlJtLDY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to neo4j+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Sean Sill
Electronic Systems Consultant/Contractor
Electrical and Computer Engineering Alumni from
Missouri University of Science and Technology(Missouri S&T)
Reply all
Reply to author
Forward
0 new messages