Closing detached HAF application triggers unexpected behaviour after restart
There is following scenario, that shows the problem.
- SELECT * FROM hive.app_create_context('ANY_CONTEXT')
- SELECT * FROM hive.app_next_block('ANY_CONTEXT') "returns FIRST/LAST"
- SELECT * FROM hive.app_context_detach('ANY_CONTEXT')
- Here app closes due to the crash, SIGINT...
- Trying to get new block: SELECT * FROM hive.app_next_block('ANY_CONTEXT') "error: Context ANY_CONTEXT is detached"
- Trying to attach: SELECT hive.app_context_attach('ANY_CONTEXT', FIRST-1) "error: Context ANY_CONTEXT has already processed block FIRST-1
- Trying to attach: second attempt: SELECT hive.app_context_attach('ANY_CONTEXT', FIRST)
- SELECT * FROM hive.app_next_block('ANY_CONTEXT'): "return FIRST+1/LAST". This is wrong because the FIRST block has not ever been processed and in this scenario has been skipped
Edited by Mariusz Trela