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

KC: Stop Connectors and Reset Connector Offsets #573

Merged
merged 41 commits into from
Jan 14, 2025

Conversation

Dugong42
Copy link
Contributor

@Dugong42 Dugong42 commented Oct 4, 2024

What changes did you make? (Give an overview)

This brings a few features to the "Connector" pages (list and detail), related to Connector Offsets management (#183)

Added

  • Added a dropdown option to "Stop" a connector
  • Added a dropdown option to "Reset Connector Offsets". It requires a confirmation as for the "Delete" action.
  • Added a new permission "RESET_OFFSETS" for connect
  • Displayed the "Pause" and "Resume" actions in the Connectors list page dropdown (previously only on the connector detail page)

Changes

  • The "Restart" menu of the detail page is disabled during connector state changes, instead of its individual items being disable, to give a better visual feedback of the ongoing operation.
  • The "Remove Connector" action on the connector list page is renamed as "Delete" to match the same action on the detail page and other similar actions on other resources.

Fixed

  • edit2: On the detail page, Connector actions now behave as expected, triggering a data refresh

Misc

Given I'm working behind a corporate proxy which was a pain to configure, I added a few tweaks to improve the dev experience.

  • Added some configuration to be able to build behind a corporate proxy with minimal config (for instance proxies/mirrors in .npmrc and .m2/settings.xml and system proxies)
  • Reduced maven dependency fetch time: Moved the declaration of the more specific Confluent repository after the more common Apache repo. This matters in my experience because maven tries them in order for every package.

edit1 with screenshots

The "Reset" button is disabled if the connector is not STOPPED
image

On the detail page, the "Restart" dropdown now contains the new "Stop" action
image

The other dropdown contains the Reset and Delete actions
image

Confirmation dialog
image

Is there anything you'd like reviewers to focus on?

  • Not too sure about the UX of the "Restart" dropdown. It's a bit weird to have part of the actions in it and part in the other dropdown.
  • Not sure about the current unit test policy, did not see many tests for other similar features.
  • VSCode applied some formatting changes. I hope that's not a bother to review.
  • I tested manually but was unable to run java unit tests locally, I have an 8GB RAM toaster which apparently is not enough to run WSL + the tests, as they kept getting killed by OOM errors.

How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)

  • No need to
  • Manually (please, describe, if necessary)
  • Unit checks
  • Integration checks
  • Covered by existing automation

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
    • Frontend tests are passing
    • Backend tests kept crashing because of out of memory errors. My toaster with 8GB RAM was not enough to run WSL + the tests apparently.
  • Any dependent changes have been merged
    • Needs some documentation for the new permission

A picture of a cute animal (not mandatory but encouraged)

baby_kapibara

@Dugong42 Dugong42 requested review from a team as code owners October 4, 2024 15:47
@kapybro kapybro bot added status/triage Issues pending maintainers triage status/triage/manual Manual triage in progress type/feature A brand new feature status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Oct 4, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hi Dugong42! 👋

Welcome, and thank you for opening your first PR in the repo!

Please wait for triaging by our maintainers.

Please take a look at our contributing guide.

@Haarolean Haarolean linked an issue Oct 4, 2024 that may be closed by this pull request
@Haarolean Haarolean added scope/backend Related to backend changes hacktoberfest-accepted PRs accepted towards hacktoberfest goal and will be counted as approved and removed status/triage/manual Manual triage in progress labels Oct 4, 2024
@yeikel
Copy link
Collaborator

yeikel commented Dec 19, 2024

@Dugong42 FYI: #710 (comment)

The workaround that you implemented should not be needed after that pull request is merged

Thank you for helping me during my analysis indirectly :)

@fallen-up
Copy link

fallen-up commented Dec 19, 2024

tested and

  1. it's strange that acl doesn't fit into a unified formula.
    now you need to do an acl like this (uppercase):
          - resource: connect
            value: ".*"
            actions: ["view", "restart", "RESET_OFFSETS"]
  1. After stopping connector - Error 500
JSON decoding error: Cannot construct instance of `io.kafbat.ui.connect.model.ConnectorStatusConnector$StateEnum`, problem: Unexpected value 'STOPPED'

@Haarolean
Copy link
Member

  1. now you need to do an acl like this (uppercase):

@fallen-up this shouldn't be a case, it's case insensitive for all the enums. Can you confirm please?

@Haarolean
Copy link
Member

@Dugong42 hi, can you take a look at the 2nd issue @fallen-up mentioned? And I guess we don't need the workaround for the KC anymore considering @yeikel's changes

