|
47 | 47 | import java.util.List; |
48 | 48 | import java.util.Map; |
49 | 49 | import java.util.Objects; |
50 | | -import java.util.Optional; |
51 | 50 | import java.util.Set; |
52 | 51 | import java.util.concurrent.TimeUnit; |
53 | 52 | import java.util.concurrent.TimeoutException; |
|
74 | 73 | import org.apache.solr.common.SolrException.ErrorCode; |
75 | 74 | import org.apache.solr.common.SolrInputDocument; |
76 | 75 | import org.apache.solr.common.cloud.DocCollection; |
77 | | -import org.apache.solr.common.cloud.Replica; |
78 | 76 | import org.apache.solr.common.cloud.SolrZkClient; |
79 | 77 | import org.apache.solr.common.cloud.ZkMaintenanceUtils; |
80 | 78 | import org.apache.solr.common.cloud.ZkStateReader; |
@@ -536,29 +534,6 @@ static byte[] readAllBytes(IOSupplier<InputStream> hasStream) throws IOException |
536 | 534 | } |
537 | 535 | } |
538 | 536 |
|
539 | | - private String getBaseUrl(final String collection) { |
540 | | - String baseUrl = null; |
541 | | - try { |
542 | | - Set<String> liveNodes = zkStateReader().getClusterState().getLiveNodes(); |
543 | | - DocCollection docColl = zkStateReader().getCollection(collection); |
544 | | - if (docColl != null && !liveNodes.isEmpty()) { |
545 | | - Optional<Replica> maybeActive = |
546 | | - docColl.getReplicas().stream().filter(r -> r.isActive(liveNodes)).findAny(); |
547 | | - if (maybeActive.isPresent()) { |
548 | | - baseUrl = maybeActive.get().getBaseUrl(); |
549 | | - } |
550 | | - } |
551 | | - } catch (Exception exc) { |
552 | | - log.warn("Failed to lookup base URL for collection {}", collection, exc); |
553 | | - } |
554 | | - |
555 | | - if (baseUrl == null) { |
556 | | - baseUrl = zkStateReader().getBaseUrlForNodeName(cc.getZkController().getNodeName()); |
557 | | - } |
558 | | - |
559 | | - return baseUrl; |
560 | | - } |
561 | | - |
562 | 537 | protected String getManagedSchemaZkPath(final String configSet) { |
563 | 538 | return getConfigSetZkPath(configSet, DEFAULT_MANAGED_SCHEMA_RESOURCE_NAME); |
564 | 539 | } |
@@ -819,8 +794,8 @@ protected ManagedIndexSchema removeLanguageSpecificObjectsAndFiles( |
819 | 794 | final Set<String> toRemove = |
820 | 795 | types.values().stream() |
821 | 796 | .filter(this::isTextType) |
822 | | - .filter(t -> !languages.contains(t.getTypeName().substring(TEXT_PREFIX_LEN))) |
823 | 797 | .map(FieldType::getTypeName) |
| 798 | + .filter(typeName -> !languages.contains(typeName.substring(TEXT_PREFIX_LEN))) |
824 | 799 | .filter(t -> !usedTypes.contains(t)) // not explicitly used by a field |
825 | 800 | .collect(Collectors.toSet()); |
826 | 801 |
|
@@ -961,9 +936,9 @@ protected ManagedIndexSchema restoreLanguageSpecificObjectsAndFiles( |
961 | 936 |
|
962 | 937 | List<SchemaField> addDynFields = |
963 | 938 | Arrays.stream(copyFromSchema.getDynamicFields()) |
964 | | - .filter(df -> langFieldTypeNames.contains(df.getPrototype().getType().getTypeName())) |
965 | | - .filter(df -> !existingDynFields.contains(df.getPrototype().getName())) |
966 | 939 | .map(IndexSchema.DynamicField::getPrototype) |
| 940 | + .filter(prototype -> langFieldTypeNames.contains(prototype.getType().getTypeName())) |
| 941 | + .filter(prototype -> !existingDynFields.contains(prototype.getName())) |
967 | 942 | .collect(Collectors.toList()); |
968 | 943 | if (!addDynFields.isEmpty()) { |
969 | 944 | schema = schema.addDynamicFields(addDynFields, null, false); |
@@ -1035,8 +1010,8 @@ protected ManagedIndexSchema restoreDynamicFields( |
1035 | 1010 | .collect(Collectors.toSet()); |
1036 | 1011 | List<SchemaField> toAdd = |
1037 | 1012 | Arrays.stream(dynamicFields) |
1038 | | - .filter(df -> !existingDFNames.contains(df.getPrototype().getName())) |
1039 | 1013 | .map(IndexSchema.DynamicField::getPrototype) |
| 1014 | + .filter(prototype -> !existingDFNames.contains(prototype.getName())) |
1040 | 1015 | .collect(Collectors.toList()); |
1041 | 1016 |
|
1042 | 1017 | // only restore language specific dynamic fields that match our langSet |
|
0 commit comments