-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix XQuery Trigger chaining #4280
Fix XQuery Trigger chaining #4280
Conversation
9d4eebc
to
0f0e6fa
Compare
exist-core/src/main/java/org/exist/collections/triggers/TriggerStatePerThread.java
Show resolved
Hide resolved
exist-core/src/main/java/org/exist/collections/triggers/XQueryTrigger.java
Show resolved
Hide resolved
exist-core/src/main/java/org/exist/collections/triggers/XQueryTrigger.java
Show resolved
Hide resolved
how 'bad' are the missing triggers? it is not a new issue is it? |
I consider this a feature. I would also like to see the bugs that sonar cloud complains about to be fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see the issues reported in the analysis by sonar and codacy to be addressed.
…Copy Collection Events
0f0e6fa
to
b165260
Compare
b165260
to
5c15272
Compare
@line-o to try and allay your concerns, I have numbered each item from Codacy in a screenshot, and then explained each individually below.
All-in-all no meaningful issues were discovered by Coadacy. I have appended the commit that quietens Codacy. |
@line-o Regards SonarCloud. There are 3 issues suggested, I believe 2 of them are existing issues from how eXist-db's Trigger API is structured. I believe they can safely be ignored in this context. The final issue about calling I hope all your concerns are now addressed. |
SonarCloud Quality Gate failed. |
…n declaration (e.g. XQuery 3+)
Previously it was possible to chain Java Triggers together into pipelines, e.g. the output created by one trigger, can fire events which cause another trigger to take that as input. However, this useful functionality was previously prohibited for XQuery Triggers. It was prohibited, as it was feared that XQuery users could create endless-loops between their Triggers, such behaviour ultimately results in StackOverflowError.
Documentation of behaviour is here - eXist-db/documentation#766.
This PR enables chaining for XQuery Triggers by incorporating an improved cyclic detection mechanism to prevent such StackOverflowError. When a cycle between XQuery Triggers is detected, the cycle is broken and a warning is logged to
exist.log
. When sensibly planned, users should be able to create XQuery Trigger pipelines without issue. If a mistake is made, they are protected as the cycle will be broken and a warning for them to correct the issue is logged.Investigating and fixing this also revealed a few small other bugs along the way, for example CreateCollection events were fired during CopyCollection events; This PR corrects those also.
p.s. I have considered in detail the reports from Codacy and Sonarcloud, and I do not agree with their assessment. I think their suggestions would actually make the code harder for others to understand whilst yielding no technical gain.