neo4j-apoc-procedures icon indicating copy to clipboard operation
neo4j-apoc-procedures copied to clipboard

Make uuid handlers from apoc.uuid.install persist through restarts

Open JVemmer opened this issue 3 years ago • 3 comments

Guidelines

Please note that GitHub issues are only meant for bug reports/feature requests. If you have questions on how to use APOC, please ask on the Neo4j Discussion Forum instead of creating an issue here.

Feature description (Mandatory)

Do not delete UUID handlers, created via apoc.uuid.install, when Neo4j service is restarted, or create a version of apoc.uuid.install that is persistent; does not need to be the same function call.

Considered alternatives

There really is no good alternative to this. Having something that runs the apoc.uuid.install handler every time the service restarts is really just a bad hack, and I don't really see other options.

How this feature can improve the project?

Ideally this wouldn't require any kind of user interaction. It would just be part of apoc.uuid.install - Once set up, new UUIDs will be just be set on every new node of that label, persisting through reboots, restarts, etc. until removed via either apoc.uuid.remove or apoc.uuid.removeAll. Maybe create a config parameter that allows users to make it temporary (like the current implementation)?

JVemmer avatar Aug 03 '21 13:08 JVemmer

@JVemmer the UUIDs handlers are stored into the system db and restored after a restart. Can you please please detail you issue and the neo4j/apoc version that you're using?

conker84 avatar Aug 03 '21 14:08 conker84

@JVemmer the UUIDs handlers are stored into the system db and restored after a restart. Can you please please detail you issue and the neo4j/apoc version that you're using?

Same setup as used in #2137: OS: Ubuntu 20.04 Neo4j: 4.1.10 Neo4j-Apoc: 4.1.0.9-all

I can issue the apoc.uuid.install command on any number of labels, then run service neo4j restart on the terminal command line and all the handlers are gone, once Neo4j comes back up, as verified via apoc.uuid.list. For testing purposes, I usually run the below cypher query to assign handlers to every single label in the database:

CALL db.labels() YIELD label
WITH label AS database_label
CALL apoc.uuid.install(database_label, {addToExistingNodes: false, uuidProperty: 'uuid', addToSetLabels: true}) YIELD label, installed, properties, batchComputationResult
RETURN label, installed, properties, batchComputationResult
ORDER BY label

I do not appear to be the only with the issue either, based on comments here: https://stackoverflow.com/questions/59760516/how-to-use-uuids-in-neo4j-to-keep-pointers-to-nodes-elsewhere#comment105724024_59760719

JVemmer avatar Aug 03 '21 14:08 JVemmer

An update to this: I upgraded the environment where I tested this to Neo4j 4.3 instead of 4.1. 4.3 (and the related apoc 4.3.0.0) correctly retained uuid handlers through restarts. So it appears fixed in 4.3.

JVemmer avatar Aug 04 '21 10:08 JVemmer

It should have been fixed for 4.4 and 5.x (which are currently the two supported versions).

In case there are still problems, feel free to reopen the issue

vga91 avatar Aug 30 '23 09:08 vga91