留言板

Liferay 6.2 Counter Table Sync Issue

thumbnail
William Gosse,修改在6 年前。

Liferay 6.2 Counter Table Sync Issue

Liferay Master 帖子: 533 加入日期: 10-7-4 最近的帖子
Can someone please tell me how the COUNTER table in the Liferay database works in terms of how it gets updated and when it gets read by Liferay? This is a table that we ran into an issue with when we were synchronizing the Liferay databases in our two different data centers. Somehow we wound with that table being out of sync between the two centers which caused a constraint violation on a resource permission at on point.
thumbnail
Jorge Díaz,修改在6 年前。

RE: Liferay 6.2 Counter Table Sync Issue

Liferay Master 帖子: 753 加入日期: 14-1-9 最近的帖子
In Liferay 7 you can configure following properties in order to avoid collisions between each database:
https://docs.liferay.com/portal/7.0/propertiesdoc/portal.properties.html#Counter

It was implemented in: LPS-51313

You can try backporting the code from 7.0 to 6.2, see code changes:
thumbnail
William Gosse,修改在6 年前。

RE: Liferay 6.2 Counter Table Sync Issue

Liferay Master 帖子: 533 加入日期: 10-7-4 最近的帖子
Thanks for pointing this out. Our plan is to move the DXP at some point so this will definitely help.
thumbnail
William Gosse,修改在6 年前。

RE: Liferay 6.2 Counter Table Sync Issue

Liferay Master 帖子: 533 加入日期: 10-7-4 最近的帖子
I'm still concerned about how this actually works in a cluster when two liferay or more instances share a common database. Again when a threshold is met and the counter is updated, how is that new incremented value shared across the cluster if its only read a startup?
thumbnail
Jorge Díaz,修改在6 年前。

RE: Liferay 6.2 Counter Table Sync Issue

Liferay Master 帖子: 753 加入日期: 14-1-9 最近的帖子
Each Liferay server increments and update counter before using the id in a new object.
That is done in a different transaction, so a rollback of a new object insertion, don't rollback counter increase.

In order to increase performance, by default, Liferay servers increase counter by blocks of 100 is a each time and uses the reserved ids until all of them are used an a new block of 100 is reserved.

That increment can be configured using property counter.increment=100, more info, see the link of my previous comment.