JIRA 6.4.5 - REST - Reindex progress response when finished

SéverineC August 27, 2015

Hi,

I am currently developing a program that will allow us to reindex JIRA without going through the UI.

According to the specification available here (link) the call to /rest/api/2/reindex/progress should give me a JSON object containing taskId, started time, finished time, etc. for the latest reindexing task.

While reindexing is occurring, no problem, the answer is as expected.

However, once the reindexing is finished, all I get is the following message "A task could not be found for the given id" whether I add a taskId as a parameter or not.

 

Is there something I am missing here ?

 

Thanks,

Regards,

Séverine

 

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
SéverineC September 1, 2015

Hi,

Just to let everyone know : the problem occurs only after a JIRA restart. Basically, the progress service is unable to find reindexing tasks that were created before the last restart of the server.

 

We still implemented a check on 404 response after reindexing has started just in case the server crash so that the task doesn't hang. And if Volodymyr hadn't suggested it, we would have had several problems because of that in other parts of the code as well, actually. So thanks again.

Volodymyr Krupach
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.
September 1, 2015

Séverine, thanks for sharing!

1 vote
teilor_soares
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 27, 2015

Are you omitting the ID when the reindex finishes? If not, this is the expected behavior.

In the description of the taskId paramenter, you can read:

the id of an indexing task you wish to obtain details on. If omitted, then defaults to the standard behaviour and returns information on the active reindex task, or the last task to run if no reindex is taking place. . If there is no reindexing task with that id then a 404 is returned.



0 votes
SéverineC August 27, 2015

I mentioned in my post that I tried with and without a taskId. The behaviour is the same in both cases.

And as Voldomyr said, the description says that if it's omitted AND there are no reindexing task at all, it gives a 404, which it actually does here (the message "A task could not be found for the given id" is attached to a 404).

What I don't understand is that there was a task (let's say taskId 17601). And the service should give a JSON object when i call URL /rest/api/2/reindex/progress?taskId=17601.

It works while the task is occuring, but not once it's completed. Furthermore, if I don't add the taskId, according to the doc, "if omitted ... returns ... last task to run if no reindex is taking place" so I should still get my JSON object.

And my script worked with JIRA v6.2 but the REST API was different. Same behaviour, but not the same URL.

Sorin, thanks but the python script uses the UI which I can't do.

Any other lead ?

Volodymyr Krupach
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 27, 2015

I assume that "/rest/api/2/reindex/progress" is coded to return status only for active re-indexing processes and there is no chance to get "completed" status. I suggest you to assume that re-index is completed when you get 404 after getting some progress statuses before.

SéverineC August 27, 2015

Right ! I didn't think about that ! :) Thanks for your help, I will try to implement that

0 votes
Sorin Sbarnea (Citrix)
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 27, 2015

The Python JIRA API library is able to deal with this. Look at at code http://pythonhosted.org/jira/_modules/jira/client.html#JIRA.reindex

0 votes
Volodymyr Krupach
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 27, 2015

Is not that expected? The doc says:

> 404 Returned if there is no re-indexing task found

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events