@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Version that = (Version) o; return isEqualTo(that); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Version that = (Version) o; return isEqualTo(that); }
@Override protected void readInternal(ObjectDataInput in) throws IOException { super.readInternal(in); // RU_COMPAT_3_10 if (in.getVersion().isEqualTo(Versions.V3_10)) { // restore disableWanReplicationEvent flag // // this may happen if the operation was created by a 3.10.5+ member // which carries over the disableWanReplicationEvent flag's value // in the TTL field for wire format compatibility reasons disableWanReplicationEvent |= (ttl & BITMASK_TTL_DISABLE_WAN) == 0; } } }
@Override protected void readInternal(ObjectDataInput in) throws IOException { super.readInternal(in); // RU_COMPAT_3_10 if (in.getVersion().isEqualTo(Versions.V3_10)) { // restore disableWanReplicationEvent flag // // this may happen if the operation was created by a 3.10.5+ member // which carries over the disableWanReplicationEvent flag's value // in the TTL field for wire format compatibility reasons disableWanReplicationEvent |= (ttl & BITMASK_TTL_DISABLE_WAN) == 0; } } }
@Override protected void writeInternal(ObjectDataOutput out) throws IOException { // RU_COMPAT_3_10 if (disableWanReplicationEvent && out.getVersion().isEqualTo(Versions.V3_10)) { // disableWanReplicationEvent flag is not serialized in 3.10, which may // lead to publishing remove WAN events by error, if the operation // executes on a remote node. This may lead to republishing remove // events to clusters that have already processed it, possibly causing // data loss, if the removed entry has been added back since then. // // Serializing the field would break the compatibility, hence // we encode its value into the TTL field, which is serialized // but not used for remove operations. // // Note that this serialization has the side effect that the // value of TTL changes, but it is acceptable since the field // is not in use. // This value change is done during serialization to keep // clusters already on 3.11+ unaffected from this compatibility trick. this.ttl ^= BITMASK_TTL_DISABLE_WAN; } super.writeInternal(out); }
@Override protected void writeInternal(ObjectDataOutput out) throws IOException { // RU_COMPAT_3_10 if (disableWanReplicationEvent && out.getVersion().isEqualTo(Versions.V3_10)) { // disableWanReplicationEvent flag is not serialized in 3.10, which may // lead to publishing remove WAN events by error, if the operation // executes on a remote node. This may lead to republishing remove // events to clusters that have already processed it, possibly causing // data loss, if the removed entry has been added back since then. // // Serializing the field would break the compatibility, hence // we encode its value into the TTL field, which is serialized // but not used for remove operations. // // Note that this serialization has the side effect that the // value of TTL changes, but it is acceptable since the field // is not in use. // This value change is done during serialization to keep // clusters already on 3.11+ unaffected from this compatibility trick. this.ttl ^= BITMASK_TTL_DISABLE_WAN; } super.writeInternal(out); }
protected boolean isClusterVersionEqualTo(Version version) { Version clusterVersion = getNodeEngine().getClusterService().getClusterVersion(); return clusterVersion.isEqualTo(version); }
protected boolean isClusterVersionEqualTo(Version version) { Version clusterVersion = getNodeEngine().getClusterService().getClusterVersion(); return clusterVersion.isEqualTo(version); }
@Override public void onClusterVersionChange(Version newVersion) { // RU_COMPAT_3_11 if (newVersion.isEqualTo(Versions.V3_12)) { lock.lock(); try { if (!partitionStateManager.isInitialized()) { return; } for (int pid = 0; pid < getPartitionCount(); pid++) { InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(pid); PartitionReplica[] replicaMembers = partition.getReplicas(); for (PartitionReplica member : replicaMembers) { if (member == null) { continue; } if (PartitionReplica.UNKNOWN_UID.equals(member.uuid())) { throw new IllegalStateException("Unknown uuid: " + member); } } } } finally { lock.unlock(); } } }
private boolean mustWriteIndexInfos(Version clusterVersion) { // 3.10 OS always writes mapIndexInfos // 3.10 EE on cluster version 3.10 must write index info if (!getBuildInfo().isEnterprise() || clusterVersion.isGreaterOrEqual(V3_10)) { return true; } ClusterService clusterService = operation.getNodeEngine().getClusterService(); Member targetMember = clusterService.getMember(target); // When cluster version is 3.9, only write mapIndexInfo if target member is 3.9 EE. Reasoning: // 3.9 EE expects to read mapIndexInfos when object data input comes with 3.9+ version. This is // the case when the object stream originates from a versioned 3.10 member. return targetMember.getVersion().asVersion().isEqualTo(V3_9) && clusterVersion.isEqualTo(V3_9); }
private boolean mustWriteIndexInfos(Version clusterVersion) { // Do not write index info when OS or cluster version is 3.10+ if (!getBuildInfo().isEnterprise() || clusterVersion.isGreaterOrEqual(V3_10)) { return false; } // 3.9 EE reads index definitions when object input version is UNKNOWN or <= 3.8 // --> it expects to read map index definitions from other 3.9 members but not from // an input coming from 3.10 EE (as it will have version 3.9) --> do not send when target member is 3.9 // --> when target member is 3.10, do send index info so it behaves like 3.9-only cluster ClusterService clusterService = getNodeEngine().getClusterService(); Member targetMember = clusterService.getMember(target); return targetMember.getVersion().asVersion().isEqualTo(V3_10) && clusterVersion.isEqualTo(V3_9); } }
private boolean checkCompatibleSplitBrainJoinMessage(SplitBrainJoinMessage joinMessage) { Version clusterVersion = clusterService.getClusterVersion(); if (!clusterVersion.isEqualTo(joinMessage.getClusterVersion())) { if (logger.isFineEnabled()) { logger.fine("Should not merge to " + joinMessage.getAddress() + " because other cluster version is " + joinMessage.getClusterVersion() + " while this cluster version is " + clusterVersion); } return false; } return true; }
private boolean checkCompatibleSplitBrainJoinMessage(SplitBrainJoinMessage joinMessage) { Version clusterVersion = clusterService.getClusterVersion(); if (!clusterVersion.isEqualTo(joinMessage.getClusterVersion())) { if (logger.isFineEnabled()) { logger.fine("Should not merge to " + joinMessage.getAddress() + " because other cluster version is " + joinMessage.getClusterVersion() + " while this cluster version is " + clusterVersion); } return false; } return true; }
@Override public void onClusterVersionChange(Version newVersion) { if (!node.getVersion().asVersion().isEqualTo(newVersion)) { systemLogger.info("Cluster version set to " + newVersion); } ServiceManager serviceManager = node.getNodeEngine().getServiceManager(); List<ClusterVersionListener> listeners = serviceManager.getServices(ClusterVersionListener.class); for (ClusterVersionListener listener : listeners) { listener.onClusterVersionChange(newVersion); } // also trigger cluster version change on explicitly registered listeners for (ClusterVersionListener listener : clusterVersionListeners) { listener.onClusterVersionChange(newVersion); } }
@Override public void onClusterVersionChange(Version newVersion) { if (!node.getVersion().asVersion().isEqualTo(newVersion)) { systemLogger.info("Cluster version set to " + newVersion); } ServiceManager serviceManager = node.getNodeEngine().getServiceManager(); List<ClusterVersionListener> listeners = serviceManager.getServices(ClusterVersionListener.class); for (ClusterVersionListener listener : listeners) { listener.onClusterVersionChange(newVersion); } // also trigger cluster version change on explicitly registered listeners for (ClusterVersionListener listener : clusterVersionListeners) { listener.onClusterVersionChange(newVersion); } }