High concurrency scenarious may end up in appending events that should be skipped because of the optimistic lock control.
The result is that the Cache will be aligned to an event id that is not the very last one, and this issue may inhibit any other append operation on that stream unless the cache is cleaned.
Reproduce this scenario. I.e. write a test that is able to provoke this anomaly.
Then suggest a fix that can be choose from the following or both:
Option 1: The fix could be reenabling the MAILBOX_PROCESSOR that naturally put event sin a queue to let them being processed in a precise order. If this is the case, then reintroduce MAILBOX_PROCESSOR in any CommandHandler command execution entry (it may already exist or it may need to be introduced) and give the option to enable it from configuration rather than by a compile time condition.
Option 2: Verify the possibility of enforcing the isolation level in the various pgsql function that takes care of adding events.
Option 3: Verify the possibility of managing the anomaly by a configuration that allows cleaning the cache in relation to the particular streamid (aggregateid) after the condition is detected and traced.
Option 1, Option 2, and Option 3 may not be exclusive.
Depending on the criticality of the context there can be a flexibility in the system.
High concurrency scenarious may end up in appending events that should be skipped because of the optimistic lock control.
The result is that the Cache will be aligned to an event id that is not the very last one, and this issue may inhibit any other append operation on that stream unless the cache is cleaned.
Reproduce this scenario. I.e. write a test that is able to provoke this anomaly.
Then suggest a fix that can be choose from the following or both:
Option 1: The fix could be reenabling the MAILBOX_PROCESSOR that naturally put event sin a queue to let them being processed in a precise order. If this is the case, then reintroduce MAILBOX_PROCESSOR in any CommandHandler command execution entry (it may already exist or it may need to be introduced) and give the option to enable it from configuration rather than by a compile time condition.
Option 2: Verify the possibility of enforcing the isolation level in the various pgsql function that takes care of adding events.
Option 3: Verify the possibility of managing the anomaly by a configuration that allows cleaning the cache in relation to the particular streamid (aggregateid) after the condition is detected and traced.
Option 1, Option 2, and Option 3 may not be exclusive.
Depending on the criticality of the context there can be a flexibility in the system.