orleans icon indicating copy to clipboard operation
orleans copied to clipboard

DeleteStateOnClear support for AdoNet storage provider

Open modabas opened this issue 1 year ago • 0 comments

This PR is for issue #8059

Scripts are updated for Mssql and Potgresql only. Mysql and Oracle scripts need to be updated with a new step in OrleansQuery table with QueryKey = 'DeleteStorageKey'. Even so, current implementation should run as is, if DeleteStateOnClear option is not explicitly set to true.

There are some behaviour differences between DeleteStateOnClear option is set to false (same as current functionality and default option for this PR) and true. These are observed with both Postgresql and Mssql providers

Update on clear state =>

  1. If non existent (no rows in db table) state is cleared; inconsistent state exception is thrown
  2. If a non-cleared state is cleared; db version is incremented, State.ETag is set to new db version, db payload is set to null and State.RecordExists is set to false
  3. If a cleared state is cleared again; db version is incremented, State.ETag is set to new db version, db payload is set to null and State.RecordExists is set to false If grain whose state is cleared is reinitiated (or application restart), State.RecordExists is seen as true from grain

Delete on ClearState =>

  1. If non existent (no rows in db table) state is cleared; inconsistent state exception is thrown
  2. If a non-cleared state is cleared; db row is deleted, State.ETag is set to null and State.RecordExists is set to false
  3. If a cleared state is cleared again; inconsistent state exception is thrown
  4. If a state previously cleared with update is cleared; db row is deleted, State.ETag is set to null and State.RecordExists is set to false If grain whose state is cleared is reinitiated (or application restart), State.RecordExists is seen as false from grain
Microsoft Reviewers: Open in CodeFlow

modabas avatar Jul 08 '23 11:07 modabas