odoo/upgrade-util#320

Created by Upgrade, Carsten Wolff (cawo)

Blocked

label
odoo-dev:master-imp_parallel_iter_browse-cawo
head
060b1a38e4b27bd625c8380009d3c874325645eb
odoo/upgrade odoo/upgrade-util
master #8447 missing r+ #320 missing r+

[IMP] orm: parallel iter_browse

TODO: test on 1000 DBs, fixups

[IMP] orm: iter_browse accept generator or query as ids

This allows the caller to be memory efficient on huge numbers of ids, allowing for even more millions of records to be browsed.

[IMP] orm: add optional parallelism to iter_browse.attr()

In some cases, e.g. if it is known that calling a certain method on the model will only trigger inserts or it is clear that updates will be disjunct, such method calls can be done in parallel.

[IMP] orm: add optional parallelism to iter_browse.create()

Like the same support added to __attr__ in the parent commit, this can only be used by callers when it is known that database modifications will be distinct, not causing concurrency issues or side-effects on the results.

create returns an iter_browse object for the caller to browse created records. To support vast amounts of created records in multiprocessing strategy, we process values in a generator and initialize the returned iter_browse object with it. As this requires the caller of create to always consume/iterate the result (otherwise records will not be created), it is not applied to the other strategies as it would break existing API.

[IMP] orm: iter_browse.create() accept generator or query as values

Done to be able to create millions of records memory-efficiently.