Skip to content

Conversation

@ilanjiR
Copy link

@ilanjiR ilanjiR commented Jun 28, 2021

Problem

We need to know what version of ES server our customers are running in cloud so we can determine if it's safe to upgrade

Solution

Log ES server version on sink task startup

Does this solution apply anywhere else?
  • yes
  • no
If yes, where?

Test Strategy

Testing done:
  • Unit tests
  • Integration tests
  • System tests
  • Manual tests

Release Plan

@ilanjiR ilanjiR requested a review from a team as a code owner June 28, 2021 16:12

<properties>
<es.version>7.9.3</es.version>
<es.version>7.0.1</es.version>
Copy link
Author

Choose a reason for hiding this comment

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

We reverted the version upgrade from here: https://github.com/confluentinc/kafka-connect-elasticsearch/pull/557/files until we can confirm that it will not break compatibility

Copy link
Member

Choose a reason for hiding this comment

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

Let's revert on a separate PR that explicitly says which change (commit) get reverted.

Copy link
Member

@kkonstantine kkonstantine left a comment

Choose a reason for hiding this comment

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

@ilanjiR I'd recommend reverting on a separate PR to make changes more clear. Also, let's mention on the title that the logging change is MINOR:


<properties>
<es.version>7.9.3</es.version>
<es.version>7.0.1</es.version>
Copy link
Member

Choose a reason for hiding this comment

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

Let's revert on a separate PR that explicitly says which change (commit) get reverted.

try {
response = highLevelClient.info(RequestOptions.DEFAULT);
esVersionNumber = response.getVersion().toString();
} catch (IOException | ElasticsearchStatusException e) {
Copy link
Member

Choose a reason for hiding this comment

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

we should catch Exception e and also log the exception. This way getting version is an optional thing and we should start the connector regardless

this.client = client != null ? client : new ElasticsearchClient(config, reporter);

log.info("Started ElasticsearchSinkTask.");
log.info("Started ElasticsearchSinkTask. Connecting to ES server version: {}",
Copy link
Member

Choose a reason for hiding this comment

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

in the future scapping logs wont work. We should file another enhancement ticket to log this version as a metric this way we can plot it in datadog

Copy link
Author

Choose a reason for hiding this comment

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

response = highLevelClient.info(RequestOptions.DEFAULT);
esVersionNumber = response.getVersion().toString();
} catch (Exception e) {
log.info("Failed to get ES server version", e);
Copy link
Member

Choose a reason for hiding this comment

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

log.error

Copy link
Member

Choose a reason for hiding this comment

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

error is quite strict for this soft information.
log.warn seems like a good compromise

Copy link
Member

Choose a reason for hiding this comment

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

Also, if we use the high level client only to get the version, should we close it (and discard it) here?
What's the life cycle of this client? It might utilized threads, etc.

Copy link
Member

@kpatelatwork kpatelatwork Jun 28, 2021

Choose a reason for hiding this comment

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

This is even better idea. Agree on removing the instance level field and closing it here and removing the call from stop.

try {
highLevelClient.close();
} catch (Exception e) {
log.error("Failed to close high level client");
Copy link
Member

Choose a reason for hiding this comment

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

warn

Copy link
Member

Choose a reason for hiding this comment

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

also put this in finally of the above try?

Copy link
Author

Choose a reason for hiding this comment

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

I was thinking that leaving the client open could be potentially problematic over the long life span of a cluster

@kpatelatwork
Copy link
Member

@ilanjiR LGTM. just resolve the last minor comment before merge

@ilanjiR
Copy link
Author

ilanjiR commented Jun 28, 2021

Will merge on green build

try {
highLevelClient.close();
} catch (Exception e) {
log.warn("Failed to close high level client");
Copy link
Member

Choose a reason for hiding this comment

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

please add the exception as last argument

@ilanjiR ilanjiR merged commit 567da82 into 11.0.x Jun 28, 2021
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.

4 participants