Uploaded image for project: 'Camunda Optimize'
  1. Camunda Optimize
  2. OPT-1787

Provide RestHighLevelClient only after schema got fully initialized

    Details

    • Type: Task
    • Status: Done
    • Priority: L3 - Default
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2.4.0, 2.4.0-alpha1
    • Component/s: backend
    • Labels:
      None

      Description

      Currently the client is available even though the schema may not be initialized yet as this is done concurrently by ElasticSearchSchemaInitializer which also depends on the RestHighLevelClient.

      We need to encapsulate the schema initialization and the provision of the RestHighLevelClient bean and only then provide the RestHighLevelClient to other consumers that can then use it unconditionally. E.g. via a SchemaInitializingEsClientFactory that creates the client, initializes the schema and then exposes the RestHighLevelClient bean.

      given:

      • the RestHighLevelClient is injected to a service/component

      when:

      • the component uses the RestHighLevelClient

      then:

      • there is a race condition between the component that uses the RestHighLevelClient trying to access the optimize schema and the ElasticSearchSchemaInitializer initializing that schema

      expected:

      • given the RestHighLevelClient is injected it should be ready to use and the schema guaranteed to be initialized

      Note:
      this makes the usage of

      @DependsOn({"elasticSearchSchemaInitializer"})
      

      in service components obsolete

        Issue Links

          Activity

          Hide
          johannes.heinemann Johannes Heinemann added a comment -

          By the way, I really like that ticket description. It's way better than older tickets you have created

          Show
          johannes.heinemann Johannes Heinemann added a comment - By the way, I really like that ticket description. It's way better than older tickets you have created

            People

            • Assignee:
              Unassigned
              Reporter:
              sebastian.bathke Sebastian Bathke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: