linghengqian commented on code in PR #5629:
URL: https://github.com/apache/hive/pull/5629#discussion_r1945939111
##########
packaging/src/docker/README.md:
##########
@@ -210,3 +210,14 @@ docker compose down
select count(distinct a) from hive_example;
select sum(b) from hive_example;
```
+
+#### Hive Schema Tool
+
+`Hive Schema Tool` is located in the Docker Image at
`/opt/hive/bin/schematool`.
+Possible use cases are as follows,
+
+```shell
+docker run -d --env SERVICE_NAME=hiveserver2 --name hive4
apache/hive:${HIVE_VERSION}
+docker exec -it hive4 /bin/bash
+/opt/hive/bin/schematool -info -dbType hive -metaDbType derby -url
jdbc:hive2://localhost:10000/default
Review Comment:
- The current document changes are actually for the adjustment of
`entrypoint.sh` in the PR.
- To test `-info` against the `4.0.1` Docker Image of HiveServer2, this set
of commands is needed,
```shell
docker run -d --env SERVICE_NAME=hiveserver2 --name hive4 apache/hive:4.0.1
docker exec -it hive4 /bin/bash
/opt/hive/bin/schematool -initSchema -dbType hive -metaDbType derby -url
jdbc:hive2://localhost:10000/default
/opt/hive/bin/schematool -info -dbType hive -metaDbType derby -url
jdbc:hive2://localhost:10000/default
exit
```
- To test `-info` against the Hive Metastore Server of the 4.0.1 Docker
Image, the following command is impossible to implement, because the Hive
Metastore Server uses Derby in memory mode as the storage backend by default.
At this time, the Derby instance has no concept of server and client, and
naturally cannot be connected through jdbcUrl.
```shell
docker run -d --env SERVICE_NAME=metastore --name metastore-standalone
apache/hive:4.0.1
docker exec -it metastore-standalone /bin/bash
/opt/hive/bin/schematool -info -dbType derby
```
```shell
hive@e4ab5b40d3bf:/opt/hive$ /opt/hive/bin/schematool -info -dbType derby
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/opt/hive/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
SLF4J: Actual binding is of type
[org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL:
jdbc:derby:;databaseName=metastore_db;create=true
Metastore connection Driver : org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User: APP
Failed to get schema version.
Underlying cause: java.sql.SQLException : Failed to start database
'metastore_db' with class loader sun.misc.Launcher$AppClassLoader@3551a94, see
the next exception for details.
SQL Error code: 40000
Use --verbose for detailed stacktrace.
*** schemaTool failed ***
hive@e4ab5b40d3bf:/opt/hive$ /opt/hive/bin/schematool -info -dbType derby
--verbose
hive@e4ab5b40d3bf:/opt/hive$ /opt/hive/bin/schematool -info -dbType derby
--verbose
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/opt/hive/lib/log4j-slf4j-impl-2.18.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
SLF4J: Actual binding is of type
[org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL:
jdbc:derby:;databaseName=metastore_db;create=true
Metastore connection Driver : org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User: APP
Failed to get schema version.
Underlying cause: java.sql.SQLException : Failed to start database
'metastore_db' with class loader sun.misc.Launcher$AppClassLoader@3551a94, see
the next exception for details.
SQL Error code: 40000
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema
version.
at
org.apache.hadoop.hive.metastore.tools.schematool.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:94)
at
org.apache.hadoop.hive.metastore.tools.schematool.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:103)
at
org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo.getMetaStoreSchemaVersion(MetaStoreSchemaInfo.java:244)
at
org.apache.hadoop.hive.metastore.tools.schematool.SchemaToolTaskInfo.execute(SchemaToolTaskInfo.java:36)
at
org.apache.hadoop.hive.metastore.tools.schematool.MetastoreSchemaTool.run(MetastoreSchemaTool.java:484)
at
org.apache.hive.beeline.schematool.HiveSchemaTool.main(HiveSchemaTool.java:143)
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)
at org.apache.hadoop.util.RunJar.run(RunJar.java:328)
at org.apache.hadoop.util.RunJar.main(RunJar.java:241)
Caused by: java.sql.SQLException: Failed to start database 'metastore_db'
with class loader sun.misc.Launcher$AppClassLoader@3551a94, see the next
exception for details.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
at org.apache.derby.jdbc.InternalDriver$1.run(Unknown Source)
at org.apache.derby.jdbc.InternalDriver$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
at org.apache.derby.jdbc.AutoloadedDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at
org.apache.hadoop.hive.metastore.tools.schematool.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:88)
... 11 more
Caused by: ERROR XJ040: Failed to start database 'metastore_db' with class
loader sun.misc.Launcher$AppClassLoader@3551a94, see the next exception for
details.
at
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source)
... 26 more
Caused by: ERROR XSDB6: Another instance of Derby may have already booted
the database /opt/hive/metastore_db.
at
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown
Source)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown
Source)
at
org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
at org.apache.derby.impl.store.raw.RawStore$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.derby.impl.store.raw.RawStore.bootServiceModule(Unknown Source)
at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
at org.apache.derby.impl.store.access.RAMAccessManager$5.run(Unknown
Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.derby.impl.store.access.RAMAccessManager.bootServiceModule(Unknown
Source)
at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown
Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source)
at
org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source)
at org.apache.derby.impl.db.BasicDatabase$5.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.derby.impl.db.BasicDatabase.bootServiceModule(Unknown
Source)
at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown
Source)
at
org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown
Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
Source)
at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
Source)
at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedConnection$4.run(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.derby.impl.jdbc.EmbedConnection.startPersistentService(Unknown
Source)
... 23 more
*** schemaTool failed ***
```
- Do you mean that I should state in the Docker quickstart documentation
that `Hive Schema Tool` is not available for the default configuration of the
Hive Metastore Server?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]