[ 
https://issues.apache.org/jira/browse/RANGER-1521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15972229#comment-15972229
 ] 

Yan commented on RANGER-1521:
-----------------------------

A few comments:
1) There are a few workarounds to address the data corruption issue. The one 
mentioned above comes from 
https://community.hortonworks.com/questions/23647/ranger-admin-install-fails-with-007-updateblankpol.html
2) Use of Now() probably won't serve the purpose of uniqueness for "transaction 
ID" given its second-level granularity;
3) More knowledge about the use of "transaction id" in Ranger is desired. If it 
is of no practical use, it should be considered to be removed at all; if it is 
used for identification purpose, the uniqueness requirement would be important. 
May the community shed more lights on this?
4) Ranger intrinsic logic to create transaction ID utilizes some random # 
generation. Not sure whether it would be compatible with the timestamp-based 
IDs as proposed here.

> Ranger database script for mysql requires admin privileges for replicated 
> database
> ----------------------------------------------------------------------------------
>
>                 Key: RANGER-1521
>                 URL: https://issues.apache.org/jira/browse/RANGER-1521
>             Project: Ranger
>          Issue Type: Bug
>          Components: admin
>    Affects Versions: 0.6.2
>            Reporter: Eric Yang
>         Attachments: RANGER-1521.patch
>
>
> When running install or upgrade on replicated MySQL or MariaDB, ranger 
> installation might fail with:
> {code}
> 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 2017-04-05 
> 22:59:00,345 [JISQL] 
> /usr/jdk64/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/bin/java -cp 
> /usr/iop/current/ranger-admin/ews/lib/mysql-connector-java.jar:/usr/iop/current/ranger-admin/jisql/lib/*
>  org.apache.util.sql.Jisql -driver mysqlconj -cstring 
> jdbc:mysql://tmh21-3-dal10-bi-mn000.fyre.ibm.com/ranger -u 'ranger' -p 
> '********' -noheader -trim -c \; -query "delete from x_db_version_h where 
> version='007' and active='N' and 
> updated_by='tmh21-3-dal10-bi-mn004.fyre.ibm.com';" 2017-04-05 22:59:00,781 
> [E] 007-updateBlankPolicyName.sql import failed!
> {code}
> Two files under ranger-admin/db/mysql/patches:
> 007-updateBlankPolicyName.sql and 008-removeTrailingSlash.sql are using 
> rand() functions to generate transaction ID, which makes them 
> non-deterministic functions and are causing failures on replicated MySQL 
> database.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to