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

Nessie: Extract Catalog client code to NessieClient for Trino Consumption #4491

Merged
merged 3 commits into from
Apr 19, 2022

Conversation

nastra
Copy link
Contributor

@nastra nastra commented Apr 4, 2022

This adds a new NessieIcebergClient class that encapsulates some of
the features that have been used across the NessieCatalog.
It also slightly improves the error messages to include the reference or
the table name when something fails.

Note that the testFailure() method was updated, because we're now
always using the same UpdateableReference between NessieCatalog and
NessieTableOperations, so that it's higly unlikely that those two get
out-of-sync.

@github-actions github-actions bot added the NESSIE label Apr 4, 2022
@nastra nastra requested a review from rdblue April 5, 2022 06:50
@nastra nastra force-pushed the simplify-nessie-catalog branch 2 times, most recently from 848f4a4 to 162a886 Compare April 7, 2022 12:10
// to catch all kinds of network errors (e.g. connection reset). Network code implementation
// details and all kinds of network devices can induce unexpected behavior. So better be
// safe than sorry.
throw new CommitStateUnknownException(ex);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should only be used when committing to the table. While this may not know whether the table was renamed or not, this exception should be reserved for commit problems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can probably change this in a follow-up. This is just code that was moved from the NessieCatalog to this place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed in #4592

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NessieIcebergClient implements AutoCloseable {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that this should be public. When would anyone need to use this directly?

Also, this looks like it implements most of the catalog API. Is it really cleaner to move code here? What is the distinct purpose of this class vs the NessieCatalog class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as discussed on Slack, the idea was initially to clean things up in the NessieCatalog. However, I realized that we can re-use this entire code in Trino (where we're currently integrating Nessie as well). That's the main reason for making this class public

@nastra nastra requested a review from rdblue April 19, 2022 09:48
This adds a new `NessieIcebergClient` class that encapsulates some of
the features that have been used across the `NessieCatalog`.
It also slightly improves the error messages to include the reference or
the table name when something fails.

Note that the `testFailure()` method was updated, because we're now
always using the same `UpdateableReference` between `NessieCatalog` and
`NessieTableOperations`, so that it's higly unlikely that those two get
out-of-sync.
@RussellSpitzer RussellSpitzer changed the title Nessie: simplify code in Nessie catalog Nessie: Extract Catalog client code to NessieClient for Trino Consumption Apr 19, 2022
Copy link
Member

@RussellSpitzer RussellSpitzer 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 to me.

@RussellSpitzer RussellSpitzer merged commit 9618147 into apache:master Apr 19, 2022
@RussellSpitzer
Copy link
Member

@nastra Merged! Thanks for the PR and I hope to see that Nessie Trino Support soon!

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

Successfully merging this pull request may close these issues.

4 participants