Skip to content

Commit

Permalink
GEODE-8337: git mv VersionOrdinal.java->Version.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill committed Jul 18, 2020
1 parent 17d6679 commit 2a3b609
Show file tree
Hide file tree
Showing 67 changed files with 218 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ public void testOldClientIDDeserialization() throws Exception {
InternalDistributedMember memberID =
(InternalDistributedMember) clientCache.getDistributedSystem().getDistributedMember();
MemberIdentifier gmsID = memberID;
memberID.setVersionObjectForTest(KnownVersion.GFE_82);
assertThat(memberID.getVersionOrdinalObject()).isEqualTo(KnownVersion.GFE_82);
memberID.setVersionForTest(KnownVersion.GFE_82);
assertThat(memberID.getVersion()).isEqualTo(KnownVersion.GFE_82);

ClientProxyMembershipID clientID = ClientProxyMembershipID.getClientId(memberID);
HeapDataOutputStream out = new HeapDataOutputStream(KnownVersion.GFE_82);
Expand All @@ -367,14 +367,14 @@ public void testOldClientIDDeserialization() throws Exception {
ClientProxyMembershipID newID = DataSerializer.readObject(in);
InternalDistributedMember newMemberID =
(InternalDistributedMember) newID.getDistributedMember();
assertThat(newMemberID.getVersionOrdinalObject()).isEqualTo(KnownVersion.GFE_82);
assertThat(newMemberID.getVersion()).isEqualTo(KnownVersion.GFE_82);
assertThat(newID.getClientVersion()).isEqualTo(KnownVersion.GFE_82);

assertThat(newMemberID.getUuidLeastSignificantBits()).isEqualTo(0);
assertThat(newMemberID.getUuidMostSignificantBits()).isEqualTo(0);

gmsID.setUUID(new UUID(1234L, 5678L));
memberID.setVersionObjectForTest(KnownVersion.CURRENT);
memberID.setVersionForTest(KnownVersion.CURRENT);
clientID = ClientProxyMembershipID.getClientId(memberID);
out = new HeapDataOutputStream(KnownVersion.CURRENT);
DataSerializer.writeObject(clientID, out);
Expand All @@ -383,7 +383,7 @@ public void testOldClientIDDeserialization() throws Exception {
KnownVersion.CURRENT);
newID = DataSerializer.readObject(in);
newMemberID = (InternalDistributedMember) newID.getDistributedMember();
assertThat(newMemberID.getVersionOrdinalObject()).isEqualTo(KnownVersion.CURRENT);
assertThat(newMemberID.getVersion()).isEqualTo(KnownVersion.CURRENT);
assertThat(newID.getClientVersion()).isEqualTo(KnownVersion.CURRENT);

assertThat(newMemberID.getUuidLeastSignificantBits())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ private CacheClientNotifier createCacheClientNotifier() {
private InternalDistributedMember createMember() {
// Create an InternalDistributedMember
InternalDistributedMember member = mock(InternalDistributedMember.class);
when(member.getVersionOrdinalObject()).thenReturn(KnownVersion.CURRENT);
when(member.getVersion()).thenReturn(KnownVersion.CURRENT);
return member;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static void setVersionForTesting(short ver) {
overrideClientVersion = ver;
} else {
currentClientVersion =
Versioning.getKnownVersionOrDefault(Versioning.getVersionOrdinal(ver),
Versioning.getKnownVersionOrDefault(Versioning.getVersion(ver),
KnownVersion.CURRENT);
overrideClientVersion = -1;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ public ServerQueueStatus handshakeWithServer(Connection conn, ServerLocation loc
// establish a versioned stream for the other site, if necessary
if (wanSiteVersion < KnownVersion.CURRENT_ORDINAL) {
dis = new VersionedDataInputStream(dis, Versioning
.getKnownVersionOrDefault(Versioning.getVersionOrdinal(wanSiteVersion),
.getKnownVersionOrDefault(Versioning.getVersion(wanSiteVersion),
KnownVersion.CURRENT));
}
}
Expand All @@ -248,7 +248,7 @@ public ServerQueueStatus handshakeWithServer(Connection conn, ServerLocation loc
// validate that the remote side has a different distributed system id.
if (communicationMode.isWAN()
&& KnownVersion.GFE_66
.compareTo(Versioning.getVersionOrdinal(conn.getWanSiteVersion())) <= 0
.compareTo(Versioning.getVersion(conn.getWanSiteVersion())) <= 0
&& currentClientVersion.isNotOlderThan(KnownVersion.GFE_66)) {
int remoteDistributedSystemId = in.read();
int localDistributedSystemId =
Expand All @@ -263,7 +263,7 @@ public ServerQueueStatus handshakeWithServer(Connection conn, ServerLocation loc
// Read the PDX registry size from the remote size
if (communicationMode.isWAN()
&& KnownVersion.GFE_80
.compareTo(Versioning.getVersionOrdinal(conn.getWanSiteVersion())) <= 0
.compareTo(Versioning.getVersion(conn.getWanSiteVersion())) <= 0
&& currentClientVersion.isNotOlderThan(KnownVersion.GFE_80)) {
int remotePdxSize = dis.readInt();
serverQStatus.setPdxSize(remotePdxSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1543,13 +1543,13 @@ public Set<InternalDistributedMember> getAllOtherMembers() {
@Override
public void retainMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
KnownVersion version) {
members.removeIf(id -> id.getVersionOrdinalObject().compareTo(version) < 0);
members.removeIf(id -> id.getVersion().compareTo(version) < 0);
}

@Override
public void removeMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
KnownVersion version) {
members.removeIf(id -> id.getVersionOrdinalObject().compareTo(version) >= 0);
members.removeIf(id -> id.getVersion().compareTo(version) >= 0);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public void retainMembersWithSameOrNewerVersion(Collection<InternalDistributedMe
KnownVersion version) {
for (Iterator<InternalDistributedMember> it = members.iterator(); it.hasNext();) {
InternalDistributedMember id = it.next();
if (id.getVersionOrdinalObject().compareTo(version) < 0) {
if (id.getVersion().compareTo(version) < 0) {
it.remove();
}
}
Expand All @@ -200,7 +200,7 @@ public void removeMembersWithSameOrNewerVersion(Collection<InternalDistributedMe
KnownVersion version) {
for (Iterator<InternalDistributedMember> it = members.iterator(); it.hasNext();) {
InternalDistributedMember id = it.next();
if (id.getVersionOrdinalObject().compareTo(version) >= 0) {
if (id.getVersion().compareTo(version) >= 0) {
it.remove();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.cache.versions.ConcurrentCacheModificationException;
import org.apache.geode.internal.serialization.DSFIDNotFoundException;
import org.apache.geode.internal.serialization.VersionOrdinal;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.internal.serialization.Versioning;
import org.apache.geode.internal.util.Breadcrumbs;
import org.apache.geode.internal.util.concurrent.StoppableCountDownLatch;
Expand Down Expand Up @@ -472,7 +472,7 @@ protected synchronized void processException(ReplyException ex) {
*/
protected synchronized void processException(DistributionMessage msg, DSFIDNotFoundException ex) {
final short versionOrdinal = ex.getProductVersionOrdinal();
final VersionOrdinal anyVersion = Versioning.getVersionOrdinal(versionOrdinal);
final Version anyVersion = Versioning.getVersion(versionOrdinal);
logger.fatal(String.format(
"Exception received due to missing DSFID %s on remote node %s running version %s.",
new Object[] {ex.getUnknownDSFID(), msg.getSender(), anyVersion}), ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.apache.geode.internal.serialization.DeserializationContext;
import org.apache.geode.internal.serialization.KnownVersion;
import org.apache.geode.internal.serialization.SerializationContext;
import org.apache.geode.internal.serialization.VersionOrdinal;
import org.apache.geode.internal.serialization.Version;
import org.apache.geode.logging.internal.OSProcess;

/**
Expand Down Expand Up @@ -545,13 +545,13 @@ public String getUniqueId() {
return memberIdentifier.getUniqueId();
}

public void setVersionObjectForTest(KnownVersion v) {
memberIdentifier.setVersionObjectForTest(v);
public void setVersionForTest(KnownVersion v) {
memberIdentifier.setVersionForTest(v);
}

@Override
public VersionOrdinal getVersionOrdinalObject() {
return memberIdentifier.getVersionOrdinalObject();
public Version getVersion() {
return memberIdentifier.getVersion();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ protected void process(final ClusterDistributionManager dm) {
int chunkSize = socketBufferSize - MSG_OVERHEAD;
HeapDataOutputStream outStream =
new HeapDataOutputStream(chunkSize, Versioning
.getKnownVersionOrDefault(getSender().getVersionOrdinalObject(),
.getKnownVersionOrDefault(getSender().getVersion(),
KnownVersion.CURRENT));
boolean sentFinalMessage = false;
boolean receiverCacheClosed = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ protected void checkVersionTag(DistributedRegion rgn, VersionTag tag) {

String msg =
String.format("memberID cannot be null for persistent regions: %s", tag);
RuntimeException ex = (sender.getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80))
RuntimeException ex = (sender.getVersion().isOlderThan(KnownVersion.GFE_80))
? new InternalGemFireException(msg) : new InvalidVersionException(msg);
throw ex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void send(DistributionManager dm, Set<InternalDistributedMember> recipien
Set newVersionRecipients = new HashSet();
for (InternalDistributedMember recipient : recipients) {
// to geode 1.7.0 and later version servers
if (recipient.getVersionOrdinalObject().isNotOlderThan(KnownVersion.GEODE_1_7_0)) {
if (recipient.getVersion().isNotOlderThan(KnownVersion.GEODE_1_7_0)) {
newVersionRecipients.add(recipient);
}
}
Expand Down Expand Up @@ -78,7 +78,7 @@ protected void process(ClusterDistributionManager dm) {
InternalDistributedMember sender = getSender();
if (cache != null) {
TXManagerImpl mgr = cache.getTXMgr();
if (sender.getVersionOrdinalObject().isNotOlderThan(KnownVersion.GEODE_1_7_0)) {
if (sender.getVersion().isNotOlderThan(KnownVersion.GEODE_1_7_0)) {
// schedule to expire disconnected client transaction.
mgr.expireDisconnectedClientTransactions(this.txIds, false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4400,7 +4400,7 @@ private void sendRemoveCacheServerProfileMessage() {
// the RemoveCacheServerProfileMessage
otherMembers
.removeIf(
member -> KnownVersion.GEODE_1_5_0.compareTo(member.getVersionOrdinalObject()) > 0);
member -> KnownVersion.GEODE_1_5_0.compareTo(member.getVersion()) > 0);

if (!otherMembers.isEmpty()) {
if (logger.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,14 @@ GIIStatus getFromOne(Set recipientSet, boolean targetReinitialized,
final ClusterDistributionManager dm =
(ClusterDistributionManager) this.region.getDistributionManager();
boolean allowDeltaGII = true;
if (FORCE_FULL_GII || recipient.getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)) {
if (FORCE_FULL_GII || recipient.getVersion().isOlderThan(KnownVersion.GFE_80)) {
allowDeltaGII = false;
}
Set keysOfUnfinishedOps = null;
RegionVersionVector received_rvv = null;
RegionVersionVector remote_rvv = null;
if (this.region.getConcurrencyChecksEnabled()
&& recipient.getVersionOrdinalObject().isNotOlderThan(KnownVersion.GFE_80)) {
&& recipient.getVersion().isNotOlderThan(KnownVersion.GFE_80)) {
if (internalBeforeRequestRVV != null
&& internalBeforeRequestRVV.getRegionName().equals(this.region.getName())) {
internalBeforeRequestRVV.run();
Expand Down Expand Up @@ -747,7 +747,7 @@ private void checkForUnrecordedOperations(InternalDistributedMember imageProvide
Set recipients = this.region.getCacheDistributionAdvisor().adviseReplicates();
for (Iterator it = recipients.iterator(); it.hasNext();) {
InternalDistributedMember mbr = (InternalDistributedMember) it.next();
if (mbr.getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)) {
if (mbr.getVersion().isOlderThan(KnownVersion.GFE_80)) {
it.remove();
}
}
Expand Down Expand Up @@ -1191,7 +1191,7 @@ void processRegionStateMessage(RegionStateMessage msg) {
region.recordEventState(msg.getSender(), msg.eventState);
}
if (msg.versionVector != null
&& msg.getSender().getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)
&& msg.getSender().getVersion().isOlderThan(KnownVersion.GFE_80)
&& region.getConcurrencyChecksEnabled()) {
// for older version, save received rvv from RegionStateMessage
logger.debug("Applying version vector to {}: {}", region.getName(), msg.versionVector);
Expand Down Expand Up @@ -1600,7 +1600,7 @@ public int getProcessorType() {
}

public boolean goWithFullGII(DistributedRegion rgn, RegionVersionVector requesterRVV) {
if (getSender().getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)) {
if (getSender().getVersion().isOlderThan(KnownVersion.GFE_80)) {
// pre-8.0 could not handle a delta-GII
return true;
}
Expand Down Expand Up @@ -1745,7 +1745,7 @@ protected void process(final ClusterDistributionManager dm) {
if (eventState != null && eventState.size() > 0) {
RegionStateMessage.send(dm, getSender(), this.processorId, eventState, true);
}
} else if (getSender().getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)) {
} else if (getSender().getVersion().isOlderThan(KnownVersion.GFE_80)) {
// older versions of the product expect a RegionStateMessage at this point
if (rgn.getConcurrencyChecksEnabled() && this.versionVector == null
&& !recoveringForLostMember) {
Expand Down Expand Up @@ -1995,7 +1995,7 @@ protected boolean chunkEntries(DistributedRegion rgn, int chunkSizeInBytes,
}

final KnownVersion knownVersion = Versioning
.getKnownVersionOrDefault(sender.getVersionOrdinalObject(), KnownVersion.CURRENT);
.getKnownVersionOrDefault(sender.getVersion(), KnownVersion.CURRENT);

do {
flowControl.acquirePermit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,7 @@ private KnownVersion readProductVersionRecord(DataInput dis, File f) throws IOEx
short ver = VersioningIO.readOrdinal(dis);
final KnownVersion recoveredGFVersion =
Versioning.getKnownVersionOrDefault(
Versioning.getVersionOrdinal(ver), null);
Versioning.getVersion(ver), null);
if (recoveredGFVersion == null) {
throw new DiskAccessException(
String.format("Unknown version ordinal %s found when recovering Oplogs", ver),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4830,7 +4830,7 @@ public void fetchRemoteEntries(
oneBucketKeys.clear();
oneBucketKeys.put(e.getKey(), e.getValue());
try {
if (entry.getKey().getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)) {
if (entry.getKey().getVersion().isOlderThan(KnownVersion.GFE_80)) {
failures.putAll(nodeToBuckets.get(entry.getKey()));
continue;
}
Expand Down Expand Up @@ -4882,7 +4882,7 @@ public void fetchAllRemoteEntries(
bucketId.clear();
bucketId.add(bucket);
try {
if (entry.getKey().getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_80)) {
if (entry.getKey().getVersion().isOlderThan(KnownVersion.GFE_80)) {
failures.addAll(nodeToBuckets.get(entry.getKey()));
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ protected boolean processData(List objects, InternalDistributedMember sender, in
// we will have to sort it
boolean sortNeeded = false;
List<CompiledSortCriterion> orderByAttribs = null;
if (sender.getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_90)) {
if (sender.getVersion().isOlderThan(KnownVersion.GFE_90)) {
CompiledSelect cs = this.query.getSimpleSelect();
if (cs != null && cs.isOrderBy()) {
sortNeeded = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static boolean send(InternalCache cache, Set<InternalDistributedMember> r

// filtered recipients
for (InternalDistributedMember recipient : recipients) {
if (KnownVersion.GFE_81.compareTo(recipient.getVersionOrdinalObject()) <= 0) {
if (KnownVersion.GFE_81.compareTo(recipient.getVersion()) <= 0) {
filteredRecipients.add(recipient);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,7 @@ public Object updateHAEventWrapper(InternalDistributedMember sender,
try {
inputValue = BlobHelper.deserializeBlob(newValueCd.getSerializedValue(),
Versioning
.getKnownVersionOrDefault(sender.getVersionOrdinalObject(), KnownVersion.CURRENT),
.getKnownVersionOrDefault(sender.getVersion(), KnownVersion.CURRENT),
null);
newValueCd = new VMCachedDeserializable(inputValue, newValueCd.getSizeInBytes());
} catch (IOException | ClassNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public static void sendReply(PartitionedRegion pr, final InternalDistributedMemb

HeapDataOutputStream mos = new HeapDataOutputStream(
InitialImageOperation.CHUNK_SIZE_IN_BYTES + 2048, Versioning
.getKnownVersionOrDefault(recipient.getVersionOrdinalObject(), KnownVersion.CURRENT));
.getKnownVersionOrDefault(recipient.getVersion(), KnownVersion.CURRENT));
Iterator<BucketRegion> mapsIterator = maps.iterator();
BucketRegion map = null;
Iterator it = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static boolean chunkMap(InternalDistributedMember receiver, BucketRegion map,
// always write at least one chunk
final HeapDataOutputStream mos = new HeapDataOutputStream(
InitialImageOperation.CHUNK_SIZE_IN_BYTES + 2048, Versioning
.getKnownVersionOrDefault(receiver.getVersionOrdinalObject(), KnownVersion.CURRENT));
.getKnownVersionOrDefault(receiver.getVersion(), KnownVersion.CURRENT));
do {
mos.reset();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static boolean chunkSet(InternalDistributedMember recipient, Set set, int CHUNK_
// always write at least one chunk
final HeapDataOutputStream mos = new HeapDataOutputStream(
InitialImageOperation.CHUNK_SIZE_IN_BYTES + 2048, Versioning
.getKnownVersionOrDefault(recipient.getVersionOrdinalObject(), KnownVersion.CURRENT));
.getKnownVersionOrDefault(recipient.getVersion(), KnownVersion.CURRENT));
do {
mos.reset();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public static PartitionResponse send(InternalDistributedMember recipient, Partit
}

for (InternalDistributedMember rec : recipients) {
if (rec.getVersionOrdinalObject().isOlderThan(KnownVersion.GFE_81)) {
if (rec.getVersion().isOlderThan(KnownVersion.GFE_81)) {
throw new UnsupportedOperationException(
"Indexes should not be created during rolling upgrade");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected Object getNextReplyObject(PartitionedRegion pr)
}
Object data = this.currentResultIterator.next();
boolean isPostGFE_8_1 =
this.getSender().getVersionOrdinalObject().isNewerThan(KnownVersion.GFE_81);
this.getSender().getVersion().isNewerThan(KnownVersion.GFE_81);

// There is a bug in older versions of GFE such that the query node expects the structs to have
// type as ObjectTypes only & not specific types. So the new version needs to send the
Expand Down Expand Up @@ -192,7 +192,7 @@ protected boolean operateOnPartitionedRegion(ClusterDistributionManager dm, Part
}
isQueryTraced =
query.isTraced()
&& this.sender.getVersionOrdinalObject().isNotOlderThan(KnownVersion.GFE_81);
&& this.sender.getVersion().isNotOlderThan(KnownVersion.GFE_81);

// Adds a query trace info object to the results list for remote queries
PRQueryTraceInfo queryTraceInfo = null;
Expand Down
Loading

0 comments on commit 2a3b609

Please sign in to comment.