Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
ab05bdd
Start with test
HoustonPutman Jul 21, 2025
8328c78
Solve issue, but need to clean up. Need to fix for Restore as well
HoustonPutman Jul 21, 2025
d1d6bf5
Use new shardrequest constructs for SyncStrategy
HoustonPutman Jul 21, 2025
f5ee234
Response status should now be the number of replicas
HoustonPutman Jul 21, 2025
02d1e90
Cleanup unused parts of tests
HoustonPutman Jul 22, 2025
1be4ed0
Huge commit - restore uses installshard - big update in locking
HoustonPutman Jul 24, 2025
8365a23
Implement callingLock mirroring for distributed API Manager locking
HoustonPutman Aug 1, 2025
00a67b4
Huge commit - restore uses installshard - big update in locking
HoustonPutman Jul 24, 2025
2d5e12b
Implement callingLock mirroring for distributed API Manager locking
HoustonPutman Aug 1, 2025
37cea68
Merge remote-tracking branch 'apache/main' into locking-update
HoustonPutman Sep 2, 2025
293f35d
Merge remote-tracking branch 'apache/main' into locking-update
HoustonPutman Dec 2, 2025
242235a
Changelog
HoustonPutman Dec 2, 2025
4a2c562
Merge remote-tracking branch 'apache/main' into fix-restore-partial-s…
HoustonPutman Dec 2, 2025
b4c3b7b
WIP - testing
HoustonPutman Dec 4, 2025
72ae4bf
Merge remote-tracking branch 'apache/main' into solr-18011-locking-up…
HoustonPutman Jan 5, 2026
da3e6cd
Merge remote-tracking branch 'apache/main' into fix-restore-partial-s…
HoustonPutman Jan 5, 2026
43d1091
Removing leadership starts a recovery, don't issue a second recovery
HoustonPutman Jan 6, 2026
e037654
Handle async success/failure better for collectionHandlingUtils
HoustonPutman Jan 6, 2026
8323e72
Small fixes for installShardCmd
HoustonPutman Jan 6, 2026
e9c09d6
Add tests, fix recovery contention
HoustonPutman Jan 8, 2026
5e4c1be
Remove uneeded testing code
HoustonPutman Jan 8, 2026
25e9ecd
Tidy
HoustonPutman Jan 8, 2026
b0452f4
Support distributed locks better
HoustonPutman Jan 8, 2026
72401ca
Start switching over to AdminCmdContext
HoustonPutman Jan 8, 2026
6dac593
Refactor how locking is passed through collections api commands.
HoustonPutman Jan 9, 2026
e368c48
Make some bug fixes
HoustonPutman Jan 10, 2026
97352f7
Some test 'fixes', need to rethink v2 tests still
HoustonPutman Jan 10, 2026
6f2d61a
Add real tests for DeleteAlias and DeleteNode v2 apis
HoustonPutman Jan 12, 2026
74176a4
Tidy
HoustonPutman Jan 12, 2026
df0888c
Fix broken tests
HoustonPutman Jan 13, 2026
3627d29
Add missing test utility class
HoustonPutman Jan 13, 2026
4a49aa9
Move over remaining APIs and tests
HoustonPutman Jan 13, 2026
021303a
Merge remote-tracking branch 'apache/main' into solr-18011-locking-up…
HoustonPutman Jan 13, 2026
e61279c
Merge remote-tracking branch 'apache/main' into solr-18011-locking-up…
HoustonPutman Jan 17, 2026
4c9a766
Fix changelog entry
HoustonPutman Jan 17, 2026
c7cfe19
Remove files that shouldn't be changed.
HoustonPutman Jan 17, 2026
08326cc
One more that shouldn't be changed
HoustonPutman Jan 17, 2026
eaddd46
Merge branch 'solr-18011-locking-update' into fix-restore-partial-suc…
HoustonPutman Jan 17, 2026
b90c283
Some more fixes
HoustonPutman Jan 17, 2026
b13d97e
SOLR-18080: Initiate Leader election for ShardTerms
HoustonPutman Jan 21, 2026
7522caa
Add changelog entry
HoustonPutman Jan 21, 2026
776c28b
Fix precommit issues
HoustonPutman Jan 21, 2026
f3e6ff8
Fixes for passing callingLockIds around
HoustonPutman Jan 22, 2026
2513cd4
Fixes for passing callingLockIds around
HoustonPutman Jan 22, 2026
a78ece5
Merge branch 'solr-18080-shard-term-induce-leader-election' into fix-…
HoustonPutman Jan 23, 2026
d2dad8e
Fixes for syncStrategy with empty indexes
HoustonPutman Jan 23, 2026
198f01b
Improve tests for recovery
HoustonPutman Jan 24, 2026
a667bb4
Make read only check better
HoustonPutman Jan 24, 2026
ed8c839
Improve logging for results
HoustonPutman Jan 24, 2026
3b898f9
Various fixes
HoustonPutman Jan 24, 2026
bb37120
Let some parts of solr fetch an index writer for a read-only core
HoustonPutman Jan 27, 2026
3135c5b
Tidy
HoustonPutman Jan 27, 2026
e3d1d26
Fix collection and shard term deletion
HoustonPutman Jan 27, 2026
40b62f6
Tidy
HoustonPutman Jan 27, 2026
da598a5
make another wait conditional on not readOnly
HoustonPutman Jan 27, 2026
1b71b72
Add changelog entry, remove others
HoustonPutman Jan 27, 2026
7dc8a98
Tidy
HoustonPutman Jan 28, 2026
f6062da
Fix no uLog error case
HoustonPutman Jan 28, 2026
714a705
Fix test
HoustonPutman Jan 28, 2026
201d31d
InstallShardTest failure scenario should not just be s3
HoustonPutman Jan 28, 2026
71aae5b
Make some fixes, primarily indexFetcher checking files that are still…
HoustonPutman Jan 28, 2026
062ef49
Address some review comments
HoustonPutman Jan 28, 2026
3f200ac
Change flag to failOnReadOnly
HoustonPutman Jan 28, 2026
b0f4520
Merge remote-tracking branch 'apache/main' into solr-18011-locking-up…
HoustonPutman Jan 29, 2026
dbb01cd
Deserialize callingLockIds in context class
HoustonPutman Jan 29, 2026
e87052e
Make some fixes for LockTree, add tests to validate
HoustonPutman Jan 29, 2026
5a2b445
Improve tests, fix errors in locking
HoustonPutman Jan 30, 2026
1e4767a
Add tests for Distributed locking. Make fixes
HoustonPutman Jan 30, 2026
82803e4
Merge remote-tracking branch 'apache/main' into fix-restore-partial-s…
HoustonPutman Jan 30, 2026
b24a1d4
Merge branch 'solr-18011-locking-update' into fix-restore-partial-suc…
HoustonPutman Jan 30, 2026
ea3aa3f
Add back in ShardRequest.coreName
HoustonPutman Jan 30, 2026
b7939e0
Merge remote-tracking branch 'apache/main' into solr-18011-locking-up…
HoustonPutman Mar 24, 2026
c0184a0
Merge remote-tracking branch 'apache/main' into fix-restore-partial-s…
HoustonPutman Mar 24, 2026
1bf192c
Fix precommit issues
HoustonPutman Mar 24, 2026
e750951
Merge remote-tracking branch 'apache/main' into solr-18011-locking-up…
HoustonPutman Apr 14, 2026
a9b4cdb
Make sure that locking must be top-down, and cannot introduce dead-locks
HoustonPutman Apr 14, 2026
76ea4fd
Only pass relevant lockId, not all lockIds
HoustonPutman Apr 14, 2026
123c982
Merge remote-tracking branch 'apache/main' into fix-restore-partial-s…
HoustonPutman Apr 14, 2026
efe3bd5
Merge branch 'solr-18011-locking-update' into fix-restore-partial-suc…
HoustonPutman Apr 14, 2026
629d9c4
One missed refactored name
HoustonPutman Apr 14, 2026
3de9b9c
Merge branch 'solr-18011-locking-update' into fix-restore-partial-suc…
HoustonPutman Apr 14, 2026
2687168
Some fixes
HoustonPutman Apr 14, 2026
0949ded
Merge branch 'solr-18011-locking-update' into fix-restore-partial-suc…
HoustonPutman Apr 14, 2026
edf4a12
Improve changelog entry
HoustonPutman Apr 15, 2026
50f97a2
Fix error scenario for overseer, add test
HoustonPutman Apr 20, 2026
19fee46
Merge branch 'solr-18011-locking-update' into fix-restore-partial-suc…
HoustonPutman Apr 21, 2026
2de4f8c
Merge remote-tracking branch 'apache/main' into fix-restore-partial-s…
HoustonPutman Apr 21, 2026
089281d
Remove commented out and unrelated code
HoustonPutman Apr 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: Fix error scenario in InstallShardData and Restore
type: fixed # added, changed, fixed, deprecated, removed, dependency_update, security, other
authors:
- name: Houston Putman
nick: HoustonPutman
links:
- name: SOLR-17821
url: https://issues.apache.org/jira/browse/SOLR-17821
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ public class InstallShardDataRequestBody {

@JsonProperty public String repository;

@JsonProperty public String name;

@JsonProperty public String shardBackupId;

@JsonProperty public String async;
}
13 changes: 4 additions & 9 deletions solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ public SyncStrategy(CoreContainer cc) {
updateExecutor = updateShardHandler.getUpdateExecutor();
}

