Bug 1039309

Summary: LiquidBase creates incorrect index
Product: [Community] PressGang CCMS Reporter: Matthew Casperson <mcaspers>
Component: REST-APIAssignee: Lee Newson <lnewson>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.3CC: cbredesen, lnewson
Target Milestone: ---   
Target Release: 1.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-23 23:43:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Matthew Casperson 2013-12-07 20:34:20 UTC
The index "TopicIDAndMinHashFuncID" creates an index against the topic id and minhasfuncid columns. This index should be against the MinHash and MinHashFuncID columns, as these are the ones that are queries for MinHash similarity.

Comment 1 Lee Newson 2013-12-08 22:01:47 UTC
I'm not sure why this is happening at a glance but either way that Index should not be in the Liquibase changelog as the index is created by:

<addUniqueConstraint tableName="MinHash" columnNames="TopicID, MinHashFuncID"/>

Comment 2 Lee Newson 2014-01-15 00:56:23 UTC
Removed the incorrect create index statement in 1.4-SNAPSHOT build 201401151042

Note: The CHECKSUM for that create table will now be different, so you will need to run the following SQL before updating to the build above:

UPDATE `DATABASECHANGELOG` SET `MD5SUM` = '3:c21aeed0c7f7471ca63b39147e20c9b3' WHERE `ID` = '1' AND  `AUTHOR` = 'mcaspers' AND `FILENAME` = 'db/changelog/db.changelog-1.3.xml';

Comment 3 Lee Newson 2014-01-15 02:55:03 UTC
This version is now live on the test/development server.

Comment 4 Lee Newson 2014-01-15 05:15:15 UTC
I've reverted the above as I read the original part wrong and this didn't work as expected. 

I've now fixed it as per the initial specification in 1.4-SNAPSHOT build 201401151504. I've also made it so it'll be entirely managed by liquibase so no custom SQL needs to be executed, as well as added an index on the MinHash revision table since it was missing.

If you did run the above SQL, then here is the SQL to change it back:

UPDATE `DATABASECHANGELOG` SET `MD5SUM` = '3:c2e4c45c83480fa8b3c399e4c725e0d6' WHERE `ID` = '1' AND  `AUTHOR` = 'mcaspers' AND `FILENAME` = 'db/changelog/db.changelog-1.3.xml';

Note: This version is now live on the test/development server.

Comment 5 Matthew Casperson 2014-01-28 06:04:15 UTC
Downloaded a SQL backup from the prod server, deployed the REST server and confirmed that Liquidbase executed correctly and created the correct index.