Indexing to replica instead leader

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Indexing to replica instead leader

SOLR4189
This post was updated on .
I'm using SOLR 6.5.1 in cloud mode with replicas. I read  here:

When a document is sent to a Solr node for indexing, the system first
determines which Shard that document belongs to, and then which node is
currently hosting the leader for that shard. The document is then forwarded
to the current leader for indexing, and the leader forwards the update to
all of the other replicas.


So my question, what does happen when I'm sending index request to replica
server instead leader server?

Replica becomes a leader for this request? Or replica becomes only federator
that resends request to leader and then leader will resend to replica?



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: Indexing to replica instead leader

Emir Arnautović
Hi,
Indexing request will always go to leader first. If you are using Solrj and if you initialise it with ZK, it will be aware which node has leader for which document and will send it there. Otherwise, there is a chance of this additional roundtrip replica->leader->replica.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 8 Jun 2018, at 11:56, SOLR4189 <[hidden email]> wrote:
>
> I'm using SOLR 6.5.1 in cloud mode with replicas. I read  here
> <https://lucene.apache.org/solr/guide/7_0/shards-and-indexing-data-in-solrcloud.html>
> :
>
> /When a document is sent to a Solr node for indexing, the system first
> determines which Shard that document belongs to, and then which node is
> currently hosting the leader for that shard. The document is then forwarded
> to the current leader for indexing, and the leader forwards the update to
> all of the other replicas./
>
> So my question, what does happen when I'm sending index request to replica
> server instead leader server?
>
> Replica becomes a leader for this request? Or replica becomes only federator
> that resends request to leader and then leader will resend to replica?
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply | Threaded
Open this post in threaded view
|

Re: Indexing to replica instead leader

Dhutia, Devansh
In reply to this post by SOLR4189
I believe it becomes a federator and resends the request to the leader, but someone else more intimately familiar can correct me.

Devansh Dhutia
Development Manager, Content Ingestion
USA TODAY Network

From: SOLR4189 <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Friday, June 8, 2018 at 6:03 AM
To: "[hidden email]" <[hidden email]>
Subject: Indexing to replica instead leader

I'm using SOLR 6.5.1 in cloud mode with replicas. I read here
<https://lucene.apache.org/solr/guide/7_0/shards-and-indexing-data-in-solrcloud.html<https://lucene.apache.org/solr/guide/7_0/shards-and-indexing-data-in-solrcloud.html>>
:

/When a document is sent to a Solr node for indexing, the system first
determines which Shard that document belongs to, and then which node is
currently hosting the leader for that shard. The document is then forwarded
to the current leader for indexing, and the leader forwards the update to
all of the other replicas./

So my question, what does happen when I'm sending index request to replica
server instead leader server?

Replica becomes a leader for this request? Or replica becomes only federator
that resends request to leader and then leader will resend to replica?



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html<http://lucene.472066.n3.nabble.com/Solr-User-f472068.html>

Reply | Threaded
Open this post in threaded view
|

Re: Indexing to replica instead leader

Erick Erickson
bq. So my question, what does happen when I'm sending index request to
replica instead of leader server?

The replica forwards the document to the leader which then distributes
to _all_ replicas, including the replica that originally forwarded the
document.

Best,
Erick

On Tue, Jun 12, 2018 at 1:31 PM, Dhutia, Devansh <[hidden email]> wrote:

> I believe it becomes a federator and resends the request to the leader, but someone else more intimately familiar can correct me.
>
> Devansh Dhutia
> Development Manager, Content Ingestion
> USA TODAY Network
>
> From: SOLR4189 <[hidden email]>
> Reply-To: "[hidden email]" <[hidden email]>
> Date: Friday, June 8, 2018 at 6:03 AM
> To: "[hidden email]" <[hidden email]>
> Subject: Indexing to replica instead leader
>
> I'm using SOLR 6.5.1 in cloud mode with replicas. I read here
> <https://lucene.apache.org/solr/guide/7_0/shards-and-indexing-data-in-solrcloud.html<https://lucene.apache.org/solr/guide/7_0/shards-and-indexing-data-in-solrcloud.html>>
> :
>
> /When a document is sent to a Solr node for indexing, the system first
> determines which Shard that document belongs to, and then which node is
> currently hosting the leader for that shard. The document is then forwarded
> to the current leader for indexing, and the leader forwards the update to
> all of the other replicas./
>
> So my question, what does happen when I'm sending index request to replica
> server instead leader server?
>
> Replica becomes a leader for this request? Or replica becomes only federator
> that resends request to leader and then leader will resend to replica?
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html<http://lucene.472066.n3.nabble.com/Solr-User-f472068.html>
>
Reply | Threaded
Open this post in threaded view
|

Re: Indexing to replica instead leader

Shawn Heisey-2
In reply to this post by SOLR4189
On 6/8/2018 3:56 AM, SOLR4189 wrote:

> /When a document is sent to a Solr node for indexing, the system first
> determines which Shard that document belongs to, and then which node is
> currently hosting the leader for that shard. The document is then forwarded
> to the current leader for indexing, and the leader forwards the update to
> all of the other replicas./
>
> So my question, what does happen when I'm sending index request to replica
> server instead leader server?
>
> Replica becomes a leader for this request? Or replica becomes only federator
> that resends request to leader and then leader will resend to replica?

Terminology nit:  The leader *is* a replica.  It just has a temporary
special job.  It doesn't lose its status as a replica when it is elected
leader.

If you send a document update to an index that is not the leader for the
correct shard, it will do just what you said above -- figure out the
correct shard, figure out which replica is the leader of that shard, and
forward the request there.  That leader will index the request itself
and then handle updating the other replicas.  It will also reply to the
index where you sent the request, which will reply to you.  The leader
role will not change to another core unless there is a leader election
and the existing leader loses that election.  An election is not going
to happen without a significant cluster event.  Examples are an explicit
election request, or the core/server with the the leader role going down.

Thanks,
Shawn