Recent Bloggers

Ankit Prajapati
Posts: 5
Stars: 0
Date: 9/18/17
Chirag Patel
Posts: 4
Stars: 0
Date: 9/15/17
Rahul Joshi
Posts: 5
Stars: 0
Date: 9/15/17
Jiten Vaghela
Posts: 1
Stars: 0
Date: 8/23/17
Kuldeep Acharya
Posts: 1
Stars: 0
Date: 8/16/17
Saurang Suthar
Posts: 5
Stars: 0
Date: 7/5/17
Jyoti Verma
Posts: 3
Stars: 0
Date: 6/29/17
Pankti Patel
Posts: 1
Stars: 0
Date: 5/27/17
Chandrika Baraiya
Posts: 5
Stars: 0
Date: 5/27/17
Atith Patel
Posts: 5
Stars: 0
Date: 5/23/17
« Back

Issues in Database Sharding with Liferay 6.2 CE

What is Database Sharding ?

Database Sharding is an approach of partitioning a database horizontally. Each individual part is referred to as a shard. Using this approach, total number of rows in each table is reduced resulting into improved search performance and we can achieve separation of data. Liferay supports database sharding. It allows you to run multiple portal instances on the same server and data of each portal instance is kept separated from each other. However, there are several issues present in the implementation of database sharding in Liferay 6.2. I am listing out a couple of them with proposed solutions.

 

Issue 1: Newly created user can not login to portal.

 

Steps to reproduce issue:

  • Create a new portal instance in Liferay.

  • Create a user account in the new portal instance.

  • Log in with the password generated by Liferay.

  • When you try to login, an exception is thrown and browser displays an error message as follows : com.liferay.portal.NoSuchContactException: No Contact exists with the primary key 14003.

 

 

rsz_no.png

 

Cause:

This exception is thrown because database cache is not refreshed after creating a new user. Which means user record(‘Contact’ entity) is present in database but not in database cache, so Liferay throws an exception.

 

Solution:

  • Clear the database cache from default instance by performing following step:

-Log in to default instance as an omni administrator user.

-Go to Admin -> Control Panel -> Server Administration -> Resources.

-Click on “Execute” of option “Clear the database cache”.

  • Refresh the page of new portal instance and you can login with new user  credentials.

  • To avoid this manual clearing of database cache every time, just disable the caching of Contact entity by adding a following rule in portal-ext.properties file:

value.object.entity.cache.enabled.com.liferay.portal.model.Contact=false

  • Restart the server.


 

Issue 2: “Add” dropdown button does not appear in Document and media portlet.

 

Steps to reproduce issue:

  • Create new portal instance with database sharding implemented.

  • Add “Document and Media” portlet in a page.

  • “ADD” dropdown button disappears from the portlet that is on the page of portal instances(other than default instance) at random times.

 

Welcome - domain1.com 2014-07-05 15-04-11.png

 

  • Related Exception is displayed in console.

 

 

Exception.png

 

Cause:

When sharding is used with multiple databases, each database contains Liferay generated tables. For the default instance, there are 5 entries in table “DLFileEntryType”, but for other portal instances there are only four entries present in the table “DLFileEntryType.” A row in DLFileEntryType table with FileEntryTypeKey=BASIC-DOCUMENT is missing. This causes NullPointerException and prevents add button from appearing.

 

Solution:

We have to add missing entry into DLFileEntryType table for all shards manually. Copy the row with FileEntryTypeKey=BASIC-DOCUMENT manually from default instance database to other shards' tables and refresh the page. You will see ADD button remains on the portlet and backend exception also disappears. Please note that you will need to generate and assign a new UUID to the ‘uuid_’ column when copying the row from default database table to shards' database tables.

 

add.png

 

For more implementation details or support you may contact us at enquiry@surekhatech.com.

 
Comments
Trackback URL:

Contact Us

Loading

Get in touch

Headquarter :
302, Landmark,
Nr. Titanium City Center,
Prahlad Nagar Road,
Ahmedabad, India - 380015.