[ 
https://issues.apache.org/jira/browse/SOLR-14712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Noble Paul updated SOLR-14712:
------------------------------
    Description: 
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}

  was:
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}


> Standardize RPC calls in Solr
> -----------------------------
>
>                 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
>          Time Spent: 20m
>  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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to