Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot update from a previous version to current snapshot #17229

Closed
5 tasks
ThorbenLindhauer opened this issue Apr 2, 2024 · 2 comments · Fixed by #17241
Closed
5 tasks

Cannot update from a previous version to current snapshot #17229

ThorbenLindhauer opened this issue Apr 2, 2024 · 2 comments · Fixed by #17241
Assignees
Labels
component/operate Related to the Operate component/team kind/bug Categorizes an issue or PR as a bug version:8.6.0-alpha1 Label that represents issues released on verions 8.6.0-alpha1 version:8.6.0 Label that represents issues released on version 8.6.0

Comments

@ThorbenLindhauer
Copy link
Member

ThorbenLindhauer commented Apr 2, 2024

Describe the bug

  • When updating a system to the current version, the schema validation fails on startup with a problem on the web-session index

To Reproduce

Steps to reproduce the behavior:

  1. Create a C8 cluster with Operate
  2. Enable persistent sessions (set property camunda.operate.persistentSessionsEnabled to true, or use the corresponding environment variable)
  3. Log into Operate, so that a document is written to the web-session index
  4. Update Operate to the current snapshot

Alternative: the same should work with a current snapshot and restarting Operate. It doesn't matter if this is a true version update.

Current behavior

  • Operate does not start successfully
  • Stack trace:
