Skip to content

Stop place mutations to tiamat don't work after hasura metadata reload #1746

@HenrikHartiala

Description

@HenrikHartiala

If docker containers are re-started, we can't get the stopPlaces from tiamat unless we reload hasura metadata (there is already a ticket about this) from hasura console at http://localhost:3201/console. This reload fixes the problem that we can fetch the stop place information from tiamat. But there is another problem. After the reload, for some reason we can't mutate the stop places anymore, this error is thrown:

message: "ERROR: duplicate key value violates unique constraint \"accessibility_limitation_netex_id_version_constraint\"\n  Detail: Key (netex_id, version)=(HSL:AccessibilityLimitation:6, 1) already exists."

This is most likely caused by Tiamat losing track of what NeTEx id:s have already been used. They are stored in a table in the stop registry database, but also use Hazelcast to communicate with other Tiamat instances to make sure IDs are not reused. This causes Tiamat to not directly use the database to keep track of used IDs and rather uses it only on startup. If there was some incensistency when waking up Tiamat docker image, there is a possibility the IDs were not properly initialized.

Steps to reproduce:

  1. Setup-dependencies-and-seed
  2. Use UI (not yet in main) to mutate stop place (This should be successful)
  3. Restart docker and wait for containers to be up
  4. Reload metadata
  5. Try to do another mutation via UI: Fails.

After this I used hasura console to do a simple mutation:

mutation updateStopPlace {
  stop_registry {
    mutateStopPlace (StopPlace:{id: "HSL:StopPlace:12", keyValues: [{key: "stopState", values: "InOperation"}]}){
      id
      keyValues {key, values}
    }
  }
}

Which was successful, and after that the UI worked again. Don't know why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions