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

Introduce deletion-mode for topics #418

Merged
merged 6 commits into from
Sep 15, 2023
Merged

Introduce deletion-mode for topics #418

merged 6 commits into from
Sep 15, 2023

Conversation

nicoloboschi
Copy link
Member

@nicoloboschi nicoloboschi commented Sep 15, 2023

Changes:

  • New option in the topic section deletion-mode
    Possible values are none, delete
    none is the default value.

none means to keep the topic when the app is deleted
delete means to delete the topic when the app is deleted

Note that delete works only if the creation-mode is create-if-not-exists. This is because in that case we know that we can actually manage that topic inside the langstream app.

Example:

topics:
  - name: input-topic
    creation-mode: create-if-not-exists
  - name: output-topic
    creation-mode: create-if-not-exists
    deletion-mode: delete
  • Added a new setup-cleanup job right after the runtime deployer cleanup. The latter only deletes the agents. The new job is responsible to delete the topics (and the assets very soon)
  • Added the app deletion in the e2e tests to ensure correct behaviour

@nicoloboschi nicoloboschi marked this pull request as ready for review September 15, 2023 07:44
Copy link
Member

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

I have left some comments

I am not sure that this is enough clear
deletion-mode: delete

what about:
deletion-mode: delete-on-uninstall

because 'delete' means too less (or too much)

@@ -147,6 +152,11 @@ public void deployAsset() throws Exception {
}
}
}

@Override
public void deleteAsset() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

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

we can add a "default" method implementation here

Copy link
Member Author

Choose a reason for hiding this comment

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

this code is not actually called, I'll follow up in the next pr

@@ -354,6 +354,7 @@ private Topic buildImplicitTopicForDeadletterQueue(
new TopicDefinition(
name,
creationMode,
TopicDefinition.CREATE_MODE_NONE,
Copy link
Member

Choose a reason for hiding this comment

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

this should be the same as the original topic, the same way we do for "creationMode"

log.info("Topic {} does not exist", topic.name());
} else {
throw e;
if (topic.deleteMode().equals(TopicDefinition.DELETE_MODE_DELETE)) {
Copy link
Member

Choose a reason for hiding this comment

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

topic.deleteMode() may be null for old pipelines, please use Objects.equals()

}
}
default -> log.info("Keeping Kafka topic {}", topic.name());
default -> log.info(
"Keeping Kafka topic {} since creation-mode is {}",
Copy link
Member

Choose a reason for hiding this comment

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

this is not clear

@eolivelli eolivelli merged commit ab233b2 into main Sep 15, 2023
8 checks passed
@eolivelli eolivelli deleted the cleanup-jobs branch September 15, 2023 10:14
benfrank241 pushed a commit to vectorize-io/langstream that referenced this pull request May 2, 2024
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.

2 participants