unknowntpo commented on code in PR #111:
URL:
https://github.com/apache/gravitino-playground/pull/111#discussion_r1976415351
##########
init/common/init_metalake_catalog.sh:
##########
@@ -35,9 +38,12 @@ if echo "$response" | grep -q "\"code\":0"; then
true
else
# Create Hive catalog for experience Gravitino service
- response=$(curl -X POST -H "Content-Type: application/json" -d
'{"name":"catalog_hive","type":"RELATIONAL", "provider":"hive",
"comment":"comment","properties":{"metastore.uris":"thrift://'${HIVE_HOST_IP}':9083"
}}' http://gravitino:8090/api/metalakes/metalake_demo/catalogs)
+ response=$(curl -X POST -H "Content-Type: application/json" -d
'{"name":"catalog_hive","type":"RELATIONAL", "provider":"hive",
"comment":"comment","properties":{"metastore.uris":"thrift://hive:9083" }}'
http://gravitino:8090/api/metalakes/metalake_demo/catalogs)
if echo "$response" | grep -q "\"code\":0"; then
true # Placeholder, do nothing
+ elif echo "$response" | grep -q
"\"type\":\"CatalogAlreadyExistsException\""; then
+ echo "Catalog catalog_hive already exists"
+ true # Placeholder, do nothing
Review Comment:
Because we use `init_metalake_catalog.sh` in both `trino` and `spark`,
For example, during `spark` container initialization, even if we send `GET`
request to make sure `catalog_hive` not exist, between first and second
request, `trino` container may also find `catalog_hive` not exist and create
`catalog_hive`, this cause problem.
```
response=$(curl
http://gravitino:8090/api/metalakes/metalake_demo/catalogs/catalog_hive)
if echo "$response" | grep -q "\"code\":0"; then
true
else
# Create Hive catalog for experience Gravitino service
response=$(curl -X POST -H "Content-Type: application/json" -d
'{"name":"catalog_hive","type":"RELATIONAL", "provider":"hive",
"comment":"comment","properties":{"metastore.uris":"thrift://hive:9083" }}'
http://gravitino:8090/api/metalakes/metalake_demo/catalogs)
if echo "$response" | grep -q "\"code\":0"; then
true # Placeholder, do nothing
else
echo "catalog_hive create failed"
exit 1
fi
fi
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]