Auto reindex with SIL admReindex() function

Craig Leigh August 11, 2015

I would like to call the admReindex() function to reindex JIRA once per week on Sunday morning at 1 AM which during our maintenance window.  I have looked for a way to automate calling this SIL function and cannot locate a time based function in which to call admReindex().   Is there an approach someone from Kepler-rominfo  can recommend.

3 answers

1 accepted

2 votes
Answer accepted
Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2015

Hi Craig,

In case you still need it, since JJUPIN 3.0.8 scheduler services have been implemented.
They are available only for JIRA versions greater that or equal to 6.2. smile

 

Hope this helps,
Alexandra 

Craig Leigh November 16, 2015

I will have to upgrade our JJupin to try this approach. We are on Jira 6.3.9. So no problem. In practice the approach I mentioned above worked in test but DID NOT work in Prod. In fact, it corrupted my index. Thanks

Silviu Burcea
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2015

You should ask for support when running into problems, It's a joy to work with Kepler team.

2 votes
Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 11, 2015

Hi there,

I don't know if that is the "proper" way to do it, but for sure one of the easiest way to do this is something like this:

Set up a SIL service with 1h interval and with following SIL sript:

string CurrentDayOfWeek = dayOfWeek(currentDate());
number CurrentHour = hour(currentDate());

logPrint("INFO", "Weekly reindex service initiated. Checking timestamp...");
if (CurrentHour == 1 && CurrentDayOfWeek == "Sun")
{
	logPrint("INFO", "Timestamp correct. Beginning reindex.");
	admReindex();
}
else
{
    logPrint("INFO", "Timestamp incorrect. Service aborted.");
}

 

I think the more bulletproof way would be to call one global service with a short timer like 5 minutes. This service could look into the database, check last and next execution times of the dependant services and execute the ones that meet the conditions. Never done it this way but this approach could get rid of few drawbacks of JIRA interval-timed services.

Craig Leigh August 12, 2015

@Błażej Olszyca This seems a most reasonable approach. I will try it on our test instance and see how it goes. Thank you --Craig

Craig Leigh August 17, 2015

@Błażej Olszyca Yes this does work well. Thanks

0 votes
Silviu Burcea
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 11, 2015

Hi Craig,

 

JJupin doesn't have a cron-like service yet, if your instance won't be restarted you can use a SIL Service with a high enough delay. You can also create a cron job yourself and, using curl, you can call the runScript REST method ( https://confluence.kepler-rominfo.com/display/SIL30/Common+REST+Service#CommonRESTService-runScript ). The script can be anything you like, including admReindex. 

 

HTH,

Silviu

Craig Leigh August 12, 2015

@Silviu Burcea Hi, I will investigate this approach as well. Thanks --Craig

Silviu Burcea
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 16, 2015

@Craig Leigh Alexandra's answer outperforms mine, it's the right way and her answer should be accepted too.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events