io.camunda.operate.exceptions.OperateRuntimeException: Index name: web-session. Not supported index changes are introduced. Data migration is required. Changes found: [PropertyDifference{name='attributes', leftValue=IndexMappingProperty{name='attributes', typeDefinition={type=object}}, rightValue=IndexMappingProperty{name='attributes', typeDefinition={properties={com={properties={auth0={properties={state={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}}}, requestedUrl={type=text, fields={keyword={ignore_above=256, type=keyword}}}, SPRING_SECURITY_CONTEXT={type=text, fields={keyword={ignore_above=256, type=keyword}}}, SPRING_SECURITY_SAVED_REQUEST={type=text, fields={keyword={ignore_above=256, type=keyword}}}}}}}]
	at io.camunda.operate.schema.IndexSchemaValidator.validateDifferenceAndCollectNewFields(IndexSchemaValidator.java:198) ~[operate-schema-8.5.0-SNAPSHOT.jar!/:8.5.0-SNAPSHOT]
	at io.camunda.operate.schema.IndexSchemaValidator.validateIndexMappings(IndexSchemaValidator.java:172) ~[operate-schema-8.5.0-SNAPSHOT.jar!/:8.5.0-SNAPSHOT]
	at io.camunda.operate.schema.SchemaStartup.initializeSchema(SchemaStartup.java:61) ~[operate-schema-8.5.0-SNAPSHOT.jar!/:8.5.0-SNAPSHOT]

Expected behavior

  • Operate starts successfully without complaints

Environment

  • OS: [e.g. MacOS]
  • Browser: [e.g. chrome, safari]
  • Operate Version: [e.g. 8.1]

Additional context

This behavior was introduced with https://github.com/camunda/operate/issues/6483

Suspected root causes:

  • The web session index defines "dynamic": true in its schema definition. This means that the schema is extended as documents are inserted, depending on which fields they define
  • For the attributes property, this usually contains multiple fields that are written to the index and thus change the schema (see the stack trace)
  • The index validator does not expect the case of dynamic mappings and is too strict

Solution options:

  • as a quick fix, do not validate dynamic indexes. Currently only the web-session index uses that feature.

Acceptance Criteria

Definition of Ready - Checklist

  • The bug has been reproduced by the assignee in the environment compatible with the provided one; otherwise, the issue is closed with a comment
  • The issue has a meaningful title, description, and testable acceptance criteria
  • The issue has been labeled with an appropriate Bug-area label
  • Necessary screenshots, screen recordings, or files are attached to the bug report

For UI changes required to solve the bug:

  • Design input has been collected by the assignee

Implementation

🔍 Root Cause Analysis

💭 Proposed Solution

👉 Handover Dev to QA

  • Changed components:
  • Side effects on other components:
  • Handy resources:
    BPMN/DMN models, plugins, scripts, REST API endpoints + example payload, etc :
  • Example projects:
  • Commands/Steps needed to test; Versions to validate:
  • Docker file / HELM chart : in case that it needed to be tested via docker share the version contain the fixed along with version of other services .
  • Release version ( in which version this fixed/feature will be released):

📗 Link to the test case

@ThorbenLindhauer
Copy link
Member Author

ThorbenLindhauer commented Apr 3, 2024

Some hints for reproducing this:

Assuming ES is running on localhost:9200

Using the Makefile and Docker Compose, I made these changes:

  • make env-up: Add CAMUNDA_OPERATE_PERSISTENT_SESSIONS_ENABLED=true as an environment variable to the Maven command starting Operate
  • Docker compose elasticsearch: add a volume ./es-data:/usr/share/elasticsearch/data to persist ES data
  • Docker compose zeebe: add a volume ./zeebe-data:/usr/local/zeebe/data to persist Zeebe data

@ThorbenLindhauer
Copy link
Member Author

ThorbenLindhauer commented Apr 3, 2024

Here is how I tested the update scenario locally:

I built an Operate Docker image from the current branch by running mvn clean install -DskipTests and then docker build -t thorben/operate:SNAPSHOT -f operate.Dockerfile --target app . from the root directory.

I declared Operate in the Docker compose file as follows:

  operate:
    container_name: operate
    image: thorben/operate:SNAPSHOT
    environment:
      - CAMUNDA_OPERATE_TASKLIST_URL=http://localhost:8081
      - CAMUNDA_OPERATE_PERSISTENT_SESSIONS_ENABLED=true
      - CAMUNDA_OPERATE_ELASTICSEARCH_URL=http://elasticsearch:9200
      - CAMUNDA_OPERATE_ZEEBE_ELASTICSEARCH_URL=http://elasticsearch:9200
      - CAMUNDA_OPERATE_ZEEBE_GATEWAY_ADDRESS=zeebe:26500
    ports:
      - 8080:8080
    restart: always

I added a volume declaration to the Zeebe and Elasticsearch containers as described in my previous comment.

Then:

  1. Run docker-compose -f docker-compose.yml up -d elasticsearch zeebe operate
  2. Log into the webapps (important to create a persistent session), deploy a process model, start a process instance
  3. Stop the stack
  4. Change the versions of the Zeebe and Operate images
  5. Run docker compose again

github-merge-queue bot pushed a commit that referenced this issue Apr 4, 2024
… altered by data inserts (#17241)

## Description

<!-- Please explain the changes you made here. -->

- IndexMapping creation is deferred to a builder. In the future this can
be moved completely into a factory or other separate component for
abstraction.
- Added "dynamic" field to IndexMapping required to determine if an
index is dynamic or strict
- Added logic to not ignore "changed" fields (existing fields that have
properties added or changed) when either the template or existing schema
is dynamic. New fields will still be processed. The criteria for whether
an index is dynamic is by looking at the "dynamic" field of the index
mapping for a value of "true" or if the "dynamic" field is not present.
Any other values for "dynamic" will be interpreted as false, this can be
expanded on later as needed. See:
https://www.elastic.co/guide/en/elasticsearch/reference/current/dynamic.html#dynamic-parameters
for possible values
- Added integration tests to simulate error condition on startup when
data was added to a dynamic index and created new subfields

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #17229

<!-- Cut-off marker
_All lines under and including the cut-off marker will be removed from
the merge commit message_

## Definition of Ready

Please check the items that apply, before requesting a review.

You can find more details about these items in our wiki page about [Pull
Requests and Code
Reviews](https://github.com/camunda/zeebe/wiki/Pull-Requests-and-Code-Reviews).

* [ ] I've reviewed my own code
* [ ] I've written a clear changelist description
* [ ] I've narrowly scoped my changes
* [ ] I've separated structural from behavioural changes
-->

## Definition of Done

<!-- Please check the items that apply, before merging or (if possible)
before requesting a review. -->

_Not all items need to be done depending on the issue and the pull
request._

Code changes:
* [ ] The changes are backwards compatibility with previous versions
* [ ] If it fixes a bug then PRs are created to
[backport](https://github.com/camunda/zeebe/compare/stable/0.24...main?expand=1&template=backport_template.md&title=[Backport%200.24])
the fix to the last two minor versions. You can trigger a backport by
assigning labels (e.g. `backport stable/1.3`) to the PR, in case that
fails you need to create backports manually.

Testing:
* [ ] There are unit/integration tests that verify all acceptance
criterias of the issue
* [ ] New tests are written to ensure backwards compatibility with
further versions
* [ ] The behavior is tested manually
* [ ] The change has been verified by a QA run
* [ ] The impact of the changes is verified by a benchmark

Documentation:
* [ ] The documentation is updated (e.g. BPMN reference, configuration,
examples, get-started guides, etc.)
* [ ] If the PR changes how BPMN processes are validated (e.g. support
new BPMN element) then the Camunda modeling team should be informed to
adjust the BPMN linting.

Other teams:
If the change impacts another team an issue has been created for this
team, explaining what they need to do to support this change.
- [ ] [Tasklist](https://github.com/camunda/tasklist/issues)
- [ ] [Web Modeler](https://github.com/camunda/web-modeler/issues)
- [ ] [Desktop
Modeler](https://github.com/camunda/camunda-modeler/issues)
- [ ] [Optimize](https://github.com/camunda/camunda-optimize/issues)

Please refer to our [review
guidelines](https://github.com/camunda/zeebe/wiki/Pull-Requests-and-Code-Reviews#code-review-guidelines).
@tmetzke tmetzke added the version:8.6.0 Label that represents issues released on version 8.6.0 label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/operate Related to the Operate component/team kind/bug Categorizes an issue or PR as a bug version:8.6.0-alpha1 Label that represents issues released on verions 8.6.0-alpha1 version:8.6.0 Label that represents issues released on version 8.6.0
Projects
None yet
5 participants