[
https://issues.apache.org/jira/browse/SOLR-6036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Shawn Heisey closed SOLR-6036.
------------------------------
Resolution: Invalid
{quote}
I believe the <= should just be < as it won't allow 0. It may have been legacy
from when replicationFactor of 1 included the leader/master copy, whereas in
solr 4.x, replicationFactor is defined by additional replicas on top of the
leader.
http://wiki.apache.org/solr/SolrCloud
replicationFactor: The number of copies of each document (or, the number of
physical replicas to be created for each logical shard of the collection.) A
replicationFactor of 3 means that there will be 3 replicas (one of which is
normally designated to be the leader) for each logical shard. NOTE: in Solr
4.0, replicationFactor was the number of additional copies as opposed to the
total number of copies
{quote}
The "NOTE" above refers specifically to one specific release -- Solr 4.0. In
4.1 and later (including the just-released 4.8), if you specify
replicationFactor=2, you will get a total of two replicas. One of them will be
elected the leader. There will not be a leader and two additional copies --
there will be exactly two. To create a collection that has no redundancy, use
replicationFactor=1.
I have created the collections on my small SolrCloud install with
replicationFactor=2, running Solr 4.2.1. I have exactly two copies of every
shard. I have not seen anything in any SOLR-NNNN issue or any code commit to
change this meaning.
The "if" statement in the code is correct. If you specified a replication
factor of zero, there would be no index.
> Can't create collection with replicationFactor=0
> ------------------------------------------------
>
> Key: SOLR-6036
> URL: https://issues.apache.org/jira/browse/SOLR-6036
> Project: Solr
> Issue Type: Bug
> Components: SolrCloud
> Affects Versions: 4.3.1, 4.8
> Reporter: John Wong
> Priority: Trivial
>
> solrcloud$ curl
> 'http://localhost:8983/solr/admin/collections?action=CREATE&name=collection&numShards=2&replicationFactor=0'
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
> <lst name="responseHeader"><int name="status">400</int><int
> name="QTime">60052</int></lst><str name="Operation createcollection caused
> exception:">org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
> replicationFactor must be greater than or equal to 0</str><lst
> name="exception"><str name="msg">replicationFactor must be greater than or
> equal to 0</str><int name="rspCode">400</int></lst><lst name="error"><str
> name="msg">replicationFactor must be greater than or equal to 0</str><int
> name="code">400</int></lst>
> </response>
> I am using solr 4.3.1, but I peeked into the source up to 4.8 and the problem
> still persists, but in 4.8, the exception message now is changed to be
> greater than 0.
> The code snippet in OverseerCollectionProcessor.java:
> if (repFactor <= 0) {
> throw new SolrException(ErrorCode.BAD_REQUEST, REPLICATION_FACTOR + "
> must be greater than 0");
> }
> I believe the <= should just be < as it won't allow 0. It may have been
> legacy from when replicationFactor of 1 included the leader/master copy,
> whereas in solr 4.x, replicationFactor is defined by additional replicas on
> top of the leader.
> http://wiki.apache.org/solr/SolrCloud
> replicationFactor: The number of copies of each document (or, the number of
> physical replicas to be created for each logical shard of the collection.) A
> replicationFactor of 3 means that there will be 3 replicas (one of which is
> normally designated to be the leader) for each logical shard. NOTE: in Solr
> 4.0, replicationFactor was the number of *additional* copies as opposed to
> the total number of copies.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]