restate icon indicating copy to clipboard operation
restate copied to clipboard

New infra state machine

Open slinkydeveloper opened this issue 1 year ago • 6 comments

Introduce new state machine infra and related test infra, in order to improve the code organization around the FSM and commands.

The new infra uses StateMachineContext as entrypoint, and from there every command struct implements ApplicableCommand. ApplicableCommand applies the command by using the CommandContext, which contains storage and actions collector.

To facilitate the transition, I've introduced a MaybeApplicableCommand which is implemented for Command, and returns the command in case the new infra doesn't yet support that specific command.

The PR also shows two commands ported to the new infra.

slinkydeveloper avatar Jun 11 '24 14:06 slinkydeveloper

Can you add a description for what the PR is about?

AhmedSoliman avatar Jun 12 '24 10:06 AhmedSoliman

Do we still want to pursue this change, should we keep this open or close it? @tillrohrmann @slinkydeveloper

AhmedSoliman avatar Aug 07 '24 10:08 AhmedSoliman

I think the approach is still valid, and I think it removes away a bit of complexity brought in by the Effects data structure...

slinkydeveloper avatar Aug 07 '24 10:08 slinkydeveloper

Right now, I unfortunately don't have the capacity to migrate the existing state machine to the new abstractions. From a quick glance, it might help improve the codebase by removing the separate step of the EffectInterpreter. Since it is not a strictly required step for a distributed Restate, I would vote to pause this effort for until we have either more capacity or need to change the state machine of the partition processor in a substantial way.

tillrohrmann avatar Aug 07 '24 10:08 tillrohrmann

I would vote to pause this effort for until we have either more capacity or need to change the state machine of the partition processor in a substantial way.

I can totally take this and port bit by bit the state machine when i have time, and/or when i touch it. Most likely i'll need to touch the state machine soon for some upcoming features.

slinkydeveloper avatar Aug 07 '24 11:08 slinkydeveloper

I can totally take this and port bit by bit the state machine when i have time, and/or when i touch it. Most likely i'll need to touch the state machine soon for some upcoming features.

Before starting with this, I would like us to agree that this is the right approach or not. Right now, there are higher priority tasks that need to be done first, unfortunately.

Also, there is some inherent risk that we introduce bugs by porting the existing code incorrectly. That's why we need to review these changes. I fear that right now is not the best time for opening up this construction site.

tillrohrmann avatar Aug 07 '24 16:08 tillrohrmann

this is not needed anymore

slinkydeveloper avatar Aug 16 '24 10:08 slinkydeveloper