Fix/reentarable pico schema change api
Part of #313 (closed)
- Change some of the error message a little bit, so that they are easier to match in string representation (temporary change which should become unnecessary after #307)
- Refactor stuff related to cas and _pico_property reducing the copy paste a bit
- Add a reenterable_schema_change_request lua function which implements the algorithm described in the Storage Schema Rfc
- Use this reenterable_schema_change_request function in all of the pico.* acl related functions
TODO:
- Tests which check that retriable errors are handled correctly
- Make pico.create_space, pico.drop_space re-enterable
Making ddl requests re-enterable will be trickier and will require modifications to the algorithm from the RFC to handle some cases. For example it will not currently handle this situation:
- User calls pico.create_space({ timeout = 3 })
- DdlPrepare is committed
- 3 seconds pass, pico.create_space times out.
- User calls pico.create_space() again
- pico.create_space() waits for no pending schema change
- DdlAbort is committed (there was a conflict on a lagging instance)
- pico.create_space() checks if space exists -> it doesn't
- pico.create_space() proposes another cas request
- goto 2.
The smaller the timeout value is the more likely this loop will last for long.
Edited by Georgy Moshkin