I have multiple Java tasks that access solr and write and commit some documents sequentially. Often these tasks change the same document. My problem is that one task may trigger a commit, terminates, pass the control to the other task which in turn issue another commit. When the first commit isn’t done before the second task starts, I get solr lock timeout exception.
One solution I was investigating is to have each of these tasks simply do an update and no commit. The problem, however is that changes by early tasks are not visible to later tasks. Thus the later tasks end up overwriting some of the changes done by the previous ones.
Now, I am investigating whether I can detect the end of each commit before triggering the next task. Any idea?
How would you guys resolve this problem?
These tasks are off-the-shelf non-trivial components that i cannot really change.
Thanks,
Max
It sound like you are trying to have the commit happen in the background after the “task” terminates. You’d be better off doing the commit synchronously; i.e. don’t terminate the task until the commit has succeeded (or failed). (I’ll admit that I don’t use Solr, and I don’t know how you would map those ideas to the Solr APIs.)