Affects Version/s: 6.1.20 EE GA2, 6.2.0 CE B2
Environment:Tomcat 7 + PostgreSQL 9.1. Portal 6.1.x EE GIT ID: 016e467e88a4b5923df85212967a3a3047f2b2f1.
Tomcat 7 + PostgreSQL 9.1. Portal 6.2.x CE GIT ID: cf60e9ef9b44c04d52ec45714f463bf1f76dae7a.
Similar Issues:Show 5 results
LPS-399 Use @Transactional to demarcate read / write database split boundaries LPS-12802 Issues with Writes with MySQL read-write split. LPS-293 Introduce Read / Write Database Splitting for Extreme Performance LPS-18173 MySQL read-write split is hardly using RO datasource LPS-1476 Read / Write Database Splitting does not work for plugins
Read/Write database splitting is a means of utilizing a hot standby database in order to gain performance while sacrificing some accuracy. Some services eg. LockLocalService and CounterLocalService are so critical to the portal that they should always read from the primary DB instance.
1) Set-up PostgreSQL with hot standby enabled.
1/a) Debian/Ubuntu based distros make it easy to manage multiple instances by offering the pg*cluster commands. I have two instances: one is acting as primary (main - write node) and another as a standby (standby - read node).
1/b) Enable archive mode on instance main.
Please note that directory /var/lib/postgresql/9.1/_archive doesn't exist by default, you'll have to create it.
1/c) Configure instance standby for being a hot standby.
2) Configure Liferay to use R/W DB splitting plus clustering.
Steps to reproduce
1) Start up Liferay.
2) Synchronize the standby manually.
3) Restart Liferay.
Checkpoint: Log into both database and check table Lock_. Each table should have one, but different record.
4) Execute the following Beanshell script (under Control Panel/Server admin/Scripting).
Actual: You see that record which is in the standby instance.
Expected: You should've seen that record which is in the main instance.
Notes for QA
- For reproducing the issue, PostgreSQL 9.x is required, because 8.x doesn't support hot standby.
- If you don't have a Debian/Ubuntu machine at hand, you can use the one which we have here.
- You'll have to create the another instance (standby) with pg_createcluster.
- You dont't need to set-up a fully functional Liferay cluster, having enabled cluster.link.enabled=true is completely enough.