Tioma
Tioma

Reputation: 2150

How to synchronize Solr import processes?

How can I synchronize Solr delta import processes? Several threads run delta import. If during import run one more import then the second run will be ignored and data will not updated.

My purpose is to make waiting the second to finish the first delta import.

Delta import runs via HTTP, so I don't know how to check when it's finished.

Uses: Solr 4.0, SolrJ

Upvotes: 1

Views: 2991

Answers (2)

Gus
Gus

Reputation: 6881

It seems like you could do something with this

http://wiki.apache.org/solr/DataImportHandler#EventListeners

If you can use that to maintain a "importInProgress" boolean flag, you could probably extend or wrap the data import handler class in your own code and return a custom response of your own to indicate that the system is busy. This way you could never have two imports processing. Polling for status as per javanna sounds like it will be subject to race conditions.

Upvotes: 1

javanna
javanna

Reputation: 60235

You can poll the status of the dataimporthandler with the url http://host:port/solr/dataimport?command=status or even without any command since status is the default one. That way you get back some details about the dataimport process and you can find out if it is still in progress or not. Have a look at the available commands.

Upvotes: 3

Related Questions