Support Questions

Find answers, ask questions, and share your expertise

Ranger admin install fails with "007-updateBlankPolicyName.sql import failed"

avatar
Contributor

Installing Ranger via Ambari on AWS, got this:

2016-03-18 16:10:44,048 [JISQL] /usr/jdk64/jdk1.8.0_60/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/hdp/current/ranger-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://mysqldb/ranger -u 'user' -p '********' -noheader -trim -c \; -input /usr/hdp/current/ranger-admin/db/mysql/patches/007-updateBlankPolicyName.sql

Error executing: CREATE FUNCTION `getTempPolicyCount`(assetId bigint, resId bigint) RETURNS int(11) BEGIN DECLARE tempPolicyCount int default 1; DECLARE dbResourceId bigint; DECLARE exitLoop int DEFAULT FALSE; DECLARE policyList CURSOR FOR  	SELECT id from x_resource where asset_id = assetId; DECLARE CONTINUE HANDLER FOR NOT FOUND SET exitLoop = true; OPEN policyList; readPolicy : LOOP 	FETCH policyList into dbResourceId; 	IF exitLoop THEN 		set tempPolicyCount = tempPolicyCount + 1; 		LEAVE readPolicy; 	END IF; 	IF (resId = dbResourceId) THEN 		LEAVE readPolicy; 	END IF; 	set tempPolicyCount = tempPolicyCount + 1; END LOOP; CLOSE policyList; RETURN tempPolicyCount; END  
java.sql.SQLException: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
SQLException : SQL state: HY000 java.sql.SQLException: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) ErrorCode: 1418
2016-03-18 16:10:44,438  [E] 007-updateBlankPolicyName.sql import failed!
1 ACCEPTED SOLUTION

avatar

@Richard Xu - Can you please execute the below command in MySQL and retry the install?

SET GLOBAL log_bin_trust_function_creators = 1

If you'd like to roll back to the default value of 0, you can do that after the install goes through.

View solution in original post

5 REPLIES 5

avatar
Contributor

It is Ambari 2.2.0.0, HDP-2.3.4.0-3485

avatar

@Richard Xu

Can you please remove the hostname :). It is a security risk and customer may not like it.

avatar

@Richard Xu - Can you please execute the below command in MySQL and retry the install?

SET GLOBAL log_bin_trust_function_creators = 1

If you'd like to roll back to the default value of 0, you can do that after the install goes through.

avatar
Rising Star
@vperiasamy

I had the same error and I can confirm that above command fixed the issue. Thx!

avatar
Expert Contributor

@vperiasamy

It worked for me as well.. Thanks.