[JIRA] Lexorank integrity issues?

So, this is loosely another part of the unofficial series ‘fixing a corrupted JIRA db‘.

However, this is a different case. This JIRA instance (7.1.x) was created by importing a huge XML backup (> 1 million issues). Due to an unknown reason, ActiveObjects didn’t import. That means, JIRA Software (aka JIRA Agile) no longer functioned normal.

It was soon discovered that Lexorank integrity checks fail. For the record, following integrity checks failed:

Marker rows present in table for rank field
Marker rows correctness check
Marker rows in valid bucket check
Issue rows in valid bucket check
Balance status check

Now what? I made an unsuccessful attempt of uninstalling JIRA Software, then dropping all database tables/ triggers/ sequences with the prefix AO_60DB71_ and then re-installing JIRA Software. This didn’t help.

Then, I wanted to study the under-the-hood stuff of Lexorank management. I already knew of two database tables involved, AO_60DB71_LEXORANK and AO_60DB71_LEXORANKBALANCER.

First I created a custom field of type ‘Global Rank’ and named it ‘Rank2’.

Then, I navigated to JIRA Administration –> System –> Lexorank management. Now I could see two Rank fields under the Balancing section. I balanced them once again and executed the integrity checks. The old one still failed the above checks, but the new one passed all checks!

Now, let’s take a look at the database. Following query returned two rows, that looked like an upper marker (1|zzzzzz:) and a lower marker (1|000000:). Both were associated with the field ID of the newly created ‘Rank2’ custom field.

select * from AO_60DB71_LEXORANK;

What I did was a very simple thing. I updated the field ID of the two records so they are now associated to the old Rank field.

update AO_60DB71_LEXORANK
set FIELD_ID = (select ID from CUSTOMFIELD where CFNAME = 'Rank');

commit;

Finally, to clean up I deleted the newly created Rank2 custom field. Simple!

After a JIRA restart Lexorank started to function normal, with all the integrity checks passed. I hope my approach will help someone who has run into the same problem.

[JIRA] Lexorank integrity issues?

Leave a comment