matethurzo/liferay-portal — pull request #144 by KocsisDaniel (2012-04-10 07:33:17+00:00)
Title: LPS-25224 Drop deprecated portal DB indexes on startup

Hi,

the code works as we planned, based on the property when portal starts it validates which ones should be dropped and drops only the indexes we consider Liferay ones. You can see the in start up it will create and drop always a few indexes. This is not a coding mistake, but happens because of the followings:

current drop logic (I did not touch it):

1, query all the indexes of a db schema

2, compare the queried indexes to the indexes.properties ones:

if match and inxes.sql also contains creation script : do not delete
else if index's table is custom table: do not delete
else: delete

if index is not deleted put it into validindexes list.

3, add indexes:
go throught indexes.sql
if index is not in validindexes create new index

So we have the following issues because of the inconsistency of the generated index related files:

line exists: db not exists: .prop,.sql -> index will be deleted
line exists: db,.sql not exists: .prop -> index will be deleted, re-created

Thanks,
Dani