Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3680

Database changes of consumers aren't persisted anymore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 6.2
    • Fix Version/s: 6.2
    • Component/s: API
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      7
    • Documentation Status:
      Needed

      Description

      With https://github.com/DSpace/DSpace/pull/1824 we changed the order in which changes are written to the databases and Context.dispatchEvents() is called. The order is quite important if we commit changes to the database before we call the consumers, changes made by the consumers aren't stored as part of the transaction. We could fix this by letting consumers call context.commit(), but I think that this is a bad idea. A consumer reacts on events triggered by user interaction, cronjobs and further more. If you develop a consumer you cannot be sure about what happened before the event in the session. All you get is the information encapsulated in the Event object. This information is not enough to decide weather to commit or to rollback. Following a Consumer should never commit as this decision has to be done elsewhere in the code. Therefore I strongly suggest to change the order back to call dispatchEvents() before dbConnection.commit().

      If we change the order back, we have to look deeper into the problem that let as change the order in the first place. I'll do this further down in the comments to this issue (and probably in follow up tickets).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pbecker Pascal-Nicolas Becker
                Reporter:
                pbecker Pascal-Nicolas Becker
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: