|
Description: |
When modifying a xclass field the class migrator wake up to do necessary modification to corresponding xobjects. Problem is that the current implementation can takes hours when there is a lot of xobject of that xclass and blocks the class save in the meantime.
The object update is very important so we can't just remove it but there is probably ways to work on optimizing it.
h2. Reproduction steps
# create a class (e.g., {{MyClass.WebHome}}) # create a lot of page each containing an object from the new class # edit the class and add a new field # wait
h2. expected
# the change is performed "quickly"
h2. Actual
# adding the new field takes 27 seconds
h2. Notes
This is worsened by the fact that changes on the XObject are performed as soon as the field is added.
Snippet to create the classes {code:groovy} {{groovy}}
for(index in 1..3000){ key = "Test"+index udoc = xwiki.getDocument("Space."+key) uobj = udoc.getObject("MyClass.WebHome", true) uobj.set("field1", key) ## assuming MyClass.WebHome has a "field1" field print("* Created *" + udoc.key + "*\n") udoc.save() } {{/groovy}} {code}
You can find attached the result of a profiling after adding a new field to MyClass.WebHome |
Attachment: |
jar_2024_10_10_111110.jfr |
|