"property [elasticsearch.version] is missing for plugin [" + name + "]"); final Version esVersion = Version.fromString(esVersionString); final String javaVersionString = propsMap.remove("java.version"); if (javaVersionString == null) {
private Version[] parseVersionRange(String versionRange) { if (versionRange == null) { return new Version[] { null, null }; } if (versionRange.trim().equals("all")) { return new Version[]{VersionUtils.getFirstVersion(), Version.CURRENT}; } String[] skipVersions = versionRange.split("-"); if (skipVersions.length > 2) { throw new IllegalArgumentException("version range malformed: " + versionRange); } String lower = skipVersions[0].trim(); String upper = skipVersions[1].trim(); return new Version[] { lower.isEmpty() ? VersionUtils.getFirstVersion() : Version.fromString(lower), upper.isEmpty() ? Version.CURRENT : Version.fromString(upper) }; }
public static Path getIndexDir( final Logger logger, final String indexName, final String indexFile, final Path dataDir) throws IOException { final Version version = Version.fromString(indexName.substring("index-".length())); if (version.before(Version.V_5_0_0_alpha1)) { // the bwc scripts packs the indices under this path Path src = dataDir.resolve("nodes/0/indices/" + indexName); assertTrue("[" + indexFile + "] missing index dir: " + src.toString(), Files.exists(src)); return src; } else { final List<Path> indexFolders = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(dataDir.resolve("0/indices"), (p) -> p.getFileName().toString().startsWith("extra") == false)) { // extra FS can break this... for (final Path path : stream) { indexFolders.add(path); } } assertThat(indexFolders.toString(), indexFolders.size(), equalTo(1)); final IndexMetaData indexMetaData = IndexMetaData.FORMAT.loadLatestState(logger, NamedXContentRegistry.EMPTY, indexFolders.get(0)); assertNotNull(indexMetaData); assertThat(indexFolders.get(0).getFileName().toString(), equalTo(indexMetaData.getIndexUUID())); assertThat(indexMetaData.getCreationVersion(), equalTo(version)); return indexFolders.get(0); } }
throw new IllegalArgumentException("Property [elasticsearch.version] is missing for jvm plugin [" + name + "]"); Version esVersion = Version.fromString(esVersionString); if (esVersion.equals(Version.CURRENT) == false) { throw new IllegalArgumentException("Plugin [" + name + "] is incompatible with Elasticsearch [" + Version.CURRENT.toString() +
private static Tuple<Version, Version> readVersionsFromCatNodes(RestClient restClient) throws IOException { // we simply go to the _cat/nodes API and parse all versions in the cluster Response response = restClient.performRequest("GET", "/_cat/nodes", Collections.singletonMap("h", "version,master")); ClientYamlTestResponse restTestResponse = new ClientYamlTestResponse(response); String nodesCatResponse = restTestResponse.getBodyAsString(); String[] split = nodesCatResponse.split("\n"); Version version = null; Version masterVersion = null; for (String perNode : split) { final String[] versionAndMaster = perNode.split("\\s+"); assert versionAndMaster.length == 2 : "invalid line: " + perNode + " length: " + versionAndMaster.length; final Version currentVersion = Version.fromString(versionAndMaster[0]); final boolean master = versionAndMaster[1].trim().equals("*"); if (master) { assert masterVersion == null; masterVersion = currentVersion; } if (version == null) { version = currentVersion; } else if (version.onOrAfter(currentVersion)) { version = currentVersion; } } return new Tuple<>(version, masterVersion); }
private static Version readVersionsFromInfo(RestClient restClient, int numHosts) throws IOException { Version version = null; for (int i = 0; i < numHosts; i++) { //we don't really use the urls here, we rely on the client doing round-robin to touch all the nodes in the cluster Response response = restClient.performRequest("GET", "/"); ClientYamlTestResponse restTestResponse = new ClientYamlTestResponse(response); Object latestVersion = restTestResponse.evaluate("version.number"); if (latestVersion == null) { throw new RuntimeException("elasticsearch version not found in the response"); } final Version currentVersion = Version.fromString(latestVersion.toString()); if (version == null) { version = currentVersion; } else if (version.onOrAfter(currentVersion)) { version = currentVersion; } } return version; }
"property [elasticsearch.version] is missing for plugin [" + name + "]"); final Version esVersion = Version.fromString(esVersionString); final String javaVersionString = propsMap.remove("java.version"); if (javaVersionString == null) {
"property [elasticsearch.version] is missing for plugin [" + name + "]"); final Version esVersion = Version.fromString(esVersionString); final String javaVersionString = propsMap.remove("java.version"); if (javaVersionString == null) {
"property [elasticsearch.version] is missing for plugin [" + name + "]"); final Version esVersion = Version.fromString(esVersionString); if (esVersion.equals(Version.CURRENT) == false) { final String message = String.format(
public void testHandshakeWithIncompatVersion() { assumeTrue("only tcp transport has a handshake method", serviceA.getOriginalTransport() instanceof TcpTransport); NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList()); Version version = Version.fromString("2.0.0"); try (MockTcpTransport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Collections.emptyList()), version); MockTransportService service = MockTransportService.createNewService(Settings.EMPTY, transport, version, threadPool, null, Collections.emptySet())) { service.start(); service.acceptIncomingRequests(); DiscoveryNode node = new DiscoveryNode("TS_TPC", "TS_TPC", transport.boundAddress().publishAddress(), emptyMap(), emptySet(), version0); ConnectionProfile.Builder builder = new ConnectionProfile.Builder(); builder.addConnections(1, TransportRequestOptions.Type.BULK, TransportRequestOptions.Type.PING, TransportRequestOptions.Type.RECOVERY, TransportRequestOptions.Type.REG, TransportRequestOptions.Type.STATE); expectThrows(ConnectTransportException.class, () -> serviceA.openConnection(node, builder.build())); } }
public void testHandshakeUpdatesVersion() throws IOException { assumeTrue("only tcp transport has a handshake method", serviceA.getOriginalTransport() instanceof TcpTransport); NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(Collections.emptyList()); Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT); try (MockTcpTransport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), namedWriteableRegistry, new NetworkService(Collections.emptyList()), version); MockTransportService service = MockTransportService.createNewService(Settings.EMPTY, transport, version, threadPool, null, Collections.emptySet())) { service.start(); service.acceptIncomingRequests(); DiscoveryNode node = new DiscoveryNode("TS_TPC", "TS_TPC", transport.boundAddress().publishAddress(), emptyMap(), emptySet(), Version.fromString("2.0.0")); ConnectionProfile.Builder builder = new ConnectionProfile.Builder(); builder.addConnections(1, TransportRequestOptions.Type.BULK, TransportRequestOptions.Type.PING, TransportRequestOptions.Type.RECOVERY, TransportRequestOptions.Type.REG, TransportRequestOptions.Type.STATE); try (Transport.Connection connection = serviceA.openConnection(node, builder.build())) { assertEquals(connection.getVersion(), version); } } }