unknowntpo commented on code in PR #111:
URL: 
https://github.com/apache/gravitino-playground/pull/111#discussion_r1986535419


##########
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:
   And by the way, 
   I think it will be better to run this `init_metalake_catalog.sh` in a 
separate docker compose service like this:
   
   ```
     init-script:
       build: .
       depends_on:
         gravitino:
           condition: service_healthy
         trino:
           condition: service_healthy
         hive:
           condition: service_healthy
          ... (and so on)
       command: sh -c "./init_metalake.sh"
       restart: no
   ```
   
   Hiding init script of metalake inside particular service is not very clear 
for debugging.



-- 
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]

Reply via email to