apache / gravitino-playground

A playground to experience Gravitino
Apache License 2.0
31 stars 31 forks source link

[Bug report] docker-compose in gravitino-playground doesn't configure dependency between MySQL and Gravitino #58

Closed chenyulin0719 closed 3 months ago

chenyulin0719 commented 3 months ago

Version

main branch

Describe what's wrong

In the gravitino-playground, the catalog backend is MySQL. However, the docker-compose file does not specify the dependency between MySQL and Gravitino, which leads to the following issues:

  1. Gravitino cannot be started using ./launch-playground.sh gravitino (the container is up, but Gravitino process is down)
  2. When running ./launch-playground.sh, there is no guarantee that MySQL will start before Gravitino.

Error message and/or stacktrace

In /root/gravitino/logs/gravitino-server.out after run ./launch-playground.sh gravitino

root@e3a87ccd084f:~/gravitino# cat /root/gravitino/logs/gravitino-server.out
Exception in thread "main" java.lang.RuntimeException: org.apache.iceberg.jdbc.UncheckedSQLException: Failed to connect: jdbc:mysql://mysql:3306/db
    at com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager.lambda$doWithClassLoader$4(AuxiliaryServiceManager.java:158)
    at com.datastrato.gravitino.utils.IsolatedClassLoader.withClassLoader(IsolatedClassLoader.java:72)
    at com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager.doWithClassLoader(AuxiliaryServiceManager.java:153)
    at com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager.lambda$serviceInit$6(AuxiliaryServiceManager.java:173)
    at java.util.HashMap.forEach(HashMap.java:1290)
    at com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager.serviceInit(AuxiliaryServiceManager.java:171)
    at com.datastrato.gravitino.GravitinoEnv.initialize(GravitinoEnv.java:209)
    at com.datastrato.gravitino.server.GravitinoServer.initialize(GravitinoServer.java:62)
    at com.datastrato.gravitino.server.GravitinoServer.main(GravitinoServer.java:133)
Caused by: org.apache.iceberg.jdbc.UncheckedSQLException: Failed to connect: jdbc:mysql://mysql:3306/db
    at org.apache.iceberg.jdbc.JdbcClientPool.newClient(JdbcClientPool.java:57)
    at org.apache.iceberg.jdbc.JdbcClientPool.newClient(JdbcClientPool.java:30)
    at org.apache.iceberg.ClientPoolImpl.get(ClientPoolImpl.java:125)
    at org.apache.iceberg.ClientPoolImpl.run(ClientPoolImpl.java:56)
    at org.apache.iceberg.ClientPoolImpl.run(ClientPoolImpl.java:51)
    at org.apache.iceberg.jdbc.JdbcCatalog.initializeCatalogTables(JdbcCatalog.java:146)
    at org.apache.iceberg.jdbc.JdbcCatalog.initialize(JdbcCatalog.java:130)
    at com.datastrato.gravitino.catalog.lakehouse.iceberg.utils.IcebergCatalogUtil.loadJdbcCatalog(IcebergCatalogUtil.java:66)
    at com.datastrato.gravitino.catalog.lakehouse.iceberg.utils.IcebergCatalogUtil.loadCatalogBackend(IcebergCatalogUtil.java:91)
    at com.datastrato.gravitino.catalog.lakehouse.iceberg.ops.IcebergTableOps.<init>(IcebergTableOps.java:52)
    at com.datastrato.gravitino.catalog.lakehouse.iceberg.IcebergRESTService.initServer(IcebergRESTService.java:55)
    at com.datastrato.gravitino.catalog.lakehouse.iceberg.IcebergRESTService.serviceInit(IcebergRESTService.java:80)
    at com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager.lambda$serviceInit$5(AuxiliaryServiceManager.java:176)
    at com.datastrato.gravitino.auxiliary.AuxiliaryServiceManager.lambda$doWithClassLoader$4(AuxiliaryServiceManager.java:156)
    ... 8 more
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828)
    at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448)
    at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241)
    at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:208)
    at org.apache.iceberg.jdbc.JdbcClientPool.newClient(JdbcClientPool.java:55)
    ... 21 more
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
    at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
    at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
    at com.mysql.cj.NativeSession.connect(NativeSession.java:120)
    at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818)
    ... 27 more
Caused by: java.net.UnknownHostException: mysql: Temporary failure in name resolution
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1330)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1283)
    at java.net.InetAddress.getAllByName(InetAddress.java:1199)
    at java.net.InetAddress.getAllByName(InetAddress.java:1127)
    at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:133)
    at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
    ... 30 more
root@e3a87ccd084f:~/gravitino#

How to reproduce

Run ./launch-playground.sh gravitino in gravitino-playground main branch.

Additional context

I will create a PR to fix the docker-compose.