Forums de discussion

Can't upgrade to Permissions Algorithm 6 for v6.2

thumbnail
Aaron Paxson, modifié il y a 10 années.

Can't upgrade to Permissions Algorithm 6 for v6.2

Regular Member Publications: 102 Date d'inscription: 28/07/10 Publications récentes
Hi all.

I'm preparing to upgrade liferay 6.1 to 6.2. Pretty much got everything sorted out, except for the permissions. I added the v5 check in portal-ext.properties, and went to Server Administration --> Data Migration, and executed the permissions conversion.

It goes through the process, and then I hit this error, and the process stops:


18:38:52,641 DEBUG [liferay/convert_process-1][MaintenanceUtil:64] Updating ResourcePermission table
18:38:52,694 FATAL [liferay/convert_process-1][ConvertProcessMessageListener:35] Unable to process message {destinationName=liferay/convert_process, response=null, responseDestinationName=null, responseId=null, payload=com.liferay.portal.convert.ConvertPermissionAlgorithm, values={principalPassword=xxxxxxx, principalName=10169, companyId=10132}}
com.liferay.portal.convert.ConvertException: java.sql.BatchUpdateException: Duplicate entry '10132-58-4-10455_LAYOUT_58-10144' for key 2


It looks like I have a duplicate key. So, I did the following SQL:


mysql> select * from ResourcePermission where primKey LIKE '%10455_LAYOUT_58%';
+----------------------+-----------+------+-------+-----------------+--------+-----------+---------+
| resourcePermissionId | companyId | name | scope | primKey         | roleId | actionIds | ownerId |
+----------------------+-----------+------+-------+-----------------+--------+-----------+---------+
|                  334 |     10132 | 58   |     4 | 10455_LAYOUT_58 |  10139 |         1 |    NULL |
|                  332 |     10132 | 58   |     4 | 10455_LAYOUT_58 |  10140 |         7 |    NULL |
|                  333 |     10132 | 58   |     4 | 10455_LAYOUT_58 |  10144 |         1 |    NULL |
+----------------------+-----------+------+-------+-----------------+--------+-----------+---------+
3 rows in set (0.01 sec)


But I don't see any duplicate entries? They each have a different PermissionId. Can someone give me a hand to identify the problem? Is it safe to delete these entries?

Since I have a backup, I went ahead and deleted the entries. But, it found another set. I have no idea how many dupes I have? Anyone care to guide me to be the best appropriate step?


mysql> select * from ResourcePermission where primKey LIKE '%10455_LAYOUT_1_WAR_chatportlet%';
+----------------------+-----------+-------------------+-------+--------------------------------+--------+-----------+---------+
| resourcePermissionId | companyId | name              | scope | primKey                        | roleId | actionIds | ownerId |
+----------------------+-----------+-------------------+-------+--------------------------------+--------+-----------+---------+
|                 1231 |     10132 | 1_WAR_chatportlet |     4 | 10455_LAYOUT_1_WAR_chatportlet |  10139 |         1 |    NULL |
|                 1229 |     10132 | 1_WAR_chatportlet |     4 | 10455_LAYOUT_1_WAR_chatportlet |  10140 |         7 |    NULL |
|                 1230 |     10132 | 1_WAR_chatportlet |     4 | 10455_LAYOUT_1_WAR_chatportlet |  10144 |         1 |    NULL |
+----------------------+-----------+-------------------+-------+--------------------------------+--------+-----------+---------+


So, in an effort to figure out all these dupes, I wrote the following SQL:


select * from ResourcePermission inner join (select primKey from ResourcePermission group by primKey having count(resourcePermissionId) > 1) dup on ResourcePermission.primKey = dup.primKey;


I have almost 5000 records that are duplicate primKey (14,833 records returned). This site does have 2 instances associated with it. Could that be the problem? If so, how can I fix it?
thumbnail
Aaron Paxson, modifié il y a 10 années.

RE: Can't upgrade to Permissions Algorithm 6 for v6.2

Regular Member Publications: 102 Date d'inscription: 28/07/10 Publications récentes
Has anyone else ran into this issue with version 6.2? Can anyone give any guidance on how these entries were duped or how I can delete them without issues?

Really could use the help here. Thanks.
thumbnail
Thomas Berg, modifié il y a 10 années.

RE: Can't upgrade to Permissions Algorithm 6 for v6.2

Regular Member Publications: 131 Date d'inscription: 07/09/09 Publications récentes
Hi Aaron,
I have the same issue when trying to upgrade from 6.1.1 ce ga2 -> 6.2.0 ce ga1

My best guess is that this issue is caused by having the value
permissions.user.check.algorithm=6
(default value for Liferay 6.1) before doing the conversion. When upgrading from 6.0 to 6.1, this never caught my attention and, since having the value set to 6 (by not overriding it in portal-ext.properties), I never saw the tool under Server Administration --> Data Migration. Not until it was time to upgrade from 6.1 to 6.2...

It seems that the conversion code is trying to insert multiple entries that violates the UNIQUE constraint.

My "solution" was to dump the database, remove the the line :

UNIQUE KEY `IX_8D83D0CE` (`companyId`,`name`,`scope`,`primKey`,`roleId`)


from the table resourcepermission and then restore. After running permissions conversion, I had duplicate entries.

These can be removed by issuing the following SQL-statemen (restoring the removed UNIQUE key):

ALTER IGNORE TABLE resourcepermission ADD UNIQUE KEY `IX_8D83D0CE` (`companyId`,`name`,`scope`,`primKey`,`roleId`)


(http://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql)

I had to issue the command

mysql> set session old_alter_table=1

before running the statement. (see http://stackoverflow.com/questions/8053447/mysql-alter-ignore-table-gives-integrity-constraint-violation)

No idea if this is the best way or if it messes anything up but it seems to have done the trick.

If anyone else has some advice or better solutions I'd be very interested!


Regards Thomas
thumbnail
Aaron Paxson, modifié il y a 10 années.

RE: Can't upgrade to Permissions Algorithm 6 for v6.2

Regular Member Publications: 102 Date d'inscription: 28/07/10 Publications récentes
Thanks Thomas! This is great!

So, after "dump"-ing the database, and re-importing after removing the key, you ran the permission conversion again? Then after the conversion, you cleaned up the dupes before the upgrade to 6.2?
thumbnail
Thomas Berg, modifié il y a 10 années.

RE: Can't upgrade to Permissions Algorithm 6 for v6.2

Regular Member Publications: 131 Date d'inscription: 07/09/09 Publications récentes
Hi Aaron,
Apologies for the very late reply!

So, after "dump"-ing the database, and re-importing after removing the key, you ran the permission conversion again? Then after the conversion, you cleaned up the dupes before the upgrade to 6.2?


Yes, that's correct

This seems to work but it's always a bit unnerving to mess with the database. Have you had any success with this?
thumbnail
Vishal Srivastava, modifié il y a 9 années.

RE: Can't upgrade to Permissions Algorithm 6 for v6.2

Junior Member Publications: 26 Date d'inscription: 07/07/14 Publications récentes
Hi Guise,

I am facing the same issue-:
Duplicate entry '10157-com.liferay.portal.model.User-4--10169' for key 'IX_8D83D0CE'
It is inserting company id,name,scope, but primKey its always inserting as null.

Can anyone help me for the same.

Thanks,
Vishal