Results Rankings index should be per virtual instance, not shared
Fix Priority
Components
Affects versions
Git Pull Request
Description
Testing discovered
is a dependency of
Activity
Tibor Lipusz August 3, 2020 at 3:15 AM
Multi-tenant index names and supportability has been revisited, see https://issues.liferay.com/browse/LPS-117702?focusedCommentId=2213880&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2213880
Brooke March 3, 2020 at 3:14 PMEdited
PASSED Manual Testing following the steps in the description.
Test on:
Tomcat 9.0.17 + MySQL 5.7 Portal master GIT ID: 34f64688dfc01e106cd8dbd04dcce0b53a835432
The Results Ranking created in one virtual instance is not shared with another virtual instance's Result Ranking
Jorge Díaz February 17, 2020 at 12:27 PM
Thank you for the information,
Michael Han February 17, 2020 at 9:19 AM
The issue here is the potential collisions between company/instanceIds. We have no way to guarantee that 2 different production instances have unique companyIds. We can certainly tell customers to go ahead and configure different index prefixes (e.g. instead of "liferay-" prefix, use "liferay-prod-1-" and "liferay-prod-2-"). However, that leaves a lot of manual configuration for customers that can be messed up.
The bug that we do have is the other indices beyond the "Liferay" index (e.g. the ones used for workflow) do not comply properly w/ the 1 index per company paradigm. This is something we do need to fix.
Wade Cao November 7, 2019 at 12:26 PM
Fix:
1) Adding indexNamePrefix to the "liferay-results-rankings"
prefix + "-0-liferay-search-tuning-rankings" per virtual instance.
The prefix is the value from System Settings -> Search > Elasticsearch*> Index Name Prefix
2) Scheduling a background task for renaming the existing liferay-results-rankings if there is one upon the module starting up.
per Tibor Lipuse's suggestion:
We have to be careful with this fix though: we can't break existing deployments where the index name was not prefixed (FP2 patch level).
Especially because there is no way to trigger a "reindex": we check on startup if the index is there and attempt to create if not. But if the index was created preciously without a prefix it won't find it if we force to use that prefix after fix.
Unless we introduce a logic that moves the existing RR entries from the existing index to the new now prefixed index upon startup, or something like that.
Details
Details
Assignee
Reporter
Branch Version/s
Backported to Branch
Sprint
Zendesk Support
Linked Tickets
Zendesk Support

Steps to reproduce - Single deployment scenario
Navigate to Control Panel > Search Tuning > Results Ranking
Add a Results Ranking with the
Example
queryCreate a new Virtual Instance
Navigate to Virtual Instance and login
Navigate to Control Panel > Search Tuning > Results Ranking
Expected Result: The Results Ranking created in Step 2 shouldn't show up.
Actual Result: The Results Ranking created in Step 2 does show up.
Tested on:
Tomcat 9.0.17 + MySQL 5.7
Portal master-private SHA: bde67ee189e438bb57d8ceef095e82cf9e423fad
Portal 7.2.x-private SHA: 570fd31ff0fb47548c841ac0fd386849bdc3ac92
Steps to reproduce - Multi-tenant deployment scenario
Assumptions, facts:
Elasticsearch is multi-tenant: it can host multiple indexes
Liferay's Elasticsearch integration leverages multi-tenancy since each Virtual Instance has its own index
The name of the indexes for the Virtual Instances can be prefixed through the Elasticsearch 6 connector's System Settings ("Index Name Prefix")
Liferay/DXP can be configured to operate on "deployment data centers" so the Counter will generate values without fear of collision (for example for the company ID)
Unpack 2 DXP 7.2 SP1 (or master-private/7.2.x-private) bundles (let's refer to them as "prod" and "uat")
Configure Elasticsearch 6.8.x to use "LiferayElasticsearchCluster" as cluster name (elasticsearch.yml) and start it
Configure the Elasticsearch 6 connector on the "prod" server like this:
prod/osgi/configs/com.liferay.portal.search.elasticsearch6.configuration.ElasticsearchConfiguration.config
Configure "prod" to connect to to its own DB (db-prod)
Start "prod" ad perform a reindex
Verify - prod that multiple indexes are created through the Control Panel - Configuration - Search - Field Mappings under "INDEX", something like
Add an arbitrary content, for example Web Content Article
Go to Control Panel - Search Tuning - Result Rankings on "prod" and create an arbitrary ranking entry (let's call it "dxp") pinning that article you just created
Configure "uat" Tomcat to run on different ports
Configure the Elasticsearch 6 connector on the "uat" server like this:
uat/osgi/configs/com.liferay.portal.search.elasticsearch6.configuration.ElasticsearchConfiguration.config
Configure "uat" to connect to to its own DB (db-uat)
Configure Counter for "uat" like this:
uat/portal-ext.properties
Start "uat" ad perform a reindex
Verify - uat that multiple indexes are created through the Control Panel - Configuration - Search - Field Mappings under "INDEX", something like
Add an arbitrary content, for example Web Content Article
Go to Control Panel - Search Tuning - Result Rankings on "uat"
Result: The "dxp" Result Rankings entry appears even though we created it on "prod"
Delete the "dxp" entry
Go to Control Panel - Search Tuning - Result Rankings on "prod"
Result: The "dxp" entry is missing
The
liferay-results-rankings
index is shared across the deployments.