You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "David Smiley (Jira)" <ji...@apache.org> on 2020/08/13 05:00:00 UTC
[jira] [Commented] (SOLR-14712) Standardize internal Solr-to-Solr
RPC API
[ https://issues.apache.org/jira/browse/SOLR-14712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17176763#comment-17176763 ]
David Smiley commented on SOLR-14712:
-------------------------------------
The to-be-replaced with is gorgeous! Thanks Noble.
> Standardize internal Solr-to-Solr RPC API
> -----------------------------------------
>
> Key: SOLR-14712
> URL: https://issues.apache.org/jira/browse/SOLR-14712
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Noble Paul
> Assignee: Noble Paul
> Priority: Major
> Labels: clean-api
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> We should have a standard mechanism to make a request to the right replica/node across solr code.
> This RPC mechanism assumes that
> * The RPC mechanism is HTTP
> * It is aware of all collections,shards & their topology etc
> * it knows how to route a request to the correct core
> This is agnostic of wire level formats ,Solr documents etc. That is a layer above this.
> Anyone can use their own JSON parser or any other RPC wire level format on top of this
> for example a code like this
> {code}
> private void invokeOverseerOp(String electionNode, String op) {
> ModifiableSolrParams params = new ModifiableSolrParams();
> ShardHandler shardHandler = shardHandlerFactory.getShardHandler();
> params.set(CoreAdminParams.ACTION, CoreAdminAction.OVERSEEROP.toString());
> params.set("op", op);
> params.set("qt", adminPath);
> params.set("electionNode", electionNode);
> ShardRequest sreq = new ShardRequest();
> sreq.purpose = 1;
> String replica = zkStateReader.getBaseUrlForNodeName(LeaderElector.getNodeName(electionNode));
> sreq.shards = new String[]\{replica};
> sreq.actualShards = sreq.shards;
> sreq.params = params;
> shardHandler.submit(sreq, replica, sreq.params);
> shardHandler.takeCompletedOrError();
> }
> {code}
> will be replaced with
> {code}
> private void invokeOverseerOp(String electionNode, String op) {
> RpcFactory factory = null;
> factory.createCallRouter()
> .toNode(electionNode)
> .createHttpRpc()
> .withMethod(SolrRequest.METHOD.GET)
> .addParam(CoreAdminParams.ACTION, CoreAdminAction.OVERSEEROP.toString())
> .addParam("op", op)
> .addParam("electionNode", electionNode)
> .addParam(ShardParams.SHARDS_PURPOSE, 1)
> .withV1Path(adminPath)
> .invoke();
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org