lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eks dev <>
Subject Re: reader/searcher refresh after replication (commit)
Date Tue, 21 Feb 2012 20:10:18 GMT
Thanks Mark,
Hmm, I would like to have this information asap, not to wait until the
first search gets executed (depends on user) . Is solr going to create
new searcher as a part of "replication transaction"...

Just to make it clear why I need it...
I have simple master, many slaves config where master does "batch"
updates in big chunks (things user can wait longer to see on search
side) but slaves work in soft commit mode internally where I permit
them to run away slightly from master.... in order to know where
"incremental update" should start, I read it from UserData ....

Basically, ideally, before commit (after successful replication is
finished) ends, I would like to read in these counters to let
"incremental update" run from the right point...

I need to prevent updating "replicated index" before I read this
information (duplicates can appear).... are there any "IndexWriter"
listeners around?

Thanks again,

On Tue, Feb 21, 2012 at 8:03 PM, Mark Miller <> wrote:
> Post commit calls are made before a new searcher is opened.
> Might be easier to try to hook in with a new searcher listener?
> On Feb 21, 2012, at 8:23 AM, eks dev wrote:
>> Hi all,
>> I am a bit confused with IndexSearcher refresh lifecycles...
>> In a master slave setup, I override postCommit listener on slave
>> (solr trunk version) to read some user information stored in
>> userCommitData on master
>> ----------
>> @Override
>> public final void postCommit() {
>> // This returnes "stale" information that was present before
>> replication finished
>> RefCounted<SolrIndexSearcher> refC = core.getNewestSearcher(true);
>> Map<String, String> userData =
>> refC.get().getIndexReader().getIndexCommit().getUserData();
>> }
>> ------------
>> I expected core.getNewestSearcher(true); to return refreshed
>> SolrIndexSearcher, but it didn't
>> When is this information going to be refreshed to the status from the
>> replicated index, I repeat this is postCommit listener?
>> What is the way to get the information from the last commit point?
>> Maybe like this?
>> core.getDeletionPolicy().getLatestCommit().getUserData();
>> Or I need to explicitly open new searcher (isn't solr does this behind
>> the scenes?)
>> core.openNewSearcher(false, false)
>> Not critical, reopening new searcher works, but I would like to
>> understand these lifecycles, when solr loads latest commit point...
>> Thanks, eks
> - Mark Miller

View raw message