Skip to content

Conversation

@homar
Copy link
Member

@homar homar commented Aug 26, 2025

Description

metadata.catalogs should only list loaded catalogs

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.
(x) Release notes are required, with the following suggested text:

## Section
* Make `metadata.catalogs` not return unloaded catalogs. ({issue}`26493`)

@cla-bot cla-bot bot added the cla-signed label Aug 26, 2025
@homar homar requested review from kokosing and wendigo August 26, 2025 21:05
@homar homar force-pushed the homar/dont_show_failed_catalogs branch from ed011c2 to 309b680 Compare August 26, 2025 22:09
@homar
Copy link
Member Author

homar commented Aug 27, 2025

test failure is not related

Copy link
Member

@kokosing kokosing left a comment

Choose a reason for hiding this comment

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

LGTM % comments

public static Catalog failedCatalog(CatalogName catalogName, CatalogHandle catalogHandle, ConnectorName connectorName)
{
return new Catalog(catalogName, catalogHandle, connectorName);
return new Catalog(catalogName, catalogHandle, connectorName, NOT_LOADED);
Copy link
Member

Choose a reason for hiding this comment

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

LOAD_FAILED. NOT_LOADED sounds like NOT_YET_LOADED

String sql = "SELECT DISTINCT connector_name FROM system.metadata.catalogs";
List<String> loadedCatalogs = onTrino().executeQuery(sql).column(1).stream().map(Object::toString).collect(toImmutableList());
assertThat(configuredConnectors).containsExactlyInAnyOrder(loadedCatalogs.toArray(new String[0]));
// for now loki connector is not properly loaded, when this is fixed this test will fail
Copy link
Member

Choose a reason for hiding this comment

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

Please create a ticket or maybe let's remove loki from loading then. Is it used at all?

Nice, that you uncovered an issue.

.map(QueryAssert.Row::row)
.collect(Collectors.toList()));
List<String> loadedCatalogs = onTrino().executeQuery(sql).column(1).stream().map(Object::toString).collect(toImmutableList());
assertThat(configuredConnectors).containsExactlyInAnyOrder(loadedCatalogs.toArray(new String[0]));
Copy link
Contributor

Choose a reason for hiding this comment

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

wrap containsExactlyInAnyOrder on the next line

@homar homar force-pushed the homar/dont_show_failed_catalogs branch 2 times, most recently from 36730e2 to 84e9468 Compare August 28, 2025 13:51
@homar homar force-pushed the homar/dont_show_failed_catalogs branch from 84e9468 to 95fb89a Compare August 28, 2025 20:08
Session session = ((FullConnectorSession) connectorSession).getSession();
Builder table = InMemoryRecordSet.builder(CATALOG_TABLE);
for (CatalogInfo catalogInfo : listCatalogs(session, metadata, accessControl)) {
List<CatalogInfo> catalogInfos = listCatalogs(session, metadata, accessControl).stream()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not fix listCatalogs instead, what if other place use listCatalogs ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that changing a listCatalogs semantics is pretty fragile. Filtering out on the call site is more explicit about intent

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that changing a listCatalogs semantics is pretty fragile. Filtering out on the call site is more explicit about intent

Exactly my way of thinking

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you fix a javadoc for listCatalogs method?

Currently it is:

/**
 * Gets all the loaded catalogs
 */

@homar homar force-pushed the homar/dont_show_failed_catalogs branch from 95fb89a to 1044da3 Compare August 29, 2025 20:23
@homar
Copy link
Member Author

homar commented Aug 30, 2025

@wendigo can we merge this ?

@wendigo
Copy link
Contributor

wendigo commented Aug 30, 2025

@homar i'll do a final pass and merge it soon

@wendigo wendigo force-pushed the homar/dont_show_failed_catalogs branch from 1044da3 to 5333a26 Compare September 1, 2025 10:58
@wendigo wendigo force-pushed the homar/dont_show_failed_catalogs branch from 5333a26 to c3131ce Compare September 1, 2025 11:31
@homar homar force-pushed the homar/dont_show_failed_catalogs branch from c3131ce to 1903eb5 Compare September 1, 2025 19:01
@wendigo wendigo force-pushed the homar/dont_show_failed_catalogs branch from 1903eb5 to bb19b90 Compare September 2, 2025 09:05
@wendigo wendigo merged commit a7d9d91 into trinodb:master Sep 2, 2025
3 of 12 checks passed
@github-actions github-actions bot added this to the 477 milestone Sep 2, 2025
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.

4 participants