John Wong created SOLR-6036:
-------------------------------
Summary: 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]