private static class ShardCoreRequest extends ShardRequest {
String coreName;
public String baseUrl;
}

public PeerSync.PeerSyncResult sync(
ZkController zkController, SolrCore core, ZkNodeProps leaderProps) {
return sync(zkController, core, leaderProps, false, false);
Expand Down Expand Up @@ -322,8 +317,8 @@ private void syncToMe(
} else {
RecoveryRequest rr = new RecoveryRequest();
rr.leaderProps = leaderProps;
rr.baseUrl = ((ShardCoreRequest) srsp.getShardRequest()).baseUrl;
rr.coreName = ((ShardCoreRequest) srsp.getShardRequest()).coreName;
rr.baseUrl = srsp.getShardRequest().nodeName;
rr.coreName = srsp.getShardRequest().coreName;
recoveryRequests.add(rr);
}
} else {
Expand Down Expand Up @@ -355,9 +350,9 @@ private boolean handleResponse(ShardResponse srsp) {
private void requestSync(
String baseUrl, String replica, String leaderUrl, String coreName, int nUpdates) {
// TODO should we use peerSyncWithLeader instead?
ShardCoreRequest sreq = new ShardCoreRequest();
ShardRequest sreq = new ShardRequest();
sreq.coreName = coreName;
sreq.baseUrl = baseUrl;
sreq.nodeName = baseUrl;
sreq.purpose = ShardRequest.PURPOSE_PRIVATE;
sreq.shards = new String[] {replica};
sreq.actualShards = sreq.shards;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,27 @@

package org.apache.solr.cloud.api.collections;

import static org.apache.solr.cloud.Overseer.QUEUE_OPERATION;
import static org.apache.solr.common.params.CommonAdminParams.ASYNC;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.lang.invoke.MethodHandles;
import java.util.HashMap;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.solr.cloud.ZkShardTerms;
import org.apache.solr.common.SolrErrorWrappingException;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
Expand Down Expand Up @@ -80,27 +87,114 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
// Build the core-admin request
final ModifiableSolrParams coreApiParams = new ModifiableSolrParams();
coreApiParams.set(
CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.INSTALLCOREDATA.toString());
typedMessage.toMap(new HashMap<>()).forEach((k, v) -> coreApiParams.set(k, v.toString()));
CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.RESTORECORE.toString());
coreApiParams.set(CoreAdminParams.BACKUP_LOCATION, typedMessage.location);
coreApiParams.set(CoreAdminParams.BACKUP_REPOSITORY, typedMessage.repository);
coreApiParams.set(CoreAdminParams.NAME, typedMessage.name);
coreApiParams.set(CoreAdminParams.SHARD_BACKUP_ID, typedMessage.shardBackupId);

// Send the core-admin request to each replica in the slice
final ShardHandler shardHandler = ccc.newShardHandler();
shardRequestTracker.sliceCmd(clusterState, coreApiParams, null, installSlice, shardHandler);
List<Replica> notLiveReplicas =
shardRequestTracker.sliceCmd(clusterState, coreApiParams, null, installSlice, shardHandler);
final String errorMessage =
String.format(
Locale.ROOT,
"Could not install data to collection [%s] and shard [%s]",
"Could not install data to collection [%s] and shard [%s] on any leader-eligible replicas",
typedMessage.collection,
typedMessage.shard);
shardRequestTracker.processResponses(results, shardHandler, true, errorMessage);
shardRequestTracker.processResponses(results, shardHandler, false, errorMessage);
Collection<Replica> allReplicas =
clusterState
.getCollection(typedMessage.collection)
.getSlice(typedMessage.shard)
.getReplicas();

// Ensure that terms are correct for this shard after the execution is done
// We only care about leader eligible replicas, all others will eventually get updated.
List<Replica> leaderEligibleReplicas =
allReplicas.stream().filter(r -> r.getType().leaderEligible).collect(Collectors.toList());

NamedList<Object> failures = (NamedList<Object>) results.get("failure");
Set<Replica> successfulReplicas =
leaderEligibleReplicas.stream()
.filter(replica -> !notLiveReplicas.contains(replica))
.filter(
replica ->
failures == null
|| failures.get(CollectionHandlingUtils.requestKey(replica)) == null)
.collect(Collectors.toSet());

if (successfulReplicas.isEmpty()) {
// No leader-eligible replicas succeeded, return failure
if (failures == null) {
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR,
errorMessage + ". No leader-eligible replicas are live.");
} else {
throw new SolrErrorWrappingException(
SolrException.ErrorCode.SERVER_ERROR,
errorMessage,
Collections.singletonList(failures.asMap(1)));
}
} else if (successfulReplicas.size() < leaderEligibleReplicas.size()) {
// Some, but not all, leader-eligible replicas succeeded.
// Ensure the shard terms are correct so that the non-successful replicas go into recovery
ZkShardTerms shardTerms =
ccc.getCoreContainer()
.getZkController()
.getShardTerms(typedMessage.collection, typedMessage.shard);
final Set<String> replicasToStartRecovery = new HashSet<>();
leaderEligibleReplicas.stream()
.filter(r -> !successfulReplicas.contains(r))
.map(Replica::getName)
.forEach(replicasToStartRecovery::add);
log.info("Putting the unsuccessful replicas into recovery: {}", replicasToStartRecovery);
shardTerms.ensureHighestTerms(
installCollection,
successfulReplicas.stream().map(Replica::getName).collect(Collectors.toSet()));
ccc.getZkStateReader()
.waitForState(
typedMessage.collection,
30,
TimeUnit.SECONDS,
(liveNodes, collectionState) -> {
collectionState.getSlice(typedMessage.shard).getReplicas().stream()
.filter(r -> Replica.State.RECOVERING.equals(r.getState()))
.map(Replica::getName)
.forEach(replicasToStartRecovery::remove);
return replicasToStartRecovery.isEmpty();
});

// In order for the async request to succeed, we need to ensure that there is no failure
// message
NamedList<Object> successes = (NamedList<Object>) results.get("success");
failures.forEach(
(replicaKey, value) -> {
successes.add(
replicaKey,
new NamedList<>(
Map.of(
"explanation",
"Core install failed, but is now recovering from the leader",
"failure",
value)));
});
results.remove("failure");
} else {
// other replicas to-be-created will know that they are out of date by
// looking at their term : 0 compare to term of this core : 1
ccc.getCoreContainer()
.getZkController()
.getShardTerms(typedMessage.collection, typedMessage.shard)
.ensureHighestTermsAreNotZero();
}
}

