mirror of https://github.com/apache/lucene.git
SOLR-11889: Reset disk space when deleting collections. Use constants.
This commit is contained in:
parent
1d5381511c
commit
19474d9df9
|
@ -107,6 +107,8 @@ public class SimCloudManager implements SolrCloudManager {
|
|||
private SolrResourceLoader loader;
|
||||
|
||||
private static int nodeIdPort = 10000;
|
||||
public static int DEFAULT_DISK = 1000; // 1000 GB
|
||||
public static int DEFAULT_IDX_SIZE_BYTES = 1000000000; // 1 GB
|
||||
|
||||
/**
|
||||
* Create a simulated cluster. This cluster uses the following components:
|
||||
|
@ -227,7 +229,7 @@ public class SimCloudManager implements SolrCloudManager {
|
|||
values.put(ImplicitSnitch.PORT, port);
|
||||
values.put(ImplicitSnitch.NODE, nodeId);
|
||||
values.put(ImplicitSnitch.CORES, 0);
|
||||
values.put(ImplicitSnitch.DISK, 1000);
|
||||
values.put(ImplicitSnitch.DISK, DEFAULT_DISK);
|
||||
values.put(ImplicitSnitch.SYSLOADAVG, 1.0);
|
||||
values.put(ImplicitSnitch.HEAPUSAGE, 123450000);
|
||||
values.put("sysprop.java.version", System.getProperty("java.version"));
|
||||
|
|
|
@ -397,7 +397,7 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
|||
// mark replica as active
|
||||
replicaInfo.getVariables().put(ZkStateReader.STATE_PROP, Replica.State.ACTIVE.toString());
|
||||
// add a property expected in tests
|
||||
replicaInfo.getVariables().put(Suggestion.coreidxsize, 123450000);
|
||||
replicaInfo.getVariables().put(Suggestion.coreidxsize, SimCloudManager.DEFAULT_IDX_SIZE_BYTES);
|
||||
|
||||
replicas.add(replicaInfo);
|
||||
// at this point nuke our cached DocCollection state
|
||||
|
@ -414,9 +414,9 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
|||
cloudManager.getSimNodeStateProvider().simSetNodeValue(nodeId, ImplicitSnitch.CORES, cores + 1);
|
||||
Integer disk = (Integer)values.get(ImplicitSnitch.DISK);
|
||||
if (disk == null) {
|
||||
disk = 1000;
|
||||
disk = SimCloudManager.DEFAULT_DISK;
|
||||
}
|
||||
cloudManager.getSimNodeStateProvider().simSetNodeValue(nodeId, ImplicitSnitch.DISK, disk - 10);
|
||||
cloudManager.getSimNodeStateProvider().simSetNodeValue(nodeId, ImplicitSnitch.DISK, disk - 1);
|
||||
if (runLeaderElection) {
|
||||
simRunLeaderElection(Collections.singleton(replicaInfo.getCollection()), true);
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
|||
if (disk == null || disk == 0) {
|
||||
throw new Exception("Unexpected value of 'freedisk' (" + disk + ") on node: " + nodeId);
|
||||
}
|
||||
cloudManager.getSimNodeStateProvider().simSetNodeValue(nodeId, ImplicitSnitch.DISK, disk + 10);
|
||||
cloudManager.getSimNodeStateProvider().simSetNodeValue(nodeId, ImplicitSnitch.DISK, disk + 1);
|
||||
}
|
||||
LOG.trace("-- simRemoveReplica {}", ri);
|
||||
simRunLeaderElection(Collections.singleton(ri.getCollection()), true);
|
||||
|
@ -725,7 +725,10 @@ public class SimClusterStateProvider implements ClusterStateProvider {
|
|||
collProperties.clear();
|
||||
sliceProperties.clear();
|
||||
leaderThrottles.clear();
|
||||
cloudManager.getSimNodeStateProvider().simGetAllNodeValues().forEach((n, values) -> values.put("cores", 0));
|
||||
cloudManager.getSimNodeStateProvider().simGetAllNodeValues().forEach((n, values) -> {
|
||||
values.put(ImplicitSnitch.CORES, 0);
|
||||
values.put(ImplicitSnitch.DISK, 1000);
|
||||
});
|
||||
collectionsStatesRef.set(null);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
|
|
Loading…
Reference in New Issue