[
https://issues.apache.org/jira/browse/SOLR-11823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16474025#comment-16474025
]
Torben Greulich commented on SOLR-11823:
----------------------------------------
Hi,
we had the same bug restoring a collection on a single node testserver.
{quote}
Solr cloud with available number of nodes:1 is insufficient for restoring a
collection with 8 shards, total replicas per shard 2 a....
{quote}
In production the collection is running on 3 nodes with 8 shards and a
replication factor of 3. We looked into the solr code and found this in
*org.apache.solr.cloud.api.collections.RestoreCmd.java*
{code:java}
int totalReplicasPerShard = numNrtReplicas + numTlogReplicas +
numPullReplicas;
{code}
So the totalReplicasPerShard is the sum of NrtReplicas, TlogReplicas and
PullReplicas. So we watched into the *collection_state.json* file from our
backup and there we found
{code}
{"core-name":{
"pullReplicas":"0",
"replicationFactor":"1",
"shards":{
"shard1":{
...
"router":{"name":"compositeId"},
"maxShardsPerNode":"8",
"autoAddReplicas":"false",
"nrtReplicas":"1",
"tlogReplicas":"1"}}
{code}
replicationFactor=1 and tlogReplicas=1. So with the code snippet from above we
get *totalReplicasPerShard=2*
After setting *tlogReplicas* to 0 we were able to restore our backup with just
one node.
> Incorrect number of replica calculation when using Restore Collection API
> -------------------------------------------------------------------------
>
> Key: SOLR-11823
> URL: https://issues.apache.org/jira/browse/SOLR-11823
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: Backup/Restore
> Affects Versions: 7.1
> Reporter: Ansgar Wiechers
> Priority: Major
>
> I'm running Solr 7.1 (didn't test other versions) in SolrCloud mode ona a
> 3-node cluster and tried using the backup/restore API for the first time.
> Backup worked fine, but when trying to restore the backed-up collection I ran
> into an unexpected problem with the replication factor setting.
> I expected the command below to restore a backup of the collection "demo"
> with 3 shards, creating 2 replicas per shard. Instead it's trying to create 6
> replicas per shard:
> {noformat}
> # curl -s -k
> 'https://localhost:8983/solr/admin/collections?action=restore&name=demo&location=/srv/backup/solr/solr-dev&collection=demo&maxShardsPerNode=2&replicationFactor=2'
> {
> "error": {
> "code": 400,
> "msg": "Solr cloud with available number of nodes:3 is insufficient for
> restoring a collection with 3 shards, total replicas per shard 6 and
> maxShardsPerNode 2. Consider increasing maxShardsPerNode value OR number
> ofavailable nodes.",
> "metadata": [
> "error-class",
> "org.apache.solr.common.SolrException",
> "root-error-class",
> "org.apache.solr.common.SolrException"
> ]
> },
> "exception": {
> "rspCode": 400,
> "msg": "Solr cloud with available number of nodes:3 is insufficient for
> restoring a collection with 3 shards, total replicas per shard 6 and
> maxShardsPerNode 2. Consider increasing maxShardsPerNode value OR number of
> available nodes."
> },
> "Operation restore caused exception:":
> "org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
> Solr cloud with available number of nodes:3 is insufficient for restoring a
> collection with 3 shards, total replicas per shard 6 and maxShardsPerNode 2.
> Consider increasing maxShardsPerNode value OR number of available nodes.",
> "responseHeader": {
> "QTime": 28,
> "status": 400
> }
> }
> {noformat}
> Restoring a collection with only 2 shards tries to create 6 replicas as well,
> so it looks to me like the restore API multiplies the replication factor with
> the number of nodes, which is not how the replication factor behaves in other
> contexts. The
> [documentation|https://lucene.apache.org/solr/guide/7_1/collections-api.html]
> also didn't lead me to expect this behavior:
> {quote}
> replicationFactor
> The number of replicas to be created for each shard.
> {quote}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]