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

Important problem with the content and metadata dirty status and versioning

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 1.0 B4
    • 1.0 B2
    • Storage
    • None

    Description

      We have an important problem where the meta data dirty and content dirty status are not setup properly in the XWikiDocument object and are not set to false after saving.
      These two problems are negating themselves and therefore only has a bad effect in some rare cases.

      Problem 1:

      only the standard wiki and simple XWikiDocument properties are saving the meta data and content dirty fields in XWikiDocument

      Problem 2:

      the save does not reset these fields

      These fields are needed by the store to decide wether or not a version has to be saved. It is also used for the copy functions, the importer to not save a version when importing a document.
      This means that most of the time a standard wiki edit happens and from then on in the cache the dirty status are true thus making XWiki behave for this document like it needs to have an additional version setup. In all cases even if the dirty status is false the data is saved to the database.

      Since the save does not reset these fields most of the time the document is also edited for standard wiki content. Then the status is true in the cache and all futur saves are versioned properly.
      But if a document is retrieved without ever have a normal wiki save and then the objects are saved then the status is to false and there is no additional version. This is really bad.

      This means we don't really know the effect of resetting the dirty flags to false after save. It could result in more cases where the versions are not save.
      The patch I propose is:

      1/ Improve the set dirty flags so that apis in XWikiDocument set these flags to true on objects additions and changes. This can't be perfect because you can modify data inside the document without ever calling a "set" function in XWikiDocument. This can happen if you ask for the full list of objects and then modify these objects through the internal data structures.

      2/ This is why I suggest also adding a set dirty flags in SaveAction to make sure the standard wiki saving (documents and objects) will also set the dirty flags for sure before saving.

      We then need to think about changing the way this dirty thing is handling. I believe instead of setting at the time of setting values which should calculate the dirty flags by comparing the older document with the new document and see what has changed. This means that the save apis that do not pass the older document need to provide a flag to tell us which behavior to have for versioning.

      Attachments

        Activity

          People

            ludovic Ludovic Dubost
            ludovic Ludovic Dubost
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: