Skip to content

Commit ea16f02

Browse files
committed
Merge branch 'master' into translog-no-ops
* master: Simplify Unicast Zen Ping (elastic#22277) Replace IndicesQueriesRegistry (elastic#22289) Fixed document mistake and fit for 5.1.1 API [TEST] improve error message in ESTestCase#assertWarnings [TEST] remove deleted test classes from checkstyle suppressions [TEST] make ESSingleNodeTestCase tests repeatable (elastic#22283) Link for setting page in elasticsearch.yml is outdated Factor out sort values from InternalSearchHit (elastic#22080) Add ID for percolate query to Java API docs x_refresh.yaml tests should use unique index names and doc ids to ease debugging IndicesStoreIntegrationIT should not use start recovery sending as an indication that the recovery started Added base class for testing aggregators and some initial tests for `terms`, `top_hits` and `min` aggregations. Add link to foreach processor to ingest-attachment.asciidoc
2 parents 0546377 + 0e9186e commit ea16f02

File tree

107 files changed

+1859
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+1859
-1110
lines changed

buildSrc/src/main/resources/checkstyle_suppressions.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,6 @@
590590
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TermVectorsUnitTests.java" checks="LineLength" />
591591
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]aliases[/\\]IndexAliasesIT.java" checks="LineLength" />
592592
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]bootstrap[/\\]JarHellTests.java" checks="LineLength" />
593-
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]bwcompat[/\\]BasicAnalysisBackwardCompatibilityIT.java" checks="LineLength" />
594-
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]bwcompat[/\\]BasicBackwardsCompatibilityIT.java" checks="LineLength" />
595-
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]bwcompat[/\\]GetIndexBackwardsCompatibilityIT.java" checks="LineLength" />
596593
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]bwcompat[/\\]RestoreBackwardsCompatIT.java" checks="LineLength" />
597594
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]client[/\\]AbstractClientHeadersTestCase.java" checks="LineLength" />
598595
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]cluster[/\\]ClusterHealthIT.java" checks="LineLength" />
@@ -704,7 +701,6 @@
704701
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]PriorityComparatorTests.java" checks="LineLength" />
705702
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]QuorumGatewayIT.java" checks="LineLength" />
706703
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]RecoverAfterNodesIT.java" checks="LineLength" />
707-
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]RecoveryBackwardsCompatibilityIT.java" checks="LineLength" />
708704
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]RecoveryFromGatewayIT.java" checks="LineLength" />
709705
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]ReplicaShardAllocatorTests.java" checks="LineLength" />
710706
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]gateway[/\\]ReusePeerRecoverySharedTest.java" checks="LineLength" />
@@ -923,7 +919,6 @@
923919
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]snapshots[/\\]DedicatedClusterSnapshotRestoreIT.java" checks="LineLength" />
924920
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]snapshots[/\\]RepositoriesIT.java" checks="LineLength" />
925921
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]snapshots[/\\]SharedClusterSnapshotRestoreIT.java" checks="LineLength" />
926-
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]snapshots[/\\]SnapshotBackwardsCompatibilityIT.java" checks="LineLength" />
927922
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]snapshots[/\\]SnapshotUtilsTests.java" checks="LineLength" />
928923
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]ESBlobStoreRepositoryIntegTestCase.java" checks="LineLength" />
929924
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]geo[/\\]RandomShapeGenerator.java" checks="LineLength" />
@@ -993,13 +988,8 @@
993988
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]MockBigArrays.java" checks="LineLength" />
994989
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]bucket[/\\]script[/\\]NativeSignificanceScoreScriptWithParams.java" checks="LineLength" />
995990
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]BackgroundIndexer.java" checks="LineLength" />
996-
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]CompositeTestCluster.java" checks="LineLength" />
997991
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]CorruptionUtils.java" checks="LineLength" />
998-
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]ESBackcompatTestCase.java" checks="LineLength" />
999992
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]ESIntegTestCase.java" checks="LineLength" />
1000-
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]ESSingleNodeTestCase.java" checks="LineLength" />
1001-
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]ESTestCase.java" checks="LineLength" />
1002-
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]ExternalNode.java" checks="LineLength" />
1003993
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]IndexSettingsModule.java" checks="LineLength" />
1004994
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]InternalTestCluster.java" checks="LineLength" />
1005995
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]MockIndexEventListener.java" checks="LineLength" />

core/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,21 @@ final class TransportClientNodesService extends AbstractComponent implements Clo
101101

102102
private final TransportClient.HostFailureListener hostFailureListener;
103103

