Is there a way for a SOLR plugin to get a callback when SOLRCloud Has Successfully Elected A Master -


we have solr plugin (a special requesthandler our purposes) gets 2 callbacks solr when starting up, requesthandler.init method, , solrcoreaware.inform(solrcore core) method. in solrcoreaware.inform method, start kafka consumer.

the problem plugin gets kafka message process (which forwards solr update handler index) before solrcloud has finished starting up. in case solr throws exception after waiting while. there way callback plugin of sort when solrcloud has finished starting up, can delay starting kafka consumer until then? of course have hacky way of introducing fixed time based delay hoping system tell me ok initialize.

thanks.

p.s.:

the exception following:

caused by: org.apache.solr.common.solrexception: no registered leader found after waiting 4000ms , collection: taxonomy slice: shard1 @ org.apache.solr.common.cloud.zkstatereader.getleaderretry(zkstatereader.java:676) @ org.apache.solr.common.cloud.zkstatereader.getleaderretry(zkstatereader.java:662) @ org.apache.solr.update.processor.distributedupdateprocessor.setuprequest(distributedupdateprocessor.java:361) @ org.apache.solr.update.processor.distributedupdateprocessor.setuprequest(distributedupdateprocessor.java:312) @ org.apache.solr.update.processor.distributedupdateprocessor.processadd(distributedupdateprocessor.java:662) @ org.apache.solr.handler.loader.jsonloader$singlethreadedjsonloader$1.handle(jsonloader.java:227) @ org.apache.solr.common.util.jsonrecordreader$node.handleobjectstart(jsonrecordreader.java:364) @ org.apache.solr.common.util.jsonrecordreader$node.parse(jsonrecordreader.java:289) @ org.apache.solr.common.util.jsonrecordreader$node.access$200(jsonrecordreader.java:154) @ org.apache.solr.common.util.jsonrecordreader.streamrecords(jsonrecordreader.java:138) @ org.apache.solr.handler.loader.jsonloader$singlethreadedjsonloader.handlesplitmode(jsonloader.java:205) @ org.apache.solr.handler.loader.jsonloader$singlethreadedjsonloader.processupdate(jsonloader.java:122) @ org.apache.solr.handler.loader.jsonloader$singlethreadedjsonloader.load(jsonloader.java:110) @ org.apache.solr.handler.loader.jsonloader.load(jsonloader.java:73) @ org.apache.solr.handler.updaterequesthandler$1.load(updaterequesthandler.java:103) @ org.apache.solr.handler.contentstreamhandlerbase.handlerequestbody(contentstreamhandlerbase.java:74) @ org.apache.solr.handler.requesthandlerbase.handlerequest(requesthandlerbase.java:143) @ org.apache.solr.core.solrcore.execute(solrcore.java:1984) @ com.aol.dmp.solr.kafka.solrkafkahandler.processdoc(solrkafkahandler.java:407)

since nobody has answered that, i'll have go.

looking @ solrcloud lifecycle, think can achieve newsearcher-callback of solreventlistener. gets notified after initial core loading , after each commit when new searcher has been instantiated.

public void newsearcher(solrindexsearcher newsearcher, solrindexsearcher currentsearcher) {     if (currentsearcher == null) {         //first searcher after core has loaded.     } else {         //new searcher after commit.     } } 

you can register listener inside inform-callback:

core.registerfirstsearcherlistener(whateversolreventlistenerseemsfit); 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -