Skip to content

Conversation

@Lojjs
Copy link
Contributor

@Lojjs Lojjs commented Dec 9, 2025

Also update some licenses after new Neo4j release.

Should be cherry-picked to 5.26.

try {
node = tx.createNode(SystemLabels.ApocTriggerMeta);
node.setProperty(SystemPropertyKeys.database.name(), databaseName);
} catch (ConstraintViolationException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a new transaction or the outer one? because if it is the outer one won't that cause issues for the user later on in the query?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I did not consider this. It looks like the tx is created in withUpdatingTransaction() which is called in the beginning of apoc.trigger.install, apoc.trigger.drop, apoc.trigger.dropAll, apoc.trigger.start, apoc.trigger.stop respectively.
The thread does some work before this method, but it is always commited directly after it. Does that sounds OK?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that should be fine then I think

…ade concurrently.

Also update some licenses after new Neo4j release.
@Lojjs Lojjs force-pushed the surf-419-apoctriggerinstall-fails-due-to-multiple-apoctriggermeta branch from d35d998 to 94e028d Compare December 10, 2025 12:06
Comment on lines 146 to 147
// This can happen if two threads try to create the same node concurrently,
// after both having passed the null check. In this case we can ignore the failing tx.
Copy link
Contributor

@loveleif loveleif Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps at least one retry? Failing to update lastUpdated can result in that the change to triggers will never propagate (I think).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also make it safer by changing:

                    if (getLastUpdate() >= lastUpdate) {
                        updateCache();
                    }

to something like

                    if (getLastUpdate() >= lastUpdate || lastUpdate < reallyOld) {
                        updateCache();
                    }

@Lojjs Lojjs force-pushed the surf-419-apoctriggerinstall-fails-due-to-multiple-apoctriggermeta branch from 3ec4097 to 2dad37e Compare December 11, 2025 08:39
@Lojjs Lojjs merged commit 1bb9a05 into dev Dec 12, 2025
4 of 5 checks passed
@Lojjs Lojjs deleted the surf-419-apoctriggerinstall-fails-due-to-multiple-apoctriggermeta branch December 12, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dev team-cypher-surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants