Apache Lucene open-source search software
Merge branch 'master' into feature/autoscaling
Shalin Shekhar Mangar1f6a94551f01
diff --cc solr/CHANGES.txtindex cc759a9d881,3adc0a2eb0c..388d5dcdabe--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@@ -52,26 -52,19 +52,30 @@@ Detailed Change LisUpgrade Notes-----------------------(No Notes)+* 'autoAddReplicas' feature is ported to autoscaling framework. Existing users of this feature should not have+ to change anything. Note these changes:+ 1. Behaviour: Changing the autoAddReplicas property from disabled to enabled using MODIFYCOLLECTION API+ no longer replaces down replicas for the collection immediately. Instead, replicas are only added+ if a node containing them went down while autoAddReplicas was enabled. The params+ autoReplicaFailoverBadNodeExpiration and autoReplicaFailoverWorkLoopDelay are no longer used.- 2. Deprecations: Enabling/disabling autoAddReplicas cluster wide with the API will be deprecated; use++ 2. Deprecations: Enabling/disabling autoAddReplicas cluster wide with the API will be deprecated; use+ suspend/resume trigger APIs with name='.auto_add_replicas' instead.New Features----------------------* SOLR-11019: Add addAll Stream Evaluator (Joel Bernstein)+* SOLR-10996: Implement TriggerListener API (ab, shalin)+* SOLR-11046: Add residuals Stream Evaluator (Joel Bernstein)+ * SOLR-10858: Make UUIDUpdateProcessorFactory as Runtime URP (Amit Sarkar, noble)++ * SOLR-11126: Node level health check handler (Anshum Gupta)++* SOLR-11031: Implement SystemLogListener for autoscaling (ab)+Bug Fixes----------------------@@@ -82,13 -75,14 +86,19 @@@* SOLR-11012: Fix three (JavaBinCodec not being closed) Resource Leak warnings. (Christine Poerschke)+* SOLR-11026: MoveReplicaSuggester must check if the target becomes more 'loaded' than the source+ if an operation is performed (noble)++* SOLR-10994: CREATE, CREATESHARD & ADDREPLICA to use policy framework & support replica types (noble)+* SOLR-11011: Assign.buildCoreName can lead to error in creating a new core when legacyCloud=false (Cao Manh Dat)+ * SOLR-10944: Get expression fails to return EOF tuple (Susheel Kumar, Joel Bernstein)++ * SOLR-6086: Replica is active during autowarming resulting in queries being sent to a replica that+ may not have a registered searcher. This causes spikes in response times when adding a replica+ in busy clusters. (Ludovic Boutros, Timothy Potter, shalin)+Optimizations----------------------@@@ -130,11 -122,11 +140,16 @@@ Other Change* SOLR-11131: Document 'assert' as a command option in bin/solr, and bin/solr.cmd scripts.(Jason Gerlowski via Anshum Gupta)+ * SOLR-11140: Remove unused parameter in (private) SolrMetricManager.prepareCloudPlugins method.+ (Omar Abdelnabi via Christine Poerschke)++ * SOLR-11187: contrib/ltr TestModelManagerPersistence improvements. (Yuki Yano via Christine Poerschke)++* SOLR-10397: Port 'autoAddReplicas' feature to the autoscaling framework and make it work with non-shared filesystems+ (Cao Manh Dat, shalin)++* SOLR-11157: remove-policy must fail if a policy to be deleted is used by a collection (noble)+================== 7.0.0 ==================Versions of Major Components@@@ -343,18 -332,20 +365,26 @@@ New FeatureThis also solves issues SOLR-8495, SOLR-6966, and SOLR-7058(janhoy, Steve Rowe, hossman, Alexandre Rafalovich, Shawn Heisey, Cao Manh Dat)-* SOLR-10123: Upgraded the Analytics Component to version 2.0 which now supports distributed collections, expressions over- multivalued fields, a new JSON request language, and more. DocValues are now required for any field used in the analytics+* SOLR-10123: Upgraded the Analytics Component to version 2.0 which now supports distributed collections, expressions over+ multivalued fields, a new JSON request language, and more. DocValues are now required for any field used in the analyticsexpression whereas previously docValues was not required. Please see SOLR-10123 for details. (Houston Putman)+* SOLR-10496: New ComputePlanAction for autoscaling which uses the policy framework to compute cluster+ operations upon a trigger fire. (Noble Paul, shalin)++* SOLR-10965: New ExecutePlanAction for autoscaling which executes the operations computed by ComputePlanAction+ against the cluster. (shalin)+* SOLR-10282: bin/solr support for enabling Kerberos authentication (Ishan Chattopadhyaya, Jason Gerlowski)+ * SOLR-11093: Add support for PointFields for {!graph} query. (yonik)++ * SOLR-10845: Add support for PointFields to {!graphTerms} query that is internally+ used by some graph traversal streaming expressions. (yonik)++ * SOLR-10939: Add support for PointsFields to {!join} query. Joined fields should+ also have docValues enabled. (yonik)+Bug Fixes----------------------* SOLR-9262: Connection and read timeouts are being ignored by UpdateShardHandler after SOLR-4509.@@@ -431,6 -415,22 +461,22 @@@* SOLR-11136: Fix solrj XMLResponseParser when nested docs transformer is used with indented XML (hossman)+ * SOLR-11130: V2Request in SolrJ should return the correct collection name so that the request is forwarded to the+ correct node (noble)-+++ * SOLR-11151: SolrInfoMBeanHandler.getDiff() ADD case non-functional: NPE when a bean value goes from null -> non-null.+ (Steve Rowe)++ * SOLR-11154: Child documents' return fields now include useDocValuesAsStored fields (Mohammed Sheeri Shaketi Nauage via+ Ishan Chattopadhyaya)++ * SOLR-11163: Fix contrib/ltr Normalizer persistence after solr core reload or restart.+ (Yuki Yano via Christine Poerschke)++ * SOLR-11182: A split shard failure on IOException should be logged (Varun Thacker)++ * SOLR-10353: TestSQLHandler reproducible failure: No match found for function signature min(<NUMERIC>) (Kevin Risden)+Optimizations----------------------@@@ -595,6 -596,44 +644,44 @@@ Other Change* SOLR-10494: Make default response format JSON (wt=json), and also indent text responses formats(indent=on) by default (Trey Grainger & Cassandra Targett via hossman)+ * SOLR-10760: Remove trie field types and fields from example schemas. (Steve Rowe)++ * SOLR-11056: Add random range query test that compares results across Trie*, *Point and DocValue-only fields+ (Tomás Fernández Löbbe)++ * SOLR-10926: Increase the odds of randomly choosing point fields in our SolrTestCaseJ4 numeric type randomization.+ (hossman, Steve Rowe)-+++ * SOLR-10846: ExternalFileField/FloatFieldSource should throw a clear exception on initialization with+ a Points-based keyField, which is not supported. (hossman, Steve Rowe)-+++ * SOLR-11155: /analysis/field and /analysis/document requests should support points fields.+ (Jason Gerlowski, Steve Rowe)-+++ * SOLR-10756: Undeprecate ZkStateReader.updateClusterState(), mark as @lucene.internal, and rename to+ forciblyRefreshAllClusterStateSlow(). (hossman, shalin, Steve Rowe)++ * SOLR-11036: Separately report disk space metrics for solr.data.home and core root directory. (ab)++ * SOLR-10919: ord & rord functions give confusing errors with PointFields. (hossman, Steve Rowe)++ * SOLR-10847: Provide a clear exception when attempting to use the terms component with points fields.+ (hossman, Steve Rowe)++ * SOLR-9321: Remove deprecated methods of ClusterState. (Jason Gerlowski, ishan, Cao Manh Dat)++ * SOLR-10033: When attempting to facet with facet.mincount=0 over points fields, raise mincount to 1+ and log a warning. (Steve Rowe)++ * SOLR-11178: Change error handling in AutoScalingHandler to be consistent w/ other APIs (noble)++ * SOLR-11023: Added EnumFieldType, a non-Trie-based version of EnumField, and deprecated EnumField+ in favor of EnumFieldType. (hossman, Steve Rowe)-+++ * SOLR-10803: Mark all Trie/LegacyNumeric based fields @deprecated in Solr7. (Steve Rowe)++ * SOLR-10821: Ref guide documentation for Autoscaling (Noble Paul, Cassandra Targett, shalin)+================== 6.7.0 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.diff --cc solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.javaindex b16e9b46635,5ed5f8ef8e3..686a0e59d96--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/AutoScalingHandler.java@@@ -243,72 -165,56 +243,77 @@@ public class AutoScalingHandler extend}}- private void handleSetClusterPolicy(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op) throws KeeperException, InterruptedException, IOException {- List clusterPolicy = (List) op.getCommandData();+ private AutoScalingConfig handleSetClusterPolicy(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op,+ AutoScalingConfig currentConfig) throws KeeperException, InterruptedException, IOException {+ List<Map<String, Object>> clusterPolicy = (List<Map<String, Object>>) op.getCommandData();if (clusterPolicy == null || !(clusterPolicy instanceof List)) {- op.addError("A list of cluster policies was not found");- checkErr(op);+ op.addError("set-cluster-policy expects an array of objects");+ return currentConfig;}-+ List<Clause> cp = null;try {- zkSetClusterPolicy(container.getZkController().getZkStateReader(), clusterPolicy);+ cp = clusterPolicy.stream().map(Clause::new).collect(Collectors.toList());} catch (Exception e) {- log.warn("error persisting policies");op.addError(e.getMessage());- checkErr(op);-+ return currentConfig;}- rsp.getValues().add("result", "success");+ Policy p = currentConfig.getPolicy().withClusterPolicy(cp);+ currentConfig = currentConfig.withPolicy(p);+ return currentConfig;}+ private void checkErr(CommandOperation op) {+ if (!op.hasError()) return;+ throw new ApiBag.ExceptionWithErrObject(SolrException.ErrorCode.BAD_REQUEST, "Error in command payload", CommandOperation.captureErrors(Collections.singletonList(op)));+ }+- private void handleSetClusterPreferences(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op) throws KeeperException, InterruptedException, IOException {- List preferences = (List) op.getCommandData();+ private AutoScalingConfig handleSetClusterPreferences(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op,+ AutoScalingConfig currentConfig) throws KeeperException, InterruptedException, IOException {+ List<Map<String, Object>> preferences = (List<Map<String, Object>>) op.getCommandData();if (preferences == null || !(preferences instanceof List)) {op.addError("A list of cluster preferences not found");- checkErr(op);+ return currentConfig;}- zkSetPreferences(container.getZkController().getZkStateReader(), preferences);- rsp.getValues().add("result", "success");+ List<Preference> prefs = null;+ try {+ prefs = preferences.stream().map(Preference::new).collect(Collectors.toList());+ } catch (Exception e) {+ op.addError(e.getMessage());+ return currentConfig;+ }+ Policy p = currentConfig.getPolicy().withClusterPreferences(prefs);+ currentConfig = currentConfig.withPolicy(p);+ return currentConfig;}- private void handleRemovePolicy(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op) throws KeeperException, InterruptedException, IOException {- String policyName = (String) op.getCommandData();+ private AutoScalingConfig handleRemovePolicy(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op,+ AutoScalingConfig currentConfig) throws KeeperException, InterruptedException, IOException {+ String policyName = (String) op.getVal("");- if (op.hasError()) checkErr(op);- Map<String, Object> autoScalingConf = zkReadAutoScalingConf(container.getZkController().getZkStateReader());- Map<String, Object> policies = (Map<String, Object>) autoScalingConf.get("policies");+ if (op.hasError()) return currentConfig;++ Map<String, List<Clause>> policies = currentConfig.getPolicy().getPolicies();if (policies == null || !policies.containsKey(policyName)) {op.addError("No policy exists with name: " + policyName);+ return currentConfig;}- checkErr(op);- zkSetPolicies(container.getZkController().getZkStateReader(), policyName, null);- rsp.getValues().add("result", "success");++ container.getZkController().getZkStateReader().getClusterState().forEachCollection(coll -> {+ if (policyName.equals(coll.getPolicyName()))+ op.addError(StrUtils.formatString("policy : {0} is being used by collection {1}", policyName, coll.getName()));+ });+ if (op.hasError()) return currentConfig;+ policies = new HashMap<>(policies);+ policies.remove(policyName);+ Policy p = currentConfig.getPolicy().withPolicies(policies);+ currentConfig = currentConfig.withPolicy(p);+ return currentConfig;}- private void handleSetPolicies(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op) throws KeeperException, InterruptedException, IOException {- Map<String, Object> policies = op.getDataMap();- for (Map.Entry<String, Object> policy : policies.entrySet()) {+ private AutoScalingConfig handleSetPolicies(SolrQueryRequest req, SolrQueryResponse rsp, CommandOperation op,+ AutoScalingConfig currentConfig) throws KeeperException, InterruptedException, IOException {+ Map<String, Object> policiesMap = op.getDataMap();+ for (Map.Entry<String, Object> policy : policiesMap.entrySet()) {String policyName = policy.getKey();if (policyName == null || policyName.trim().length() == 0) {op.addError("The policy name cannot be null or empty");diff --cc solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.javaindex 49f9b11fa2d,02d7c1a61ed..43526b8e5d5--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java@@@ -498,9 -498,9 +498,8 @@@ public class HttpSolrClient extends Solthrow new SolrServerException("Unsupported method: " + request.getMethod());}--private static final List<String> errPath = Arrays.asList("metadata", "error-class");//Utils.getObjectByPath(err, false,"metadata/error-class")-+protected NamedList<Object> executeMethod(HttpRequestBase method, final ResponseParser processor, final boolean isV2Api) throws SolrServerException {method.addHeader("User-Agent", AGENT);