Basapuram Kumar created RANGER-4932:
---------------------------------------
Summary: Specified key was too long; max key length is 3072 bytes
Key: RANGER-4932
URL: https://issues.apache.org/jira/browse/RANGER-4932
Project: Ranger
Issue Type: Bug
Components: admin
Affects Versions: 2.5.0
Reporter: Basapuram Kumar
Trying upgrade ranger from 2.3.0 to 2.5.0, but failed with the below error.
Error logging
{noformat}
2024-09-12 20:35:21,377 [I] Executing patch on ranger from file:
073-create-x_trx_log_v2.sql
2024-09-12 20:35:21,377 [JISQL] /usr/lib/jvm/java-11-openjdk/bin/java -cp
/usr/odp/current/ranger-admin/ews/lib/mysql-jdbc-driver.jar:/usr/odp/current/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver mysqlconj -cstring
jdbc:mysql://ce19.acceldata.dvl/ranger?useSSL=false -u 'ranger' -p '********'
-noheader -trim -c \; -query "select version from x_db_version_h where version
= '073' and active = 'Y';"2024-09-12 20:35:21,528 [JISQL]
/usr/lib/jvm/java-11-openjdk/bin/java -cp
/usr/odp/current/ranger-admin/ews/lib/mysql-jdbc-driver.jar:/usr/odp/current/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver mysqlconj -cstring
jdbc:mysql://ce19.acceldata.dvl/ranger?useSSL=false -u 'ranger' -p '********'
-noheader -trim -c \; -query "select version from x_db_version_h where version
= '073' and active = 'N';"2024-09-12 20:35:21,687 [JISQL]
/usr/lib/jvm/java-11-openjdk/bin/java -cp
/usr/odp/current/ranger-admin/ews/lib/mysql-jdbc-driver.jar:/usr/odp/current/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver mysqlconj -cstring
jdbc:mysql://ce19.acceldata.dvl/ranger?useSSL=false -u 'ranger' -p '********'
-noheader -trim -c \; -query "insert into x_db_version_h (version, inst_at,
inst_by, updated_at, updated_by,active) values ('073', current_timestamp,
'Ranger 2.5.0.3.3.6.0-2', current_timestamp, 'ce19.acceldata.dvl','N')
;"2024-09-12 20:35:21,839 [I] Patch 073-create-x_trx_log_v2.sql is being
applied..
2024-09-12 20:35:21,839 [JISQL] /usr/lib/jvm/java-11-openjdk/bin/java -cp
/usr/odp/current/ranger-admin/ews/lib/mysql-jdbc-driver.jar:/usr/odp/current/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver mysqlconj -cstring
jdbc:mysql://ce19.acceldata.dvl/ranger?useSSL=false -u 'ranger' -p '********'
-noheader -trim -c \; -input
/usr/odp/current/ranger-admin/db/mysql/patches/073-create-x_trx_log_v2.sql
Error executing: CREATE TABLE `x_trx_log_v2` ( `id` bigint(20) NOT NULL
AUTO_INCREMENT, `create_time` datetime DEFAULT NULL, `added_by_id`
bigint(20) DEFAULT NULL, `class_type` int(11) NOT NULL DEFAULT '0',
`object_id` bigint(20) DEFAULT NULL, `parent_object_id` bigint(20) DEFAULT
NULL, `parent_object_class_type` int(11) NOT NULL DEFAULT '0',
`parent_object_name` varchar(1024) DEFAULT NULL, `object_name` varchar(1024)
DEFAULT NULL, `change_info` MEDIUMTEXT NULL DEFAULT NULL, `trx_id`
varchar(1024) DEFAULT NULL, `action` varchar(255) DEFAULT NULL, `sess_id`
varchar(512) DEFAULT NULL, `req_id` varchar(30) DEFAULT NULL, `sess_type`
varchar(30) DEFAULT NULL, PRIMARY KEY (`id`), KEY
`x_trx_log_v2_FK_added_by_id` (`added_by_id`), KEY `x_trx_log_v2_cr_time`
(`create_time`), KEY `x_trx_log_v2_trx_id` (`trx_id`) )ROW_FORMAT=DYNAMIC;
java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is
3072 bytes
SQLException : SQL state: 42000 java.sql.SQLSyntaxErrorException: Specified key
was too long; max key length is 3072 bytes ErrorCode: 10712024-09-12
20:35:21,986 [JISQL] /usr/lib/jvm/java-11-openjdk/bin/java -cp
/usr/odp/current/ranger-admin/ews/lib/mysql-jdbc-driver.jar:/usr/odp/current/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver mysqlconj -cstring
jdbc:mysql://ce19.acceldata.dvl/ranger?useSSL=false -u 'ranger' -p '********'
-noheader -trim -c \; -query "select version from x_db_version_h where version
= '073' and active = 'Y';"
2024-09-12 20:35:22,145 [JISQL] /usr/lib/jvm/java-11-openjdk/bin/java -cp
/usr/odp/current/ranger-admin/ews/lib/mysql-jdbc-driver.jar:/usr/odp/current/ranger-admin/jisql/lib/*
org.apache.util.sql.Jisql -driver mysqlconj -cstring
jdbc:mysql://ce19.acceldata.dvl/ranger?useSSL=false -u 'ranger' -p '********'
-noheader -trim -c \; -query "delete from x_db_version_h where version = '073'
and active = 'N' and updated_by='ce19.acceldata.dvl';"
2024-09-12 20:35:22,297 [E] 073-create-x_trx_log_v2.sql import
failed!{noformat}
When checked at MySql, the table DDL is as follows
{noformat}
CREATE TABLE `x_trx_log_v2` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`create_time` datetime DEFAULT NULL,
`added_by_id` bigint(20) DEFAULT NULL,
`class_type` int(11) NOT NULL DEFAULT '0',
`object_id` bigint(20) DEFAULT NULL,
`parent_object_id` bigint(20) DEFAULT NULL,
`parent_object_class_type` int(11) NOT NULL DEFAULT '0',
`parent_object_name` varchar(1024) DEFAULT NULL,
`object_name` varchar(1024) DEFAULT NULL,
`change_info` MEDIUMTEXT NULL DEFAULT NULL,
`trx_id` varchar(1024) DEFAULT NULL,
`action` varchar(255) DEFAULT NULL,
`sess_id` varchar(512) DEFAULT NULL,
`req_id` varchar(30) DEFAULT NULL,
`sess_type` varchar(30) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `x_trx_log_v2_FK_added_by_id` (`added_by_id`),
KEY `x_trx_log_v2_cr_time` (`create_time`),
KEY `x_trx_log_v2_trx_id` (`trx_id`)
) ROW_FORMAT=DYNAMIC;{noformat}
By Adding the "DEFAULT CHARSET=latin1", able to get rid of this error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)