-
-
Notifications
You must be signed in to change notification settings - Fork 241
Ensure the DDL trigger requests are cached #7426
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
Conversation
I didn't found a crash nor I'm saying it makes the code worse, but the triggers code is awful. Let see a case I suspected to be problematic.
In this case it looks like it leaks in the same way as before. But even more interesting, |
I agree triggers management code is a horrible mess. I already tried to improve something (reference counting and resource management) once but succeeded only partially, regressions required to restore some logic back. This beast deserves a complete rewrite, IMHO, but we cannot risk with any big changes before the v5 release. This patch was born just to avoid repeated (and obviously redundant) re-compilation of triggers (I noticed that during my other work). I'm not going to insist if it causes any doubts, provided that we'll schedule the triggers code rewrite for the next major release. I'm wondering whether Alex already changed something during his shared metadata cache work. As for memory leaks, I was tracking |
On 12/17/22 11:11, Dmitry Yemanov wrote:
I'm wondering whether Alex already changed something during his shared
metadata cache work.
Not much - I could not understand the logic of it's operaton in some
places. Now I see that it's just buggy sometimes :(
|
While this commit does not fix all problems with cached triggers, I see no good reason to defer it.
…xternal trigger. Using a temporary vector is a bad idea because it owns the trigger object but external triggers store a back pointer to Jrd::Trigger, thus implying it being persistent.
…xternal trigger. Using a temporary vector is a bad idea because it owns the trigger object but external triggers store a back pointer to Jrd::Trigger, thus implying it being persistent.
Currently,
EXE_execute_ddl_triggers()
composes a temporary vector of triggers and passes it toEXE_execute_triggers()
. This may cause triggers to be compiled before first execution, but the resultingstatement
(and possiblyextTrigger
) is never moved to the original (cached) copy of the triggers. So (1) every time triggers are recompiled again and again, (2) they're leaking memory and resources/locks, (3) existing calls ofMET_release_triggers()
foratt_ddl_triggers
seem useless, as these triggers are never compiled. This PR fixes this problem, but as I could be missing something, I'd appreciate a review.