moqui / moqui-framework

Use Moqui Framework to build enterprise applications based on Java. It includes tools for databases (relational, graph, document), local and web services, web and other UI with screens and forms, security, file/resource access, scripts, templates, l10n, caching, logging, search, rules, workflow, multi-instance, and integration.
http://www.moqui.org
Other
279 stars 199 forks source link

Too manay 'Potential lock conflict' #596

Open daiagou opened 1 year ago

daiagou commented 1 year ago

Due to foreign keys, there may be some deadlocks, lock wait timeout, and Potential lock conflict during execution. Here I will list some of the 'Potential lock conflicts':

2015990-00: AT_ENTITY:mantle.account.payment.Payment (AUTHZA_CREATE:create) 0ms TX 17487
2015991-01: AT_SERVICE:mantle.account.PaymentServices.create#Payment (AUTHZA_CREATE:inline) 9ms TX 17487
2015992-02: AT_SERVICE:mantle.order.OrderServices.add#OrderPartPayment (AUTHZA_ALL:inline) 22ms TX 17487
2016001-== OTHER LOCK 0 thread MoquiWorker-12 TX 17484 began 2023-03-31 11:03:55.311 at:
2016002-00: AT_ENTITY:mantle.account.payment.Payment (AUTHZA_UPDATE:update) 36ms TX 17484
2016003-01: AT_SERVICE:mantle.account.InvoiceServices.create#EntireOrderPartInvoice (AUTHZA_CREATE:inline) 145ms TX 
9105-00: AT_ENTITY:moqui.security.UserLoginKey (AUTHZA_CREATE:create) 0ms TX 17728
9112-== OTHER LOCK 0 thread qtp169880779-18 TX 101 began 1970-01-01 07:59:59.999 at:
9113-00: AT_ENTITY:moqui.security.UserLoginKey (AUTHZA_DELETE:delete) 231690958ms TX 101
68-00: AT_ENTITY:mantle.order.OrderHeader (AUTHZA_CREATE:create) 0ms TX 2286
69-01: AT_SERVICE:mantle.order.OrderServices.create#Order (AUTHZA_CREATE:inline) 5ms TX 2286
77-== OTHER LOCK 0 thread MoquiWorker-4 TX 2279 began 2023-03-28 19:42:31.062 at:
78-00: AT_ENTITY:mantle.order.OrderHeader (AUTHZA_UPDATE:update) 348ms TX 2279
644-00: AT_ENTITY:mantle.order.OrderHeader (AUTHZA_CREATE:create) 0ms TX 2311
645-01: AT_SERVICE:mantle.order.OrderServices.create#Order (AUTHZA_CREATE:inline) 5ms TX 2311
653-== OTHER LOCK 0 thread MoquiWorker-4 TX 2309 began 2023-03-28 19:42:41.151 at:
654-00: AT_ENTITY:mantle.order.OrderPart (AUTHZA_UPDATE:update) 349ms TX 2309

I raise a question - do foreign keys need to be explicitly defined? Can they be based on convention or only defined in the entity XML file without being directly represented in the database? Would this improve performance and help solve many deadlock problems?