-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 6.2.0 CE GA1, 6.2.1 CE GA2
-
Fix Version/s: 6.2.2 CE GA3 , 6.2.X EE, 7.0.0 M3
-
Component/s: Core Infrastructure, Core Infrastructure > Sharding
-
Labels:
-
Branch Version/s:6.2.x
-
Backported to Branch:Committed
-
Story Points:18
-
Fix Priority:4
-
Liferay Contributor's Agreement:Accept
-
Git Pull Request:
Steps to reproduce it:
1- Configure Portal 6.1GA2 for using sharding
2- Startup the portal server (with marketplace porlet desployed)
3- Create a new instance from control panel
4- Shutdown the portal
5- Startup 6.1GA2 again to create the proper records in the ExpandoTable database for MarketPlace
6- Shutdown the portal
7- Configure master for using sharding pointing out to the previous databases
8- Startup master server (deploying the new version of marketplace porlet)
The exception described in LPS-44346 will be displayed during the upgrade process.
Documentation
After crete a hook to replace themeIds in 4 different portal instances configure in sharding I figured out that Liferay was only executing CRUD operations in the default database. The problem is a bug in the com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice class around this if statement:
if (_shardAdvice.getGlobalCall() == null) { String shardName = _shardAdvice.setShardNameByCompany(); ShardUtil.setTargetSource(shardName); if (_log.isInfoEnabled()) { _log.info( "Using shard name " + shardName + " for " + methodInvocation.toString()); } return methodInvocation.proceed(); }
The correct code would be:
if (_shardAdvice.getGlobalCall() == null) { String shardName = _shardAdvice.setShardNameByCompany(); String currentShardName = ShardUtil.setTargetSource(shardName); if (_log.isInfoEnabled()) { _log.info( "Using shard name " + shardName + " for " + methodInvocation.toString()); } _shardAdvice.pushCompanyService(shardName); try { return methodInvocation.proceed(); } finally { _shardAdvice.popCompanyService(); ShardUtil.setTargetSource(currentShardName); } }
This way you push and pop the current sharding configuration around the execution of the real method.
- causes
-
LPS-44346 Upgrade process of marketplace-portlet fails when deployed in a multi instance setup.
- Closed
-
LPS-46626 NoSuchUserException occurs upon adding a new portal instance
- Closed
- Discovered while testing
-
LPS-44874 Upgrade process in sharded environment is not accessing the default shard when needed
- Closed
-
LPS-45936 Sharding: Companies stored in a non default shard are not initialized properly on startup
- Closed
-
LPS-45989 Unable to upgrade journal articles to master using sharding
- Closed
-
LPS-45870 cglib 2.2 is not compatible with asm 4 or superior (it causes sharding doesn't work)
- Closed
- is duplicated by
-
LPS-42766 It is not possible to add a new user using sharding
- Closed
- relates
-
LPS-46104 Unable to update entities in non default shards: mvccVersion control doesn't allow it
- Closed
-
LPE-11967 Persistence sharding feature executes CRUD operations in the default database only
-
- Closed
-