[ https://issues.apache.org/jira/browse/IGNITE-24321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrey Mashenkov updated IGNITE-24321: -------------------------------------- Description: Catalog service has a method with a nullable annotation. {code:java} @Nullable Catalog catalog(int catalogVersion); {code} The only possible ways to get null is either ask for version in unseen future or from very past below the watermark. Both cases are result of contract violation and invalid CatalogService usage. A user/query should ensure the version is available * not below watermark and gathered by GC * ensure and/or wait until node got actual metadata via SchemaSyncService. Actually, we never expect to get a `null` from here use versions in valid version range: [earliest, latest], but in case of bug we will got meaningless NPE. So, let's drop `@Nullable` annotation and throw an explicit exception. was: On one hand, `Catalog` class is an internal container for descriptors and wasn't designed to be used directly outside the module. On the other hand `CatalogService` interface has a bunch of similar methods for accessing catalog internals. Let's disclose `Catalog` class: describe it in README.md of `ignite-catalog` module, write javadocs and maybe add some shortcut method (e.g. `table(schemaName, tableName)`) Let's remove all the methods, which returns `Catalog` class internals, from `CatalogService`. So, `CatalogService` should have few methods that answer the question: * which catalog version is actual at point-in-time * which catalog version is earliest/latest * when catalog is initialized/catalog version is ready by returning a future. * gets `Catalog` snapshot for version/point-in-time > Avoid return null from CatalogService methods. > ----------------------------------------------- > > Key: IGNITE-24321 > URL: https://issues.apache.org/jira/browse/IGNITE-24321 > Project: Ignite > Issue Type: Improvement > Reporter: Andrey Mashenkov > Assignee: Andrey Mashenkov > Priority: Major > Labels: ignite-3, tech-debt > Fix For: 3.1 > > > Catalog service has a method with a nullable annotation. > {code:java} > @Nullable Catalog catalog(int catalogVersion); > {code} > The only possible ways to get null is either ask for version in unseen future > or from very past below the watermark. Both cases are result of contract > violation and invalid CatalogService usage. > A user/query should ensure the version is available > * not below watermark and gathered by GC > * ensure and/or wait until node got actual metadata via SchemaSyncService. > Actually, we never expect to get a `null` from here use versions in valid > version range: [earliest, latest], but in case of bug we will got meaningless > NPE. > So, let's drop `@Nullable` annotation and throw an explicit exception. -- This message was sent by Atlassian Jira (v8.20.10#820010)