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

Small improvements #407

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Small improvements #407

wants to merge 6 commits into from

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Jul 10, 2024

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

* 

Copy link
Member

@mosabua mosabua left a comment

Choose a reason for hiding this comment

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

Looks good. Just some minor comments.

My main impression from this PR is a reminder that we really ought to get rid of the usage of "backend" throughout the codebase and docs and replace it with "Trino cluster" and "cluster" as necessary in the context. We agreed on doing this in a dev sync and just have not gotten around to it.. maybe we should file an issue so we dont forget.


scheduledFuture = scheduledExecutor.scheduleAtFixedRate(() -> {
try {
log.info("Getting the stats for the active clusters");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
log.info("Getting the stats for the active clusters");
log.info("Getting stats for all active clusters");

@mosabua
Copy link
Member

mosabua commented Jul 10, 2024

Filed the issue now - #408

Comment on lines +105 to +106
scheduledFuture.cancel(true);
scheduledExecutor.shutdown();
Copy link
Member

@oneonestar oneonestar Jul 11, 2024

Choose a reason for hiding this comment

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

I think scheduledFuture can be removed if we use scheduledExecutor.shutdownNow().

catch (Exception e) {
log.error(e, "Error with monitor task");
}
if (clusterStatsObservers != null) {
Copy link
Member

Choose a reason for hiding this comment

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

The requireNonNull added above should have eliminated this condition.

}
return null;
Copy link
Member

Choose a reason for hiding this comment

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

This change from using null to throwing exceptions for error handling.
The null checks need to be updated accordingly.

if (client == null) {
log.error("Client received is null");
return null;
}

Comment on lines +155 to +161
yield null;
}
default -> null;
};
}
catch (IOException e) {
e.printStackTrace();
throw new UncheckedIOException(e);
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused on the error handling.
Why mix null and throw exception for error handling?

@mosabua
Copy link
Member

mosabua commented Jul 22, 2024

@wendigo .. gentle ping ;-)

@wendigo
Copy link
Contributor Author

wendigo commented Jul 22, 2024

@mosabua ? :)

@ebyhr ebyhr removed their request for review July 29, 2024 04:21
@oneonestar
Copy link
Member

How should we proceed. Should we merge it and create some follow-up PR?

@wendigo
Copy link
Contributor Author

wendigo commented Jul 30, 2024

@oneonestar I'll go back to this PR later this week :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants