Issue 11301

Title
Use singleton for table handler
Priority
feature
Status
resolved
Superseder
Make better index (issue 5757)
Nosy list
ced, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2022-03-08.19:18:08 by ced, last changed 7 months ago by roundup-bot.

Messages

New changeset a77c6742bd5b by Cédric Krier in branch 'default':
Use recreate table to drop column and init handler after table rename
https://hg.tryton.org/tryton-env/rev/a77c6742bd5b
New changeset 290ec5f156b2 by Cédric Krier in branch 'default':
Use recreate table to drop column and init handler after table rename
https://hg.tryton.org/trytond/rev/290ec5f156b2
New changeset 3a8cf8e6cbb0 by Cédric Krier in branch 'default':
Use singleton for TableHandler
https://hg.tryton.org/tryton-env/rev/3a8cf8e6cbb0
New changeset 33faabc6ec78 by Cédric Krier in branch 'default':
Use singleton for TableHandler
https://hg.tryton.org/trytond/rev/33faabc6ec78
New changeset 82956b75b13a by Cédric Krier in branch 'default':
Use singleton for TableHandler
https://hg.tryton.org/modules/product/rev/82956b75b13a
New changeset 9dc6040a744e by Cédric Krier in branch 'default':
Use singleton for TableHandler
https://hg.tryton.org/modules/customs/rev/9dc6040a744e
New changeset c79d6ac1a6d0 by Cédric Krier in branch 'default':
Use singleton for TableHandler
https://hg.tryton.org/modules/account_statement/rev/c79d6ac1a6d0
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-03-08.19:18:08

The TableHandler is keeping a copy of table definition (that is kept up to date on alteration). This definition is loading when the handler is instantiated. For a table this can happen few times during the register process because each register method extension may need the handler.
So it will be good to have a single instance each time the handler is instantiated to avoid fetching the definition.
Also when an ateration is done, we could just mark the definition is invalid and fetch the new definition only when it is needed.

The only point that prevents such usage is that the table handler is using the module name to prevent to drop indexes from other module (which is no more needed with issue5757) and to prevent to remove NOT NULL constraint from a different module. Those are just guards and not really feature that I think we can drop for the benefit of reducing the number of queries.

History
Date User Action Args
2022-11-19 17:05:05cedlinkissue5343 superseder
2022-05-07 14:10:50roundup-botsetmessages: + msg76540
2022-05-07 14:10:45roundup-botsetmessages: + msg76539
2022-05-07 11:36:21roundup-botsetmessages: + msg76537
2022-05-07 11:36:16roundup-botsetmessages: + msg76536
2022-05-07 11:36:07roundup-botsetmessages: + msg76535
2022-05-07 11:36:04roundup-botsetmessages: + msg76534
2022-05-07 11:35:59roundup-botsetmessages: + msg76533
nosy: + roundup-bot
status: testing -> resolved
2022-04-11 20:27:04cedsetsuperseder: + Make better index
2022-03-26 12:32:45reviewbotsetmessages: + msg74796

Showing 10 items. Show all history (warning: this could be VERY long)