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

fix(gateway): store followers and inactive nodes in sets #10255

Merged
merged 2 commits into from
Sep 5, 2022

Conversation

megglos
Copy link
Contributor

@megglos megglos commented Sep 1, 2022

Previous use of lists resulted in unbounded growth due to duplication of the same broker ids.

Description

Replaces the usage of Lists to keep track of followers and inactiveNodes in the BrokerClusterState with Sets to prevent duplication on arbitrary metadata updates.

Related issues

closes #8724

Definition of Done

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 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.)
  • New content is added to the release announcement
  • 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.

Please refer to our review guidelines.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2022

Test Results

   856 files  ±  0     856 suites  ±0   1h 42m 22s ⏱️ -27s
6 704 tests  - 44  6 694 ✔️  - 44  10 💤 ±0  0 ±0 
6 888 runs   - 44  6 878 ✔️  - 44  10 💤 ±0  0 ±0 

Results for commit 649d8fa. ± Comparison against base commit fca38d2.

♻️ This comment has been updated with latest results.

@megglos megglos force-pushed the meggle-8724-topology-memory-leak-fix branch from 392fd87 to 95a4c0d Compare September 2, 2022 11:19
@megglos megglos requested review from romansmirnov, Zelldon and npepinpe and removed request for Zelldon September 2, 2022 13:12
@megglos megglos force-pushed the meggle-8724-topology-memory-leak-fix branch from 95a4c0d to 1a29f63 Compare September 5, 2022 07:09
Copy link
Member

@npepinpe npepinpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Fix looks good. I added one comment about tests relating to waitUntil vs Awaitility. I only added in one place, but it applies to all the places you used waitUntil.

🔧 One additional thing, as we are slowly, progressively migrating to Junit 5 (e.g. new things should be written with junit 5, assertJ, awaitility,e tc.), I would typically take the opportunity to migrate the whole test class (as a separate commit of course). I think it's perfectly fine you don't do this here as you're still just getting familiar with everything, but this is something I'd recommend in the future (when it's easy enough, of course).

Anyway, once you've addressed the Awaitility comment, I don't think we need another review again (change is fairly straightforward), but ofc feel free to request one if you'd like :)

@megglos
Copy link
Contributor Author

megglos commented Sep 5, 2022

🔧 One additional thing, as we are slowly, progressively migrating to Junit 5 (e.g. new things should be written with junit 5, assertJ, awaitility,e tc.), I would typically take the opportunity to migrate the whole test class (as a separate commit of course). I think it's perfectly fine you don't do this here as you're still just getting familiar with everything, but this is something I'd recommend in the future (when it's easy enough, of course).

Anyway, once you've addressed the Awaitility comment, I don't think we need another review again (change is fairly straightforward), but ofc feel free to request one if you'd like :)

Fully agree but also due to backporting labels I would leave the full junit5 migration of this class out of scope for now. Will replace all usages of waitUntil with Awaitility though, thanks for making me aware of this!

Previous use of lists resulted in unbounded growth due to duplication of the same broker ids.
@megglos megglos force-pushed the meggle-8724-topology-memory-leak-fix branch 2 times, most recently from d90f0c8 to dfb084a Compare September 5, 2022 15:11
@megglos megglos force-pushed the meggle-8724-topology-memory-leak-fix branch from dfb084a to 649d8fa Compare September 5, 2022 15:36
@megglos
Copy link
Contributor Author

megglos commented Sep 5, 2022

bors r+

zeebe-bors-camunda bot added a commit that referenced this pull request Sep 5, 2022
10255: fix(gateway): store followers and inactive nodes in sets r=megglos a=megglos

Previous use of lists resulted in unbounded growth due to duplication of the same broker ids.

## Description

Replaces the usage of Lists to keep track of followers and inactiveNodes in the BrokerClusterState with Sets to prevent duplication on arbitrary metadata updates.

## Related issues

closes #8724



Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@npepinpe
Copy link
Member

npepinpe commented Sep 5, 2022

Is this your first flaky test? 🕵️

@megglos
Copy link
Contributor Author

megglos commented Sep 5, 2022

bors retry

zeebe-bors-camunda bot added a commit that referenced this pull request Sep 5, 2022
10255: fix(gateway): store followers and inactive nodes in sets r=megglos a=megglos

Previous use of lists resulted in unbounded growth due to duplication of the same broker ids.

## Description

Replaces the usage of Lists to keep track of followers and inactiveNodes in the BrokerClusterState with Sets to prevent duplication on arbitrary metadata updates.

## Related issues

closes #8724



Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
@megglos
Copy link
Contributor Author

megglos commented Sep 5, 2022

Is this your first flaky test? 🕵️

yes 😁 have you seen these go client tests failing before in this way?

@npepinpe
Copy link
Member

npepinpe commented Sep 5, 2022

Not the Go clients, but it can happen that the partition is initially unhealthy on startup before becoming healthy asynchronously. So it could be again this issue (just speculating). Here the PR is mostly modifying the broker cluster state (so the topology from the broker point of view) - the question is, could it have an impact on the topology from the gateway point of view? I think your PR is probably not introducing a bug there and it's a test set up issue (or you did really uncover a bug 😄), so it's probably safe to merge. In this instance, we open a new flaky test issue, and based on the test would assign it to one of the team's project.

@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@megglos
Copy link
Contributor Author

megglos commented Sep 5, 2022

bors retry

zeebe-bors-camunda bot added a commit that referenced this pull request Sep 5, 2022
10255: fix(gateway): store followers and inactive nodes in sets r=megglos a=megglos

Previous use of lists resulted in unbounded growth due to duplication of the same broker ids.

## Description

Replaces the usage of Lists to keep track of followers and inactiveNodes in the BrokerClusterState with Sets to prevent duplication on arbitrary metadata updates.

## Related issues

closes #8724



Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
@zeebe-bors-camunda
Copy link
Contributor

Build failed:

@megglos
Copy link
Contributor Author

megglos commented Sep 5, 2022

bors retry

@zeebe-bors-camunda
Copy link
Contributor

Build succeeded:

@backport-action
Copy link
Collaborator

Successfully created backport PR #10276 for stable/1.3.

@backport-action
Copy link
Collaborator

Successfully created backport PR #10277 for stable/8.0.

zeebe-bors-camunda bot added a commit that referenced this pull request Sep 6, 2022
10276: [Backport stable/1.3] fix(gateway): store followers and inactive nodes in sets r=megglos a=backport-action

# Description
Backport of #10255 to `stable/1.3`.

relates to #8724

Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
zeebe-bors-camunda bot added a commit that referenced this pull request Sep 6, 2022
10277: [Backport stable/8.0] fix(gateway): store followers and inactive nodes in sets r=megglos a=backport-action

# Description
Backport of #10255 to `stable/8.0`.

relates to #8724

Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
zeebe-bors-camunda bot added a commit that referenced this pull request Sep 6, 2022
10277: [Backport stable/8.0] fix(gateway): store followers and inactive nodes in sets r=megglos a=backport-action

# Description
Backport of #10255 to `stable/8.0`.

relates to #8724

Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
zeebe-bors-camunda bot added a commit that referenced this pull request Sep 6, 2022
10277: [Backport stable/8.0] fix(gateway): store followers and inactive nodes in sets r=megglos a=backport-action

# Description
Backport of #10255 to `stable/8.0`.

relates to #8724

Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On each metadata change, the topology of partition followers grows in the Gateway's broker topology
3 participants