mirror of https://github.com/apache/lucene.git
SOLR-11560: Specifying the replicationFactor parameter while restoring a collection would lead to extra tlog
and pull replicas being created
This commit is contained in:
parent
bc46de3b2a
commit
07652a5289
|
@ -95,6 +95,9 @@ Bug Fixes
|
||||||
* SOLR-9440: The ZkStateReader.removeCollectionStateWatcher method can cache a DocCollection reference and
|
* SOLR-9440: The ZkStateReader.removeCollectionStateWatcher method can cache a DocCollection reference and
|
||||||
never update it causing stale state to be returned in ClusterState. (shalin)
|
never update it causing stale state to be returned in ClusterState. (shalin)
|
||||||
|
|
||||||
|
* SOLR-11560: Specifying the replicationFactor parameter while restoring a collection would lead to extra tlog
|
||||||
|
and pull replicas being created (Peter Szantai-Kis, Varun Thacker)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
* SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr
|
* SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr
|
||||||
|
|
|
@ -350,8 +350,8 @@ public class RestoreCmd implements OverseerCollectionMessageHandler.Cmd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getInt(ZkNodeProps message, String propertyName, Integer default1, int default2) {
|
private int getInt(ZkNodeProps message, String propertyName, Integer count, int defaultValue) {
|
||||||
Integer value = message.getInt(REPLICATION_FACTOR, default1);
|
Integer value = message.getInt(propertyName, count);
|
||||||
return value!=null?value:default2;
|
return value!=null ? value:defaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,10 @@ public abstract class AbstractCloudBackupRestoreTestCase extends SolrCloudTestCa
|
||||||
|
|
||||||
protected static final int NUM_SHARDS = 2;//granted we sometimes shard split to get more
|
protected static final int NUM_SHARDS = 2;//granted we sometimes shard split to get more
|
||||||
|
|
||||||
|
int replFactor;
|
||||||
|
int numTlogReplicas;
|
||||||
|
int numPullReplicas;
|
||||||
|
|
||||||
private static long docsSeed; // see indexDocs()
|
private static long docsSeed; // see indexDocs()
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@ -84,9 +88,9 @@ public abstract class AbstractCloudBackupRestoreTestCase extends SolrCloudTestCa
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
boolean isImplicit = random().nextBoolean();
|
boolean isImplicit = random().nextBoolean();
|
||||||
boolean doSplitShardOperation = !isImplicit && random().nextBoolean();
|
boolean doSplitShardOperation = !isImplicit && random().nextBoolean();
|
||||||
int replFactor = TestUtil.nextInt(random(), 1, 2);
|
replFactor = TestUtil.nextInt(random(), 1, 2);
|
||||||
int numTlogReplicas = TestUtil.nextInt(random(), 0, 1);
|
numTlogReplicas = TestUtil.nextInt(random(), 0, 1);
|
||||||
int numPullReplicas = TestUtil.nextInt(random(), 0, 1);
|
numPullReplicas = TestUtil.nextInt(random(), 0, 1);
|
||||||
|
|
||||||
CollectionAdminRequest.Create create = isImplicit ?
|
CollectionAdminRequest.Create create = isImplicit ?
|
||||||
// NOTE: use shard list with same # of shards as NUM_SHARDS; we assume this later
|
// NOTE: use shard list with same # of shards as NUM_SHARDS; we assume this later
|
||||||
|
@ -241,6 +245,12 @@ public abstract class AbstractCloudBackupRestoreTestCase extends SolrCloudTestCa
|
||||||
CollectionAdminRequest.Restore restore = CollectionAdminRequest.restoreCollection(restoreCollectionName, backupName)
|
CollectionAdminRequest.Restore restore = CollectionAdminRequest.restoreCollection(restoreCollectionName, backupName)
|
||||||
.setLocation(backupLocation).setRepositoryName(getBackupRepoName());
|
.setLocation(backupLocation).setRepositoryName(getBackupRepoName());
|
||||||
|
|
||||||
|
|
||||||
|
//explicitly specify the replicationFactor/pullReplicas/nrtReplicas/tlogReplicas .
|
||||||
|
//Value is still the same as the original. maybe test with different values that the original for better test coverage
|
||||||
|
if (random().nextBoolean()) {
|
||||||
|
restore.setReplicationFactor(replFactor);
|
||||||
|
}
|
||||||
if (backupCollection.getReplicas().size() > cluster.getJettySolrRunners().size()) {
|
if (backupCollection.getReplicas().size() > cluster.getJettySolrRunners().size()) {
|
||||||
// may need to increase maxShardsPerNode (e.g. if it was shard split, then now we need more)
|
// may need to increase maxShardsPerNode (e.g. if it was shard split, then now we need more)
|
||||||
restore.setMaxShardsPerNode((int)Math.ceil(backupCollection.getReplicas().size()/cluster.getJettySolrRunners().size()));
|
restore.setMaxShardsPerNode((int)Math.ceil(backupCollection.getReplicas().size()/cluster.getJettySolrRunners().size()));
|
||||||
|
@ -306,6 +316,14 @@ public abstract class AbstractCloudBackupRestoreTestCase extends SolrCloudTestCa
|
||||||
v <= restoreCollection.getMaxShardsPerNode());
|
v <= restoreCollection.getMaxShardsPerNode());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
assertEquals("Different count of nrtReplicas. Backup collection state=" + backupCollection + "\nRestore " +
|
||||||
|
"collection state=" + restoreCollection, replFactor, restoreCollection.getNumNrtReplicas().intValue());
|
||||||
|
assertEquals("Different count of pullReplicas. Backup collection state=" + backupCollection + "\nRestore" +
|
||||||
|
" collection state=" + restoreCollection, numPullReplicas, restoreCollection.getNumPullReplicas().intValue());
|
||||||
|
assertEquals("Different count of TlogReplica. Backup collection state=" + backupCollection + "\nRestore" +
|
||||||
|
" collection state=" + restoreCollection, numTlogReplicas, restoreCollection.getNumTlogReplicas().intValue());
|
||||||
|
|
||||||
|
|
||||||
// assert added core properties:
|
// assert added core properties:
|
||||||
// DWS: did via manual inspection.
|
// DWS: did via manual inspection.
|
||||||
// TODO Find the applicable core.properties on the file system but how?
|
// TODO Find the applicable core.properties on the file system but how?
|
||||||
|
|
Loading…
Reference in New Issue