Hi Away Hua,
Thanx for the report. I think that is indeed a bug in the docker image.

Here it is calling initOrUpgrade schema here [1]
Where as initOrUpgrade is introduced in HIVE-20357 which is there post
4.0.0-alpha-1 [2]

You can raise a hive ticket for this & the fix most probably should be
to use initSchema directly rather than initOrUpgradeSchema.

you can try locally as well by changing it in line [1] and then

cd packaging/src/docker/

./build.sh -hive 3.1.3 -hadoop 3.1.0 -tez 0.9.1

This should build an image locally with the change & you can retry, it
should work. If it does, feel free to create a PR with the fix, if it
doesn't work, let me know. I tried locally and it works for me.

I have pushed the updated image as well

-Ayush


[1] 
https://github.com/apache/hive/blob/master/packaging/src/docker/entrypoint.sh#L27
[2] https://issues.apache.org/jira/browse/HIVE-20357

On Tue, 5 Sept 2023 at 09:10, Away Hua <infohu...@gmail.com> wrote:
>
> I followed the QuickStart section of hive quickstart to start hiveserver2 
> with version 3.1.3 in docker container. However, I can't start hiveserver2 
> container successfully.  This failed container outputs the following content,
>
> + : derby
> + SKIP_SCHEMA_INIT=false
> + export HIVE_CONF_DIR=/opt/hive/conf
> + HIVE_CONF_DIR=/opt/hive/conf
> + '[' -d '' ']'
> + export 'HADOOP_CLIENT_OPTS= -Xmx1G '
> + HADOOP_CLIENT_OPTS=' -Xmx1G '
> + [[ false == \f\a\l\s\e ]]
> + initialize_hive
> + /opt/hive/bin/schematool -dbType derby -initOrUpgradeSchema
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in 
> [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in 
> [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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]
> HiveSchemaTool:Parsing failed.  Reason: Missing required option: [-help print 
> this message, -alterCatalog Alter a catalog, requires --catalogLocation 
> and/or --catalogDescription parameter as well, -initSchemaTo Schema 
> initialization to a version, -upgradeSchemaFrom Schema upgrade from a 
> version, -moveDatabase Move a database between catalogs.  Argument is the 
> database name. Requires --fromCatalog and --toCatalog parameters as well, 
> -moveTable Move a table to a different database.  Argument is the table name. 
> Requires --fromCatalog, --toCatalog, --fromDatabase, and --toDatabase  
> parameters as well., -initSchema Schema initialization, -createCatalog Create 
> a catalog, requires --catalogLocation parameter as well, -upgradeSchema 
> Schema upgrade, -info Show config and schema details, -validate Validate the 
> database]
> usage: schemaTool
>  -alterCatalog <arg>                Alter a catalog, requires
>                                     --catalogLocation and/or
>                                     --catalogDescription parameter as well
>  -catalogDescription <arg>          Description of new catalog
>  -catalogLocation <arg>             Location of new catalog, required when
>                                     adding a catalog
>  -createCatalog <arg>               Create a catalog, requires
>                                     --catalogLocation parameter as well
>  -dbOpts <databaseOpts>             Backend DB specific options
>  -dbType <databaseType>             Metastore database type
>  -driver <driver>                   driver name for connection
>  -dryRun                            list SQL scripts (no execute)
>  -fromCatalog <arg>                 Catalog a moving database or table is
>                                     coming from.  This is required if you
>                                     are moving a database or table.
>  -fromDatabase <arg>                Database a moving table is coming
>                                     from.  This is required if you are
>                                     moving a table.
>  -help                              print this message
>  -ifNotExists                       If passed then it is not an error to
>                                     create an existing catalog
>  -info                              Show config and schema details
>  -initSchema                        Schema initialization
>  -initSchemaTo <initTo>             Schema initialization to a version
>  -metaDbType <metaDatabaseType>     Used only if upgrading the system
>                                     catalog for hive
>  -moveDatabase <arg>                Move a database between catalogs.
>                                     Argument is the database name.
>                                     Requires --fromCatalog and --toCatalog
>                                     parameters as well
>  -moveTable <arg>                   Move a table to a different database.
>                                     Argument is the table name. Requires
>                                     --fromCatalog, --toCatalog,
>                                     --fromDatabase, and --toDatabase
>                                     parameters as well.
>  -passWord <password>               Override config file password
>  -servers <serverList>              a comma-separated list of servers used
>                                     in location validation in the format
>                                     of scheme://authority (e.g.
>                                     hdfs://localhost:8000)
>  -toCatalog <arg>                   Catalog a moving database or table is
>                                     going to.  This is required if you are
>                                     moving a database or table.
>  -toDatabase <arg>                  Database a moving table is going to.
>                                     This is required if you are moving a
>                                     table.
>  -upgradeSchema                     Schema upgrade
>  -upgradeSchemaFrom <upgradeFrom>   Schema upgrade from a version
>  -url <url>                         connection url to the database
>  -userName <user>                   Override config file user name
>  -validate                          Validate the database
>  -verbose                           only print SQL statements
> Schema initialization failed!
> + '[' 1 -eq 0 ']'
> + echo 'Schema initialization failed!'
> + exit 1
>
> The version of docker is Docker version 24.0.5, build ced0996. The OS is 
> Linux version 5.15.0-82-generic (buildd@lcy02-amd64-046) (gcc (Ubuntu 
> 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) 
> #91~20.04.1-Ubuntu.
>
> Is this a bug with hive 3.1.3 image?

Reply via email to