ERP5Type,CopySupport: Allow immediately indexing new subobjects
"immediate", in this context, means "during the same transaction". Normally, indexation always happens in a transaction different from the one which did the indexation-inducing action (modifying a property, creating a document, explicitely requesting indexation). This is because SQL and object databases do not have the same approach to conflict resolution: in SQL, the last one wins, and ordering happens based on locks. In ZODB, conflict resolution is stricter in that to modify an object a transaction must have started with the same revision of that object as the one which is current at the time it is trying to commit. As both databases must be kept consistent, one interpretation must be enforced onto the other: the ZODB interpretation. So delayed indexation, plus careful activity sequencing (serialization_tag) is required. But in very specific cases, it is actually safe to index a document immediately: when creating that document. This is because the only conflict which may then happen is if two transaction produce the same path, and ZODB will prevent the transaction from committing altogether, preventing any conflict resolution from happening. Pasting a document falls into this category as well, for the same reason. In turn, this feature removes the need to call "immediate" reindexation methods, allowing to restrict their availability later and preventing API misuse and catalog consistency compromission. Two variants of "immediate" indexation are available: - internal to the method which creates considered document - delayed to a caller-controller, but mandatory, point later in current transaction, by using a context (in python sense) manager object.
Showing
Please register or sign in to comment