/** A value-type representing the message received by {@link InstallShardDataCmd} */
@JsonIgnoreProperties(ignoreUnknown = true)
public static class RemoteMessage implements JacksonReflectMapWriter {

@JsonProperty(QUEUE_OPERATION)
public String operation = CollectionParams.CollectionAction.INSTALLSHARDDATA.toLower();

@JsonProperty public String collection;

@JsonProperty public String shard;
Expand All @@ -109,8 +203,9 @@ public static class RemoteMessage implements JacksonReflectMapWriter {

@JsonProperty public String location;

@JsonProperty(ASYNC)
public String asyncId;
@JsonProperty public String name = "";

@JsonProperty public String shardBackupId;

public void validate() {
if (StrUtils.isBlank(collection)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.apache.solr.common.params.CollectionParams.CollectionAction.ADDREPLICA;
import static org.apache.solr.common.params.CollectionParams.CollectionAction.CREATE;
import static org.apache.solr.common.params.CollectionParams.CollectionAction.CREATESHARD;
import static org.apache.solr.common.params.CollectionParams.CollectionAction.INSTALLSHARDDATA;
import static org.apache.solr.common.params.CollectionParams.CollectionAction.MODIFYCOLLECTION;
import static org.apache.solr.common.params.CommonParams.NAME;

Expand Down Expand Up @@ -108,7 +109,7 @@ public void call(AdminCmdContext adminCmdContext, ZkNodeProps message, NamedList
}
}

private void requestReplicasToRestore(
private void requestShardsToRestore(
NamedList<Object> results,
DocCollection restoreCollection,
AdminCmdContext adminCmdContext,
Expand All @@ -117,11 +118,13 @@ private void requestReplicasToRestore(
String repo,
ShardHandler shardHandler) {
ShardRequestTracker shardRequestTracker =
CollectionHandlingUtils.asyncRequestTracker(adminCmdContext, ccc);
CollectionHandlingUtils.asyncRequestTracker(adminCmdContext, "/admin/collections", ccc);
// Copy data from backed up index to each replica
for (Slice slice : restoreCollection.getSlices()) {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.RESTORECORE.toString());
params.set(CollectionAdminParams.COLLECTION, slice.getCollection());
params.set(CollectionAdminParams.SHARD, slice.getName());
params.set(CoreAdminParams.ACTION, INSTALLSHARDDATA.toString());
Optional<ShardBackupId> shardBackupId = backupProperties.getShardBackupIdFor(slice.getName());
if (shardBackupId.isPresent()) {
params.set(CoreAdminParams.SHARD_BACKUP_ID, shardBackupId.get().getIdAsString());
Expand All @@ -130,11 +133,24 @@ private void requestReplicasToRestore(
}
params.set(CoreAdminParams.BACKUP_LOCATION, backupPath.toASCIIString());
params.set(CoreAdminParams.BACKUP_REPOSITORY, repo);
shardRequestTracker.sliceCmd(
adminCmdContext.getClusterState(), params, null, slice, shardHandler);
Replica replica = slice.getLeader();
if (replica == null) {
replica =
slice.getReplicas().stream()
.findFirst()
.orElseThrow(
() ->
new SolrException(
ErrorCode.INVALID_STATE,
String.format(
Locale.ROOT,
"No replicas for shard %s in collection %s. Cannot restore to a shard with no replicas",
slice.getName(),
slice.getCollection())));
}
shardRequestTracker.sendShardRequest(replica, params, shardHandler);
}
shardRequestTracker.processResponses(
new NamedList<>(), shardHandler, true, "Could not restore core");
shardRequestTracker.processResponses(results, shardHandler, true, "Could not restore shard");
}

/** Encapsulates the parsing and access for common parameters restore parameters and values */
Expand Down Expand Up @@ -273,7 +289,7 @@ public void process(NamedList<Object> results, RestoreContext rc) throws Excepti
// refresh the location copy of collection state
restoreCollection =
rc.zkStateReader.getClusterState().getCollection(rc.restoreCollectionName);
requestReplicasToRestore(
requestShardsToRestore(
results,
restoreCollection,
rc.adminCmdContext.withClusterState(rc.zkStateReader.getClusterState()),
Expand Down Expand Up @@ -625,7 +641,7 @@ public void process(RestoreContext rc, NamedList<Object> results) throws Excepti
rc.adminCmdContext.withClusterState(rc.zkStateReader.getClusterState()),
restoreCollection);
try {
requestReplicasToRestore(
requestShardsToRestore(
results,
restoreCollection,
rc.adminCmdContext.withClusterState(rc.zkStateReader.getClusterState()),
Expand All @@ -649,8 +665,7 @@ private void disableReadOnly(AdminCmdContext adminCmdContext, DocCollection rest
ZkStateReader.COLLECTION_PROP, restoreCollection.getName(),
ZkStateReader.READ_ONLY, null);
new CollApiCmds.ModifyCollectionCmd(ccc)
.call(
adminCmdContext.subRequestContext(MODIFYCOLLECTION, null), params, new NamedList<>());
.call(adminCmdContext.subRequestContext(MODIFYCOLLECTION), params, new NamedList<>());
}

private void enableReadOnly(AdminCmdContext adminCmdContext, DocCollection restoreCollection)
Expand All @@ -662,8 +677,7 @@ private void enableReadOnly(AdminCmdContext adminCmdContext, DocCollection resto
ZkStateReader.COLLECTION_PROP, restoreCollection.getName(),
ZkStateReader.READ_ONLY, "true");
new CollApiCmds.ModifyCollectionCmd(ccc)
.call(
adminCmdContext.subRequestContext(MODIFYCOLLECTION, null), params, new NamedList<>());
.call(adminCmdContext.subRequestContext(MODIFYCOLLECTION), params, new NamedList<>());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
import static org.apache.solr.common.params.CommonParams.VALUE_LONG;
import static org.apache.solr.common.params.CoreAdminParams.BACKUP_LOCATION;
import static org.apache.solr.common.params.CoreAdminParams.BACKUP_REPOSITORY;
import static org.apache.solr.common.params.CoreAdminParams.SHARD_BACKUP_ID;
import static org.apache.solr.common.util.StrUtils.formatString;

import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -1068,6 +1069,8 @@ public Map<String, Object> execute(
reqBody.async = req.getParams().get(ASYNC);
reqBody.repository = req.getParams().get(BACKUP_REPOSITORY);
reqBody.location = req.getParams().get(BACKUP_LOCATION);
reqBody.name = req.getParams().get(NAME);
reqBody.shardBackupId = req.getParams().get(SHARD_BACKUP_ID);

final InstallShardData installApi = new InstallShardData(h.coreContainer, req, rsp);
final SolrJerseyResponse installResponse =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ public SolrJerseyResponse installCoreData(String coreName, InstallCoreDataReques
SolrException.ErrorCode.SERVER_ERROR,
"Failed to install data to core=" + core.getName());
}

// other replicas to-be-created will know that they are out of date by
// looking at their term : 0 compare to term of this core : 1
zkController
.getShardTerms(cd.getCollectionName(), cd.getShardId())
.ensureHighestTermsAreNotZero();
}

return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public SubResponseAccumulatingJerseyResponse installShardData(
// Only install data to shards which belong to a collection in read-only mode
final DocCollection dc =
coreContainer.getZkController().getZkStateReader().getCollection(collName);
if (!dc.isReadOnly()) {
if (dc.getSlice(shardName).getReplicas().size() > 1 && !dc.isReadOnly()) {
throw new SolrException(
SolrException.ErrorCode.BAD_REQUEST,
"Collection must be in readOnly mode before installing data to shard");
"Collection must be in readOnly mode before installing data to shard with more than 1 replica");
}

submitRemoteMessageAndHandleResponse(
Expand Down Expand Up @@ -112,6 +112,8 @@ public static ZkNodeProps createRemoteMessage(
if (requestBody != null) {
messageTyped.location = requestBody.location;
messageTyped.repository = requestBody.repository;
messageTyped.name = requestBody.name;
messageTyped.shardBackupId = requestBody.shardBackupId;
}

messageTyped.validate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ private void doRestore(String coreName, RestoreCoreRequestBody requestBody) thro
throw new SolrException(
SolrException.ErrorCode.SERVER_ERROR, "Failed to restore core=" + core.getName());
}
// other replicas to-be-created will know that they are out of date by
// looking at their term : 0 compare to term of this core : 1
coreContainer
.getZkController()
.getShardTerms(cd.getCollectionName(), cd.getShardId())
.ensureHighestTermsAreNotZero();

// transitions state of update log to ACTIVE
UpdateLog updateLog = core.getUpdateHandler().getUpdateLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class ShardRequest {
/** may be null */
public String coreNodeName;

/** may be null */
public String coreName;

/** may be null */
public Map<String, String> headers;

Expand Down
Loading
Loading