Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16977

The class migrator is way too slow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Critical
    • None
    • 10.11.11
    • Old Core
    • Unknown

    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.

      Reproduction steps

      1. create a class (e.g., MyClass.WebHome)
      2. create a lot of page each containing an object from the new class
      3. edit the class and add a new field
      4. wait

      expected

      1. the change is performed "quickly"

      Actual

      1. adding the new field takes 27 seconds

      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

      {{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}}
      

      You can find attached the result of a profiling after adding a new field to MyClass.WebHome

      Attachments

        Activity

          People

            Unassigned Unassigned
            tmortagne Thomas Mortagne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: