1. 24 Apr, 2017 1 commit
    • Timothy Andrew's avatar
      Move records to the ghost user in a transaction. · 133f00be
      Timothy Andrew authored
      - While deleting a user, some of the user's associated records are moved to the
        ghost user so they aren't deleted. The user is blocked before these records
        are moved, to prevent the user from creating new records while the migration
        is happening, and so preventing a data race.
      
      - Previously, if the migration failed, the user would _remain_ blocked, which is
        not the expected behavior. On the other hand, we can't just stick the block +
        migration into a transaction, because we want the block to be committed before
        the migration starts (for the data race reason mentioned above).
      
      - One solution (implemented in this commit) is to block the user in a parent
        transaction, migrate the associated records in a nested sub-transaction, and
        then unblock the user in the parent transaction if the sub-transaction fails.
      133f00be
  2. 20 Apr, 2017 39 commits