use the proper return type for the client interface

fix stopConnector override with new retry mechanism
@Dugong42 Dugong42 force-pushed the feature/reset-connector-offsets branch from c5e1edb to 0d8ba54 Compare January 3, 2025 11:54
@fallen-up
Copy link

fallen-up commented Jan 3, 2025

@fallen-up this shouldn't be a case, it's case insensitive for all the enums. Can you confirm please?

@Haarolean yep, looks like my bad. register is insensitive

@Dugong42
Copy link
Contributor Author

Dugong42 commented Jan 3, 2025

@yeikel thanks for the proper fix!

@Haarolean I've rolled back my workaround and taken the retry mechanic into account.

I've tested different values for the actions and could not replicate the case issue.
As @fallen-up said in the end it seems to work as expected.

It should be ready to merge :)

@Dugong42 Dugong42 changed the title Feature : Stop Connectors and Reset Connector Offsets FE : Stop Connectors and Reset Connector Offsets Jan 3, 2025
@Dugong42 Dugong42 changed the title FE : Stop Connectors and Reset Connector Offsets FE: Stop Connectors and Reset Connector Offsets Jan 3, 2025
pom.xml Show resolved Hide resolved
@Haarolean
Copy link
Member

@Dugong42 could you please refrain from force-pushing a PR branch that has been previously reviewed in the future? This marks multiple files as unreviewed without a clear diff even if there are none since the last review.

Copy link
Collaborator

@yeikel yeikel left a comment

Choose a reason for hiding this comment

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

Thank you! (I can only comment as my approval does not count)

@Haarolean
Copy link
Member

Thank you! (I can only comment as my approval does not count)

yep, this is a limitation to prevent random users LGTMing on PRs (yes, it's actually a thing)

@Haarolean Haarolean added this to the 1.2 milestone Jan 14, 2025
@Haarolean Haarolean changed the title FE: Stop Connectors and Reset Connector Offsets KC: Stop Connectors and Reset Connector Offsets Jan 14, 2025
@Haarolean Haarolean merged commit a159ef6 into kafbat:main Jan 14, 2025
13 of 15 checks passed
@Haarolean
Copy link
Member

@Dugong42 thanks for your first contribution to kafbat UI! 🎉

@fallen-up
Copy link

fallen-up commented Jan 15, 2025

finally managed to do a full test.
@Dugong42
it seems that the initial description of the PR, including the names of the buttons and other elements, was incorrect. here are my reasons:

  • "Reset offset" suggests resetting to a specific value. In other functionalities of kafka-ui, "reset" clearly means triggering a reset of one type (earliest, latest, timestamp, offset).
  • there is also an option to delete a consumer group.
  • in FE: Add Search Functionality to ACLs page #636, the deletion of offsets for a single topic within a group is implemented, and in the menu, it appears as "Delete offsets".
  • this PR simply performs a Delete, not Patch/Reset. it can easily lead to confusion. and at a minimum the button labels, acl changes should be changed.

@yeikel
Copy link
Collaborator

yeikel commented Jan 16, 2025

finally managed to do a full test.
@Dugong42
it seems that the initial description of the PR, including the names of the buttons and other elements, was incorrect. here are my reasons:

  • "Reset offset" suggests resetting to a specific value. In other functionalities of kafka-ui, "reset" clearly means triggering a reset of one type (earliest, latest, timestamp, offset).
  • there is also an option to delete a consumer group.
  • in FE: Add Search Functionality to ACLs page #636, the deletion of offsets for a single topic within a group is implemented, and in the menu, it appears as "Delete offsets".
  • this PR simply performs a Delete, not Patch/Reset. it can easily lead to confusion. and at a minimum the button labels, acl changes should be changed.

Is the challenge that the name is misleading?

The original API also uses the "delete" terminology, while what it does is to "reset it". For the context of offset tracking delete and reset seem to be the same thing here

@fallen-up
Copy link

Is the challenge that the name is misleading?

The original API also uses the "delete" terminology, while what it does is to "reset it". For the context of offset tracking delete and reset seem to be the same thing here

let's go the other way around.
suppose there is a kind person who implements "PATCH /connectors/{connector}/offsets" - how should he call the button? "patch"?
if so, why can't the current one be called "delete"? and then you won't need to look at the documentation to understand what it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted PRs accepted towards hacktoberfest goal and will be counted as approved scope/backend Related to backend changes status/triage/completed Automatic triage completed type/feature A brand new feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

KC: Support First-class offsets in Kafka Connect
5 participants