mirror of https://github.com/apache/lucene.git
Fixed merge problems to make the branch as close to master as possible
This commit is contained in:
parent
fb7803d9a0
commit
b499f5aac2
|
@ -566,7 +566,7 @@ public class ZkController {
|
|||
* this data is retrieved from ZK on each call.
|
||||
*/
|
||||
public AutoScalingConfig getAutoScalingConfig() throws KeeperException, InterruptedException {
|
||||
Map<String, Object> jsonMap = zkClient.getJson(ZkStateReader.SOLR_AUTOSCALING_CONF_PATH, true);
|
||||
Map<String, Object> jsonMap = Utils.getJson(zkClient, ZkStateReader.SOLR_AUTOSCALING_CONF_PATH, true);
|
||||
return new AutoScalingConfig(jsonMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ import org.apache.solr.schema.FieldType;
|
|||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.schema.SchemaField;
|
||||
import org.apache.solr.search.DocList;
|
||||
import org.apache.solr.search.SolrDocumentFetcher;
|
||||
import org.apache.solr.search.QParser;
|
||||
import org.apache.solr.search.ReturnFields;
|
||||
import org.apache.solr.search.SolrDocumentFetcher;
|
||||
|
@ -88,10 +87,6 @@ import org.apache.solr.util.RefCounted;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.common.params.CommonParams.DISTRIB;
|
||||
import static org.apache.solr.common.params.CommonParams.ID;
|
||||
import static org.apache.solr.common.params.CommonParams.VERSION_FIELD;
|
||||
|
||||
public class RealTimeGetComponent extends SearchComponent
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
|
|
@ -114,10 +114,6 @@ public class SolrGangliaReporter extends SolrMetricReporter {
|
|||
|
||||
@Override
|
||||
protected void validate() throws IllegalStateException {
|
||||
if (!enabled) {
|
||||
log.info("Reporter disabled for registry " + registryName);
|
||||
return;
|
||||
}
|
||||
if (host == null) {
|
||||
throw new IllegalStateException("Init argument 'host' must be set to a valid Ganglia server name.");
|
||||
}
|
||||
|
|
|
@ -25,14 +25,10 @@ import java.util.List;
|
|||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.DocValuesType;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
import org.apache.lucene.index.IndexableField;
|
||||
import org.apache.lucene.index.LeafReader;
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.apache.lucene.index.MultiFields;
|
||||
import org.apache.lucene.index.NumericDocValues;
|
||||
import org.apache.lucene.index.SortedDocValues;
|
||||
import org.apache.lucene.queries.function.FunctionValues;
|
||||
|
@ -155,74 +151,6 @@ public class DocValuesTest extends SolrTestCaseJ4 {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void testHalfAndHalfDocValues() throws Exception {
|
||||
// Insert two docs without docvalues
|
||||
String fieldname = "string_add_dv_later";
|
||||
assertU(adoc("id", "3", fieldname, "c"));
|
||||
assertU(commit());
|
||||
assertU(adoc("id", "1", fieldname, "a"));
|
||||
assertU(commit());
|
||||
|
||||
|
||||
try (SolrCore core = h.getCoreInc()) {
|
||||
assertFalse(core.getLatestSchema().getField(fieldname).hasDocValues());
|
||||
// Add docvalues to the field type
|
||||
IndexSchema schema = core.getLatestSchema();
|
||||
SchemaField oldField = schema.getField(fieldname);
|
||||
int newProperties = oldField.getProperties() | SchemaField.DOC_VALUES;
|
||||
|
||||
SchemaField sf = new SchemaField( fieldname, oldField.getType(), newProperties, null);
|
||||
schema.getFields().put( fieldname, sf );
|
||||
|
||||
// Insert a new doc with docvalues
|
||||
assertU(adoc("id", "2", fieldname, "b"));
|
||||
assertU(commit());
|
||||
|
||||
|
||||
// Check there are a mix of segments with and without docvalues
|
||||
final RefCounted<SolrIndexSearcher> searcherRef = core.openNewSearcher(true, true);
|
||||
final SolrIndexSearcher searcher = searcherRef.get();
|
||||
try {
|
||||
final DirectoryReader topReader = searcher.getRawReader();
|
||||
|
||||
//Assert no merges
|
||||
|
||||
assertEquals(3, topReader.numDocs());
|
||||
assertEquals(3, topReader.leaves().size());
|
||||
|
||||
final FieldInfos infos = MultiFields.getMergedFieldInfos(topReader);
|
||||
//The global field type should have docValues because a document with dvs was added
|
||||
assertEquals(DocValuesType.SORTED, infos.fieldInfo(fieldname).getDocValuesType());
|
||||
|
||||
for(LeafReaderContext ctx: topReader.leaves()) {
|
||||
LeafReader r = ctx.reader();
|
||||
//Make sure there were no merges
|
||||
assertEquals(1, r.numDocs());
|
||||
Document doc = r.document(0);
|
||||
String id = doc.getField("id").stringValue();
|
||||
|
||||
if(id.equals("1") || id.equals("3")) {
|
||||
assertEquals(DocValuesType.NONE, r.getFieldInfos().fieldInfo(fieldname).getDocValuesType());
|
||||
} else {
|
||||
assertEquals(DocValuesType.SORTED, r.getFieldInfos().fieldInfo(fieldname).getDocValuesType());
|
||||
}
|
||||
|
||||
}
|
||||
} finally {
|
||||
searcherRef.decref();
|
||||
}
|
||||
}
|
||||
|
||||
// Assert sort order is correct
|
||||
assertQ(req("q", "string_add_dv_later:*", "sort", "string_add_dv_later asc"),
|
||||
"//*[@numFound='3']",
|
||||
"//result/doc[1]/int[@name='id'][.=1]",
|
||||
"//result/doc[2]/int[@name='id'][.=2]",
|
||||
"//result/doc[3]/int[@name='id'][.=3]"
|
||||
);
|
||||
}
|
||||
|
||||
private void tstToObj(SchemaField sf, Object o) {
|
||||
List<IndexableField> fields = sf.createFields(o);
|
||||
for (IndexableField field : fields) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import com.codahale.metrics.Gauge;
|
|||
import com.codahale.metrics.Meter;
|
||||
import com.codahale.metrics.Metric;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.TieredMergePolicy;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.lang.invoke.MethodHandles;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -45,7 +44,6 @@ import org.apache.solr.common.cloud.ZkClientConnectionStrategy.ZkUpdate;
|
|||
import org.apache.solr.common.util.ExecutorUtil;
|
||||
import org.apache.solr.common.util.ObjectReleaseTracker;
|
||||
import org.apache.solr.common.util.SolrjNamedThreadFactory;
|
||||
import org.apache.solr.common.util.Utils;
|
||||
import org.apache.zookeeper.CreateMode;
|
||||
import org.apache.zookeeper.KeeperException;
|
||||
import org.apache.zookeeper.KeeperException.NoNodeException;
|
||||
|
@ -364,19 +362,6 @@ public class SolrZkClient implements Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> getJson(String path, boolean retryOnConnLoss) throws KeeperException, InterruptedException {
|
||||
byte[] bytes = null;
|
||||
try {
|
||||
bytes = getData(path, null, null, retryOnConnLoss);
|
||||
} catch (KeeperException.NoNodeException e) {
|
||||
return null;
|
||||
}
|
||||
if (bytes != null && bytes.length > 0) {
|
||||
return (Map<String, Object>) Utils.fromJSON(bytes);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns node's state
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.http.NoHttpResponseException;
|
|||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.client.solrj.request.UpdateRequest;
|
||||
import org.apache.solr.common.cloud.ClusterState;
|
||||
import org.apache.solr.common.cloud.ClusterState.CollectionRef;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
@ -122,7 +121,7 @@ public class CloudSolrClientCacheTest extends SolrTestCaseJ4 {
|
|||
Map<String, ClusterState.CollectionRef> colls) {
|
||||
return new ClusterStateProvider() {
|
||||
@Override
|
||||
public CollectionRef getState(String collection) {
|
||||
public ClusterState.CollectionRef getState(String collection) {
|
||||
return colls.get(collection);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue