mirror of https://github.com/apache/lucene.git
SOLR-6072: The 'deletereplica' API should remove the data and instance directory by default
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1605993 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ac2e3998a3
commit
96b85b3970
|
@ -111,6 +111,9 @@ Bug Fixes
|
|||
* SOLR-6206: The migrate collection API fails on retry if temp collection already exists.
|
||||
(shalin)
|
||||
|
||||
* SOLR-6072: The 'deletereplica' API should remove the data and instance directory by default.
|
||||
(shalin)
|
||||
|
||||
Other Changes
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -863,7 +863,9 @@ public class OverseerCollectionProcessor implements Runnable, ClosableThread {
|
|||
|
||||
// assume the core exists and try to unload it
|
||||
Map m = ZkNodeProps.makeMap("qt", adminPath, CoreAdminParams.ACTION,
|
||||
CoreAdminAction.UNLOAD.toString(), CoreAdminParams.CORE, core);
|
||||
CoreAdminAction.UNLOAD.toString(), CoreAdminParams.CORE, core,
|
||||
CoreAdminParams.DELETE_INSTANCE_DIR, "true",
|
||||
CoreAdminParams.DELETE_DATA_DIR, "true");
|
||||
|
||||
ShardRequest sreq = new ShardRequest();
|
||||
sreq.purpose = 1;
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.apache.solr.cloud.OverseerCollectionProcessor.NUM_SLICES;
|
|||
import static org.apache.solr.cloud.OverseerCollectionProcessor.REPLICATION_FACTOR;
|
||||
import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -31,12 +32,16 @@ import java.util.Map;
|
|||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrServer;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
import org.apache.solr.client.solrj.request.CoreAdminRequest;
|
||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||
import org.apache.solr.client.solrj.response.CoreAdminResponse;
|
||||
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.params.MapSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -104,8 +109,20 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
|
|||
}
|
||||
|
||||
if (replica1 == null) fail("no active replicas found");
|
||||
|
||||
HttpSolrServer replica1Server = new HttpSolrServer(replica1.getStr("base_url"));
|
||||
String dataDir = null;
|
||||
try {
|
||||
CoreAdminResponse status = CoreAdminRequest.getStatus(replica1.getStr("core"), replica1Server);
|
||||
NamedList<Object> coreStatus = status.getCoreStatus(replica1.getStr("core"));
|
||||
dataDir = (String) coreStatus.get("dataDir");
|
||||
} finally {
|
||||
replica1Server.shutdown();
|
||||
}
|
||||
|
||||
removeAndWaitForReplicaGone(collectionName, client, replica1,
|
||||
shard1.getName());
|
||||
assertFalse("dataDir for " + replica1.getName() + " should have been deleted by deleteReplica API", new File(dataDir).exists());
|
||||
} finally {
|
||||
client.shutdown();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue