Skip to content

Commit

Permalink
Remove comment, create method for cancel recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsanjay committed Mar 3, 2024
1 parent 6a0b54b commit 1c6798b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ public final void setRecoveringAfterStartup(boolean recoveringAfterStartup) {
}

private Http2SolrClient.Builder recoverySolrClientBuilder(String baseUrl, String leaderCoreName) {
// workaround for SOLR-13605: get the configured timeouts & set them directly
// (even though getRecoveryOnlyHttpClient() already has them set)
final UpdateShardHandlerConfig cfg = cc.getConfig().getUpdateShardHandlerConfig();
return new Http2SolrClient.Builder(baseUrl)
.withDefaultCollection(leaderCoreName)
Expand All @@ -188,9 +186,7 @@ private Http2SolrClient.Builder recoverySolrClientBuilder(String baseUrl, String
@Override
public final void close() {
close = true;
if (prevSendPreRecoveryHttpUriRequest != null) {
prevSendPreRecoveryHttpUriRequest.cancel(true);
}
cancelPrepRecoveryCmd();
log.warn("Stopping recovery for core=[{}] coreNodeName=[{}]", coreName, coreZkNodeName);
}

Expand Down Expand Up @@ -631,7 +627,7 @@ public final void doSyncOrReplicateRecovery(SolrCore core) throws Exception {
.getCollection(cloudDesc.getCollectionName())
.getSlice(cloudDesc.getShardId());

Optional.ofNullable(prevSendPreRecoveryHttpUriRequest).ifPresent(req -> req.cancel(true));
cancelPrepRecoveryCmd();

if (isClosed()) {
log.info("RecoveryStrategy has been closed");
Expand Down Expand Up @@ -918,4 +914,8 @@ private final void sendPrepRecoveryCmd(String leaderBaseUrl, String leaderCoreNa
prevSendPreRecoveryHttpUriRequest.run();
}
}

private void cancelPrepRecoveryCmd() {
Optional.ofNullable(prevSendPreRecoveryHttpUriRequest).ifPresent(req -> req.cancel(true));
}
}

0 comments on commit 1c6798b

Please sign in to comment.