104+
// TODO: migrate this to use low level connections and single type channels
105+
/** {@link ConnectionProfile} to use when to connecting to the listed nodes and doing a liveness check */
106+
private static final ConnectionProfile LISTED_NODES_PROFILE;
107+
108+
static {
109+
ConnectionProfile.Builder builder = new ConnectionProfile.Builder();
110+
builder.addConnections(1,
111+
TransportRequestOptions.Type.BULK,
112+
TransportRequestOptions.Type.PING,
113+
TransportRequestOptions.Type.RECOVERY,
114+
TransportRequestOptions.Type.REG,
115+
TransportRequestOptions.Type.STATE);
116+
LISTED_NODES_PROFILE = builder.build();
117+
}
118+
104119
TransportClientNodesService(Settings settings, TransportService transportService,
105120
ThreadPool threadPool, TransportClient.HostFailureListener hostFailureListener) {
106121
super(settings);
@@ -389,8 +404,8 @@ protected void doSample() {
389404
if (!transportService.nodeConnected(listedNode)) {
390405
try {
391406
// its a listed node, light connect to it...
392-
logger.trace("connecting to listed node (light) [{}]", listedNode);
393-
transportService.connectToNode(listedNode, ConnectionProfile.LIGHT_PROFILE);
407+
logger.trace("connecting to listed node [{}]", listedNode);
408+
transportService.connectToNode(listedNode, LISTED_NODES_PROFILE);
394409
} catch (Exception e) {
395410
logger.info(
396411
(Supplier<?>)
@@ -470,7 +485,7 @@ public void run() {
470485
} else {
471486
// its a listed node, light connect to it...
472487
logger.trace("connecting to listed node (light) [{}]", listedNode);
473-
transportService.connectToNode(listedNode, ConnectionProfile.LIGHT_PROFILE);
488+
transportService.connectToNode(listedNode, LISTED_NODES_PROFILE);
474489
}
475490
} catch (Exception e) {
476491
logger.debug(

core/src/main/java/org/elasticsearch/common/xcontent/XContentParserUtils.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.elasticsearch.common.ParsingException;
2323
import org.elasticsearch.common.xcontent.XContentParser.Token;
2424

25+
import java.io.IOException;
2526
import java.util.Locale;
2627
import java.util.function.Supplier;
2728

@@ -34,6 +35,19 @@ public final class XContentParserUtils {
3435
private XContentParserUtils() {
3536
}
3637

38+
/**
39+
* Makes sure that current token is of type {@link XContentParser.Token#FIELD_NAME} and the the field name is equal to the provided one
40+
* @throws ParsingException if the token is not of type {@link XContentParser.Token#FIELD_NAME} or is not equal to the given field name
41+
*/
42+
public static void ensureFieldName(XContentParser parser, Token token, String fieldName) throws IOException {
43+
ensureExpectedToken(Token.FIELD_NAME, token, parser::getTokenLocation);
44+
String currentName = parser.currentName();
45+
if (currentName.equals(fieldName) == false) {
46+
String message = "Failed to parse object: expecting field with name [%s] but found [%s]";
47+
throw new ParsingException(parser.getTokenLocation(), String.format(Locale.ROOT, message, fieldName, currentName));
48+
}
49+
}
50+
3751
/**
3852
* @throws ParsingException with a "unknown field found" reason
3953
*/

core/src/main/java/org/elasticsearch/discovery/zen/ElectMasterService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.cluster.ClusterState;
2525
import org.elasticsearch.cluster.node.DiscoveryNode;
2626
import org.elasticsearch.common.component.AbstractComponent;
27-
import org.elasticsearch.common.inject.Inject;
2827
import org.elasticsearch.common.settings.Setting;
2928
import org.elasticsearch.common.settings.Setting.Property;
3029
import org.elasticsearch.common.settings.Settings;
@@ -174,7 +173,7 @@ public void logMinimumMasterNodesWarningIfNecessary(ClusterState oldState, Clust
174173
* Returns the given nodes sorted by likelihood of being elected as master, most likely first.
175174
* Non-master nodes are not removed but are rather put in the end
176175
*/
177-
public static List<DiscoveryNode> sortByMasterLikelihood(Iterable<DiscoveryNode> nodes) {
176+
static List<DiscoveryNode> sortByMasterLikelihood(Iterable<DiscoveryNode> nodes) {
178177
ArrayList<DiscoveryNode> sortedNodes = CollectionUtils.iterableAsArrayList(nodes);
179178
CollectionUtil.introSort(sortedNodes, ElectMasterService::compareNodes);
180179
return sortedNodes;

0 commit comments

Comments
 (0)