/** * Returns the minimum created index version that this version supports. Indices created with lower versions * can't be used with this version. This should also be used for file based serialization backwards compatibility ie. on serialization * code that is used to read / write file formats like transaction logs, cluster state, and index metadata. */ public Version minimumIndexCompatibilityVersion() { final int bwcMajor; if (major == 5) { bwcMajor = 2; // we jumped from 2 to 5 } else { bwcMajor = major - 1; } final int bwcMinor = 0; return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor * 10000 + 99)); }
/** * Returns the minimum compatible version based on the current * version. Ie a node needs to have at least the return version in order * to communicate with a node running the current version. The returned version * is in most of the cases the smallest major version release unless the current version * is a beta or RC release then the version itself is returned. */ public Version minimumCompatibilityVersion() { if (major >= 6) { // all major versions from 6 onwards are compatible with last minor series of the previous major Version bwcVersion = null; for (int i = DeclaredVersionsHolder.DECLARED_VERSIONS.size() - 1; i >= 0; i--) { final Version candidateVersion = DeclaredVersionsHolder.DECLARED_VERSIONS.get(i); if (candidateVersion.major == major - 1 && candidateVersion.isRelease() && after(candidateVersion)) { if (bwcVersion != null && candidateVersion.minor < bwcVersion.minor) { break; } bwcVersion = candidateVersion; } } return bwcVersion == null ? this : bwcVersion; } return Version.min(this, fromId((int) major * 1000000 + 0 * 10000 + 99)); }
/** * Returns the minimum version between the 2. * @deprecated use {@link #min(Version, Version)} instead */ @Deprecated public static Version smallest(Version version1, Version version2) { return min(version1, version2); }
maxNonClientNodeVersion = version; } else { minNonClientNodeVersion = Version.min(minNonClientNodeVersion, version); maxNonClientNodeVersion = Version.max(maxNonClientNodeVersion, version); ingestNodesBuilder.put(nodeEntry.key, nodeEntry.value); minNodeVersion = minNodeVersion == null ? version : Version.min(minNodeVersion, version); maxNodeVersion = maxNodeVersion == null ? version : Version.max(maxNodeVersion, version);
final Version createdVersion = Version.min(Version.CURRENT, nodes.getSmallestNonClientNodeVersion()); indexSettingsBuilder.put(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey(), createdVersion);
nodesBuilder.add(node); nodesChanged = true; minClusterNodeVersion = Version.min(minClusterNodeVersion, node.getVersion()); maxClusterNodeVersion = Version.max(maxClusterNodeVersion, node.getVersion()); } catch (IllegalArgumentException | IllegalStateException e) {
/** * Returns the minimum created index version that this version supports. Indices created with lower versions * can't be used with this version. This should also be used for file based serialization backwards compatibility ie. on serialization * code that is used to read / write file formats like transaction logs, cluster state, and index metadata. */ public Version minimumIndexCompatibilityVersion() { final int bwcMajor; if (major == 5) { bwcMajor = 2; // we jumped from 2 to 5 } else { bwcMajor = major - 1; } final int bwcMinor = 0; return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor * 10000 + 99)); }
/** * Returns the minimum created index version that this version supports. Indices created with lower versions * can't be used with this version. */ public Version minimumIndexCompatibilityVersion() { final int bwcMajor; if (major == 5) { bwcMajor = 2; // we jumped from 2 to 5 } else { bwcMajor = major - 1; } final int bwcMinor; if (bwcMajor <= 2) { // we do support beta1 prior to 5.x // this allows clusters that have upgraded to 5.0 with an index created in 2.0.0.beta1 to go to 5.2 etc. // otherwise the upgrade will fail and that is really not what we want. from 5 onwards we are supporting only GA // releases bwcMinor = 01; } else { bwcMinor = 99; } return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor)); }
Version version = Version.min(this.version, channelVersion);
/** * Returns the minimum compatible version based on the current * version. Ie a node needs to have at least the return version in order * to communicate with a node running the current version. The returned version * is in most of the cases the smallest major version release unless the current version * is a beta or RC release then the version itself is returned. */ public Version minimumCompatibilityVersion() { final int bwcMajor; final int bwcMinor; if (major >= 6) { bwcMajor = major - 1; bwcMinor = CURRENT.minor; } else { bwcMajor = major; bwcMinor = 0; } return Version.min(this, fromId(bwcMajor * 1000000 + bwcMinor * 10000 + 99)); }
/** * Returns the minimum compatible version based on the current * version. Ie a node needs to have at least the return version in order * to communicate with a node running the current version. The returned version * is in most of the cases the smallest major version release unless the current version * is a beta or RC release then the version itself is returned. */ public Version minimumCompatibilityVersion() { if (major >= 6) { // all major versions from 6 onwards are compatible with last minor series of the previous major Version bwcVersion = null; for (int i = DeclaredVersionsHolder.DECLARED_VERSIONS.size() - 1; i >= 0; i--) { final Version candidateVersion = DeclaredVersionsHolder.DECLARED_VERSIONS.get(i); if (candidateVersion.major == major - 1 && candidateVersion.isRelease() && after(candidateVersion)) { if (bwcVersion != null && candidateVersion.minor < bwcVersion.minor) { break; } bwcVersion = candidateVersion; } } return bwcVersion == null ? this : bwcVersion; } return Version.min(this, fromId((int) major * 1000000 + 0 * 10000 + 99)); }
if (nodeEntry.value.isDataNode()) { dataNodesBuilder.put(nodeEntry.key, nodeEntry.value); minNonClientNodeVersion = Version.min(minNonClientNodeVersion, nodeEntry.value.getVersion()); minNonClientNodeVersion = Version.min(minNonClientNodeVersion, nodeEntry.value.getVersion()); minNonClientNodeVersion = Version.smallest(minNonClientNodeVersion, nodeEntry.value.getVersion()); minNodeVersion = Version.min(minNodeVersion, nodeEntry.value.getVersion()); maxNodeVersion = Version.max(maxNodeVersion, nodeEntry.value.getVersion());
minNodeVersion = Version.min(minNodeVersion, node.getVersion()); if (node.equals(BECOME_MASTER_TASK) || node.equals(FINISH_ELECTION_TASK)) {
maxNonClientNodeVersion = version; } else { minNonClientNodeVersion = Version.min(minNonClientNodeVersion, version); maxNonClientNodeVersion = Version.max(maxNonClientNodeVersion, version); ingestNodesBuilder.put(nodeEntry.key, nodeEntry.value); minNodeVersion = minNodeVersion == null ? version : Version.min(minNodeVersion, version); maxNodeVersion = maxNodeVersion == null ? version : Version.max(maxNodeVersion, version);
maxNonClientNodeVersion = version; } else { minNonClientNodeVersion = Version.min(minNonClientNodeVersion, version); maxNonClientNodeVersion = Version.max(maxNonClientNodeVersion, version); ingestNodesBuilder.put(nodeEntry.key, nodeEntry.value); minNodeVersion = minNodeVersion == null ? version : Version.min(minNodeVersion, version); maxNodeVersion = maxNodeVersion == null ? version : Version.max(maxNodeVersion, version);
nodesBuilder.add(node); nodesChanged = true; minClusterNodeVersion = Version.min(minClusterNodeVersion, node.getVersion()); maxClusterNodeVersion = Version.max(maxClusterNodeVersion, node.getVersion()); } catch (IllegalArgumentException | IllegalStateException e) {
nodesBuilder.add(node); nodesChanged = true; minClusterNodeVersion = Version.min(minClusterNodeVersion, node.getVersion()); maxClusterNodeVersion = Version.max(maxClusterNodeVersion, node.getVersion()); } catch (IllegalArgumentException | IllegalStateException e) {
protected void sendRequest(LocalTransport targetTransport, final DiscoveryNode node, final long requestId, final String action, final TransportRequest request, TransportRequestOptions options) throws IOException, TransportException { final Version version = Version.min(node.getVersion(), getVersion()); try (BytesStreamOutput stream = new BytesStreamOutput()) { stream.setVersion(version); stream.writeLong(requestId); byte status = 0; status = TransportStatus.setRequest(status); stream.writeByte(status); // 0 for request, 1 for response. threadPool.getThreadContext().writeTo(stream); stream.writeString(action); request.writeTo(stream); stream.close(); final byte[] data = BytesReference.toBytes(stream.bytes()); transportServiceAdapter.addBytesSent(data.length); transportServiceAdapter.onRequestSent(node, requestId, action, request, options); targetTransport.receiveMessage(version, data, action, requestId, this); } }
Version version = Version.min(getCurrentVersion(), channelVersion);
Version version = Version.min(getCurrentVersion(), channelVersion);