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

MINOR: remove ZK from code base #529

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

MINOR: remove ZK from code base #529

wants to merge 9 commits into from

Conversation

mjsax
Copy link
Member

@mjsax mjsax commented Dec 17, 2024

No description provided.

@mjsax mjsax requested a review from a team as a code owner December 17, 2024 04:56
@sonarqube-confluent

This comment has been minimized.

@@ -241,6 +238,12 @@
<classifier>test</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-test-common</artifactId>
Copy link
Member Author

Choose a reason for hiding this comment

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

To pull in KafkaClusterTestKit.

<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
</dependency>
Copy link
Member Author

Choose a reason for hiding this comment

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

W/o this, I got some ClassNotFoundException error -- just Googled for the error and found to add this... 🤷

producer.send(new ProducerRecord<>(WikipediaFeedAvroExample.WIKIPEDIA_FEED,
new WikiFeed("john", true, "first post")));
producer.flush();
try (final KafkaProducer<String, WikiFeed> producer = new KafkaProducer<>(props)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Side cleanup to close the producer properly.

final Map<String, String> effectiveBrokerConfig = effectiveBrokerConfigFrom(brokerConfig);
log.debug(
"Starting a Kafka instance on port {} ...",
effectiveBrokerConfig.get(SocketServerConfigs.LISTENERS_CONFIG)
Copy link
Member Author

Choose a reason for hiding this comment

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

Given that we don't configure this explicitly any longer, I am not 100% if this is still right?

Copy link
Member

Choose a reason for hiding this comment

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

Have your tried running it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I did run it locally -- not sure what your question is?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does log Starting a Kafka instance on port null ... (what make sense given that we did remove the config...)

I don't know how I could get the port though... maybe best to just remove the DEBUG line all together? Seems not to add much value?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, this is just confusing. remove the log

effectiveConfig.putAll(brokerConfig);
effectiveConfig.put(ZkConfigs.ZK_CONNECT_CONFIG, zookeeper.connectString());
effectiveConfig.put(ZkConfigs.ZK_SESSION_TIMEOUT_MS_CONFIG, 30 * 1000);
effectiveConfig.put(SocketServerConfigs.LISTENERS_CONFIG, String.format("PLAINTEXT://127.0.0.1:%s", DEFAULT_BROKER_PORT));
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed to remove this -- otherwise, I got some config errors about other missing config... not sure why this was set to begin with? Did not want to go down the rabbit whole figuring out all other required/dependent configs to keep it (also not sure why it did work with the old setup, but not the new one... 🤷)

} catch (final Exception fatal) {
throw new RuntimeException(fatal);
if (schemaRegistry != null) {
schemaRegistry.stop();
}
if (broker != null) {
broker.stop();
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 throws now, so changed the try-catch to also handle it.

@@ -267,16 +253,14 @@ private TopicsDeletedCondition(final String... topics) {

@Override
public boolean conditionMet() {
//TODO once KAFKA-6098 is fixed use AdminClient to verify topics have been deleted
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 is not fixed yet... but was simplest to just use Admin client now...

private Properties effectiveConfigFrom(final Properties initialConfig) {
final Properties effectiveConfig = new Properties();
effectiveConfig.put(ServerConfigs.BROKER_ID_CONFIG, 0);
effectiveConfig.put(SocketServerConfigs.LISTENERS_CONFIG, "PLAINTEXT://127.0.0.1:9092");
Copy link
Member Author

Choose a reason for hiding this comment

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

As above. Removed this one.

@sonarqube-confluent
Copy link

Passed

Analysis Details

2 Issues

  • Bug 2 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage No coverage information (0.00% Estimated after merge)
  • Duplications No duplication information (47.20% Estimated after merge)

Project ID: kafka-streams-examples

View in SonarQube

@@ -24,7 +24,7 @@ global_job_config:
prologue:
commands:
- checkout
- sem-version java 11
- sem-version java 17
Copy link
Member Author

Choose a reason for hiding this comment

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

Temp fix as ae49f5f did not make it into master yet.

\cc @hk10111 -- hope we can resolve the merge conflicts soon... Or merging this PR will create more conflicts.

@@ -155,7 +155,7 @@ after_pipeline:
- name: SonarQube
commands:
- checkout
- sem-version java 11
- if [[ $SEMAPHORE_GIT_BRANCH =~ ^7\..* ]]; then sem-version java 8; else sem-version java 17; fi
Copy link
Member

@lucasbru lucasbru Jan 3, 2025

Choose a reason for hiding this comment

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

why change from 11 to 8? 11 is the recommended version for CP.
should we cover 6.x releases as well in case of (out of support window) backports?

Copy link
Member Author

Choose a reason for hiding this comment

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

For 7.x, we still support Java 8. -- I don't think it's about recommended, but supported?

It's more a question for @hk10111 thouhg. Cf #527

I would have hard-coded Java 8 for older branches and hard-coded Java 17 for 8.0+, but they want to have the same semaphore.yml config across all branches -- that's why the if-else.

Guess we could also use Java 11 for older branches, but historically we use Java 8.

Anyway, the other commit finally made it into all branches I believe, so this change will go away for this PR anyway.

Copy link
Member

@lucasbru lucasbru left a comment

Choose a reason for hiding this comment

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

I left some comments, but mostly looking good to me

@mjsax
Copy link
Member Author

mjsax commented Jan 7, 2025

Build is broken due to broken upstream dependency. Need to wait for an upstream fix...

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