Foros de discusión

Official groovy script to search duplicate fields doesn't work (6.1 to 6.2)

Ra Jo Ga Cha, modificado hace 6 años.

Official groovy script to search duplicate fields doesn't work (6.1 to 6.2)

Junior Member Mensajes: 77 Fecha de incorporación: 19/01/17 Mensajes recientes
This is the manual I'm using (to upgrade from 6.1.2):
https://dev.liferay.com/discover/deployment/-/knowledge_base/6-2/upgrading-liferay#review-the-liferay-6

Launched the script for 6.1 but the only info in the logs is this:
08:52:27,150 INFO [ajp-apr-8009-exec-5][NormalizeDuplicateFields:?] Starting NormalizeDuplicateFields process for Journal Structures, Web Contents and DDM Structures
08:52:27,152 INFO [ajp-apr-8009-exec-5][NormalizeDuplicateFields:?] Safe Mode Execution
08:52:27,163 INFO [ajp-apr-8009-exec-5][NormalizeDuplicateFields:?] Finishing NormalizeDuplicateFields process

As is shown in the manual, it should at least show "*RESULTS*" and point that there aren't duplicated fields.
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Which version of the 6.2 are you trying to upgrade to? Are you trying to go from 6.1.2 -> 6.2.5? If you are then I wouldn't be surprised if it doesn't work since 6.2 GA2, GA3,.. all had additional fixes. I can't say for sure but I would guess that the documentation you are referencing was for upgrading from 6.1 -> 6.2 GA1.

I would try doing that first, and if it worked, then you can try upgrading to GA2, GA3, all the way up to GA6. It may sound like a tedious and arduous process but it shouldn't take more than an hour or two and it might be faster than trying to debug/alter the script to get it to work with 6.1.2 -> 6.2.5
thumbnail
Alberto Chaparro, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to (Respuesta)

Liferay Master Mensajes: 549 Fecha de incorporación: 25/04/11 Mensajes recientes
Hi Ra,

You are right, the script doesn't work for 6.1.x version if you don't have sharding activated. But the solution is easy, replace the content of the method doNormalize() in the groovy script by the following one:
public void doNormalize() throws Exception {
	setLogLevel();

	_log.info(
		"Starting NormalizeDuplicateFields process for Journal " +
			"Structures, Web Contents and DDM Structures");

	if (_safeMode) {
		_log.info("Safe Mode Execution");
	}

	doNormalizeShard();
	
	_log.info("Finishing NormalizeDuplicateFields process");
}


I will work with the documentation team to fix it in the official documentation.

Please, let me know if everything works well after this modification.

Thanks.
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hi Alberto --

Interesting, is that the only reason that it would be failing? I am curious -- 6.2 supported sharding but that feature was dropped in 7 I believe. So if you are using a 6.2 sharded configuration, how do you upgrade to 7?
thumbnail
Alberto Chaparro, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to

Liferay Master Mensajes: 549 Fecha de incorporación: 25/04/11 Mensajes recientes
Hi Andrew,

Interesting, is that the only reason that it would be failing?

Yes, the method getAvailableShardNames returns 0 elements if you don't have sharding activated (at least in 6.1).

So if you are using a 6.2 sharded configuration, how do you upgrade to 7?

To upgrade a sharding environment to Liferay 7 you have to follow this procedure:
https://dev.liferay.com/discover/deployment/-/knowledge_base/7-0/upgrading-sharded-environment

Cheers!
Ra Jo Ga Cha, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to

Junior Member Mensajes: 77 Fecha de incorporación: 19/01/17 Mensajes recientes
The script worked! But I have one more big problem. There are contents "out of sync" that can't be upgraded:

xxxx web contents can not be processed since they were out of sync prior to execute this script ***"

I've reviewed this contents and most of them have structure but with fields in a different order. Manually changing different ordered fields is a crazy amount of work to do for thousands of contents. Is there any script to automatize this? Can I modify the script to don't care about order?

Thanks!
thumbnail
Alberto Chaparro, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to

Liferay Master Mensajes: 549 Fecha de incorporación: 25/04/11 Mensajes recientes
Hi Ra,

The script just reflects that, I guess you can continue with the upgrade since those web contents were not sync with the structure before the execution of the script so there is no automatic way to fix it (maybe you have more context about that and know what to do). I guess There won't be problems with duplicated fields since the script took care of it in the structures.

Best regards.
thumbnail
Alberto Chaparro, modificado hace 6 años.

RE: Official groovy script to search duplicate fields doesn't work (6.1 to

Liferay Master Mensajes: 549 Fecha de incorporación: 25/04/11 Mensajes recientes
Just for the record,

The script for 6.1 has been updated and now it works properly:
https://dev.liferay.com/discover/deployment/-/knowledge_base/6-2/upgrading-liferay#find-and-remove-duplicate-field-names

Cheers!