Skip to content

Consolidate input state transitions into a single code path #27536

Open

Description

@patrickmann

Description

Input runtime state is written from many places, with no single owner of the transition logic:

  • InputEventListener: six @Subscribe handlers (inputCreated, inputUpdated, inputStopped, inputDeleted, inputSetup, leaderChanged), each deciding what to do from its own ad-hoc read of the current state
  • InputLauncher.launch(): registers the state and mutates it from its own executor
  • InputRegistry.remove() / stop() / setup(): combine map updates with lifecycle calls
  • InputStatesResource: persists desired_state and posts the triggering event
  • InputSetupService.shutDown()

These run on an AsyncEventBus concurrently with the launcher pool and REST threads, and each operation is a read-modify-write spread across several calls that the caller has to sequence correctly. The outcome depends on timing. There is also no reconciliation, so a node that misses an event stays diverged from the persisted desired_state until it restarts.

This has been a recurring source of bugs:

Goal

One place that owns input state transitions, so the outcome does not depend on event timing or on each caller getting the sequence right, and so a node converges on the desired state even when an event is missed. The registry, the launcher and the event handlers should not each hold a piece of the logic.

Out of scope

The read path. #25358 already moved input state reads to MongoDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions