On 11/5/20 1:22 PM, Dimitry Sibiryakov wrote:
05.11.2020 10:35, Alex Peshkoff via Firebird-devel wrote:
That's how it worked before and that caused deadlocks (see
http://tracker.firebirdsql.org/browse/CORE-6412).
(BTW - fix for 6412 is backported to B3, i.e. it's not fb4-only issue)
Where exactly the deadlock was?
Pay attention - user's trigger modifies RDB$USER_PRIVILEGES:
EXECUTE STATEMENT 'GRANT RDB$ADMIN TO "' || NEW.AUTHENTICATION || '"
GRANTED BY "SYSDBA"';
Same does plugin:
sql.printf("GRANT DEFAULT %s TO \"%s\"", ADMIN_ROLE, userName.c_str());
They want to modify same record. When that happens in 2 different
transactions, started from 2 different attachments (specially pay
attention that one is started and committed in DFW of another one) - you
see, deadlock is unavoidable.
Do you have other suggestions ?
Yes, but they are more ugly.
For example the plugin can use self-made statement metadata instead
one got from prepare() forcing character set of data for PLG$USER_NAME
to be UTF-8.
That's not as bad as seems to you. The only issue is that it's high time
to rewrite everything related to metadata in this plugin to make it use
FB_MESSAGE instead local templates - it was written before FB_MESSAGE
arrived.
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel