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

[Bug report] alterSchema throw NoSuchSchemaException #316

Closed
xunliu opened this issue Sep 3, 2023 · 5 comments
Closed

[Bug report] alterSchema throw NoSuchSchemaException #316

xunliu opened this issue Sep 3, 2023 · 5 comments
Assignees

Comments

@xunliu
Copy link
Member

xunliu commented Sep 3, 2023

Describe what's wrong

NameIdentifier ident = NameIdentifier.of(metalakeName, catalogName, schemaName);
Map<String, String> properties = Maps.newHashMap();
properties.put("key1", "val1");
properties.put("key2", "val2");
String comment = "comment";

GravitonMetaLake metalake = client.loadMetalake(NameIdentifier.of(metalakeName));
Catalog catalog = metalake.loadCatalog(NameIdentifier.of(metalakeName, catalogName));
catalog
    .asSchemas()
    .alterSchema(
        ident,
        SchemaChange.removeProperty("key1"),
        SchemaChange.setProperty("key2", "val2-alter"));

NameIdentifier[] nameIdentifiers = catalog.asSchemas().listSchemas(ident.namespace()); // have this schema
Map<String, String> properties2 = catalog.asSchemas().loadSchema(ident).properties(); // but throw NoSuchSchemaException

Error message and/or stacktrace

Failed to operate schema(s) [CatalogHiveIT_schema_28477ecad7ac4e4a97268a01827e6596] operation [LOAD] under catalog [CatalogHiveIT_catalog_93d5c31050ba4873be44c22c4fdc2dcc], reason [NoSuchSchemaException]
com.datastrato.graviton.exceptions.NoSuchSchemaException: Hive schema (database) does not exist: CatalogHiveIT_schema_28477ecad7ac4e4a97268a01827e6596 in Graviton store
at com.datastrato.graviton.catalog.hive.HiveCatalogOperations.loadSchema(HiveCatalogOperations.java:267)
at com.datastrato.graviton.catalog.hive.HiveCatalogOperations.loadSchema(HiveCatalogOperations.java:60)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.lambda$null$4(CatalogOperationDispatcher.java:102)
at com.datastrato.graviton.catalog.CatalogManager$CatalogWrapper.lambda$doWithSchemaOps$0(CatalogManager.java:79)
at com.datastrato.graviton.utils.IsolatedClassLoader.withClassLoader(IsolatedClassLoader.java:64)
at com.datastrato.graviton.catalog.CatalogManager$CatalogWrapper.doWithSchemaOps(CatalogManager.java:74)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.lambda$loadSchema$5(CatalogOperationDispatcher.java:102)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.doWithCatalog(CatalogOperationDispatcher.java:245)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.loadSchema(CatalogOperationDispatcher.java:100)
at com.datastrato.graviton.server.web.rest.SchemaOperations.loadSchema(SchemaOperations.java:94)
.......

Caused by: com.datastrato.graviton.exceptions.NoSuchEntityException: CatalogHiveIT_metalake_dba163a1ff434e2584a8d9dfdb5a9022.CatalogHiveIT_catalog_93d5c31050ba4873be44c22c4fdc2dcc.CatalogHiveIT_schema_28477ecad7ac4e4a97268a01827e6596
at com.datastrato.graviton.storage.kv.KvEntityStore.get(KvEntityStore.java:132)
at com.datastrato.graviton.catalog.hive.HiveCatalogOperations.loadSchema(HiveCatalogOperations.java:243)
... 66 more
com.datastrato.graviton.exceptions.NoSuchSchemaException: Failed to operate schema(s) [CatalogHiveIT_schema_28477ecad7ac4e4a97268a01827e6596] operation [LOAD] under catalog [CatalogHiveIT_catalog_93d5c31050ba4873be44c22c4fdc2dcc], reason [NoSuchSchemaException]
com.datastrato.graviton.exceptions.NoSuchSchemaException: Hive schema (database) does not exist: CatalogHiveIT_schema_28477ecad7ac4e4a97268a01827e6596 in Graviton store
at com.datastrato.graviton.catalog.hive.HiveCatalogOperations.loadSchema(HiveCatalogOperations.java:267)
at com.datastrato.graviton.catalog.hive.HiveCatalogOperations.loadSchema(HiveCatalogOperations.java:60)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.lambda$null$4(CatalogOperationDispatcher.java:102)
at com.datastrato.graviton.catalog.CatalogManager$CatalogWrapper.lambda$doWithSchemaOps$0(CatalogManager.java:79)
at com.datastrato.graviton.utils.IsolatedClassLoader.withClassLoader(IsolatedClassLoader.java:64)
at com.datastrato.graviton.catalog.CatalogManager$CatalogWrapper.doWithSchemaOps(CatalogManager.java:74)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.lambda$loadSchema$5(CatalogOperationDispatcher.java:102)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.doWithCatalog(CatalogOperationDispatcher.java:245)
at com.datastrato.graviton.catalog.CatalogOperationDispatcher.loadSchema(CatalogOperationDispatcher.java:100)
at com.datastrato.graviton.server.web.rest.SchemaOperations.loadSchema(SchemaOperations.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

How to reproduce

  • execute CatalogHiveIT::testAlterSchema()

Additional context

No response

@jerryshao
Copy link
Contributor

What's the relation between this issue and #320, @yuqi1129 ?

@yuqi1129
Copy link
Contributor

What's the relation between this issue and #320, @yuqi1129 ?

They are actually separate issues. #320 focuses on deletion logic in drop that can be simplified. As we support cascade deletion, there is no need to remove tables before dropping the schema. Maybe it's just a improvement.

@jerryshao
Copy link
Contributor

@yuqi1129 Can you please clean up your opened issues, if it is not required or duplicated, please leave a comment and close the issue.

@yuqi1129
Copy link
Contributor

This issue was resolved by #403 by the way. We will allow #346 to track case-sensitive problems.

@yuqi1129
Copy link
Contributor

I will close this issue as it has been resolved by #403.

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