@diosmosis opened this Issue on December 18th 2018 Member

Currently when purging dangling references from the log_action table, we lock it in order to make sure we don't accidentally delete a row that ends up being referenced during tracking. This is problematic, since purging log_action can take a long time, and blocks tracking while it is running.

The proposed solution is to remove the need for locking by:

  • adding a new action type, ACTION_DELETED. the tracker cannot use an action whose type is ACTION_DELETED
  • when purging, running an update to set the type of all dangling actions to ACTION_DELETED. then running queries to delete all ACTION_DELETED actions.

Issues w/ concurrency must be reviewed carefully when implementing. Eg, we must ensure situations like the following do not occur:

  • update query starts, one action is found to be dangling
  • tracker gets a request for that action, decides to use it
  • update query sets type to ACTION_DELETED
  • tracker uses the idaction, which gets deleted resulting in a broken log

or:

  • tracker gets a request for an action that is currently dangling, and decides to use it
  • update query sees that it is dangling before a log is inserted and sets type to ACTION_DELETED
  • tracker inserts log using idaction which gets deleted resulting in a broken log
This Issue was closed on December 18th 2018
Powered by GitHub Issue Mirror