use of org.apache.geode.internal.cache.versions.VersionSource in project geode by apache.
the class OrderedTombstoneMap method put.
/**
* Add a new version tag to map
*/
public void put(VersionTag tag, T entry) {
// Add the version tag to the appropriate map
VersionSource member = tag.getMemberID();
TreeMap<VersionTag, T> memberMap = tombstoneMap.get(member);
if (memberMap == null) {
memberMap = new TreeMap<VersionTag, T>(new VersionTagComparator());
tombstoneMap.put(member, memberMap);
}
T oldValue = memberMap.put(tag, entry);
Assert.assertTrue(oldValue == null);
}
use of org.apache.geode.internal.cache.versions.VersionSource in project geode by apache.
the class RRSynchronizationDUnitTest method doRegionsSyncOnPeerLoss.
/**
* We hit this problem in bug #45669. delta-GII was not being distributed in the 7.0 release.
*/
public void doRegionsSyncOnPeerLoss(TestType typeOfTest) {
IgnoredException.addIgnoredException("killing member's ds");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
final String name = this.getUniqueName() + "Region";
disconnectAllFromDS();
try {
createRegion(vm0, name, typeOfTest);
createRegion(vm1, name, typeOfTest);
createRegion(vm2, name, typeOfTest);
createEntry1(vm0);
// cause one of the VMs to throw away the next operation
InternalDistributedMember crashedID = getID(vm0);
VersionSource crashedVersionID = getVersionID(vm0);
createEntry2(vm1, crashedID, crashedVersionID);
// Now we crash the member who "modified" vm1's cache.
// The other replicates should perform a delta-GII for the lost member and
// get back in sync
DistributedTestUtils.crashDistributedSystem(vm0);
verifySynchronized(vm2, crashedID);
} finally {
disconnectAllFromDS();
}
}
use of org.apache.geode.internal.cache.versions.VersionSource in project geode by apache.
the class DistributedPutAllOperation method getEventForPosition.
@Unretained
public EntryEventImpl getEventForPosition(int position) {
PutAllEntryData entry = this.putAllData[position];
if (entry == null) {
return null;
}
if (entry.event != null) {
return entry.event;
}
LocalRegion region = (LocalRegion) this.event.getRegion();
@Retained EntryEventImpl ev = EntryEventImpl.create(region, entry.getOp(), entry.getKey(), null, /* value */
this.event.getCallbackArgument(), false, /* originRemote */
this.event.getDistributedMember(), this.event.isGenerateCallbacks(), entry.getEventID());
boolean returnedEv = false;
try {
ev.setPossibleDuplicate(entry.isPossibleDuplicate());
if (entry.versionTag != null && region.concurrencyChecksEnabled) {
VersionSource id = entry.versionTag.getMemberID();
if (id != null) {
entry.versionTag.setMemberID(ev.getRegion().getVersionVector().getCanonicalId(id));
}
ev.setVersionTag(entry.versionTag);
}
entry.event = ev;
returnedEv = true;
if (entry.getValue() == null && ev.getRegion().getAttributes().getDataPolicy() == DataPolicy.NORMAL) {
ev.setLocalInvalid(true);
}
ev.setNewValue(entry.getValue());
ev.setOldValue(entry.getOldValue());
CqService cqService = region.getCache().getCqService();
if (cqService.isRunning() && !entry.getOp().isCreate() && !ev.hasOldValue()) {
ev.setOldValueForQueryProcessing();
}
ev.setInvokePRCallbacks(!entry.isNotifyOnly());
if (getBaseEvent().getContext() != null) {
ev.setContext(getBaseEvent().getContext());
}
ev.callbacksInvoked(entry.isCallbacksInvoked());
ev.setTailKey(entry.getTailKey());
return ev;
} finally {
if (!returnedEv) {
ev.release();
}
}
}
use of org.apache.geode.internal.cache.versions.VersionSource in project geode by apache.
the class DistributedRemoveAllOperation method getEventForPosition.
@Unretained
public EntryEventImpl getEventForPosition(int position) {
RemoveAllEntryData entry = this.removeAllData[position];
if (entry == null) {
return null;
}
if (entry.event != null) {
return entry.event;
}
LocalRegion region = (LocalRegion) this.event.getRegion();
// owned by this.removeAllData once entry.event = ev is done
@Retained EntryEventImpl ev = EntryEventImpl.create(region, entry.getOp(), entry.getKey(), null, /* value */
this.event.getCallbackArgument(), false, /* originRemote */
this.event.getDistributedMember(), this.event.isGenerateCallbacks(), entry.getEventID());
boolean returnedEv = false;
try {
ev.setPossibleDuplicate(entry.isPossibleDuplicate());
ev.setIsRedestroyedEntry(entry.getRedestroyedEntry());
if (entry.versionTag != null && region.concurrencyChecksEnabled) {
VersionSource id = entry.versionTag.getMemberID();
if (id != null) {
entry.versionTag.setMemberID(ev.getRegion().getVersionVector().getCanonicalId(id));
}
ev.setVersionTag(entry.versionTag);
}
entry.event = ev;
returnedEv = true;
ev.setOldValue(entry.getOldValue());
CqService cqService = region.getCache().getCqService();
if (cqService.isRunning() && !entry.getOp().isCreate() && !ev.hasOldValue()) {
ev.setOldValueForQueryProcessing();
}
ev.setInvokePRCallbacks(!entry.isNotifyOnly());
if (getBaseEvent().getContext() != null) {
ev.setContext(getBaseEvent().getContext());
}
ev.callbacksInvoked(entry.isCallbacksInvoked());
ev.setTailKey(entry.getTailKey());
return ev;
} finally {
if (!returnedEv) {
ev.release();
}
}
}
use of org.apache.geode.internal.cache.versions.VersionSource in project geode by apache.
the class CacheClientUpdater method handleTombstoneOperation.
private void handleTombstoneOperation(Message clientMessage) {
String regionName = "unknown";
try {
// not sure why this isn't done by the caller
int partIdx = 0;
// see ClientTombstoneMessage.getGFE70Message
regionName = clientMessage.getPart(partIdx++).getString();
int op = clientMessage.getPart(partIdx++).getInt();
LocalRegion region = (LocalRegion) this.cacheHelper.getRegion(regionName);
if (region == null) {
if (!quitting()) {
if (logger.isDebugEnabled()) {
logger.debug("{}: Region named {} does not exist", this, regionName);
}
}
return;
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received tombstone operation for region {} with operation={}", this, region, op);
}
if (!region.getConcurrencyChecksEnabled()) {
return;
}
switch(op) {
case 0:
Map<VersionSource, Long> regionGCVersions = (Map<VersionSource, Long>) clientMessage.getPart(partIdx++).getObject();
EventID eventID = (EventID) clientMessage.getPart(partIdx++).getObject();
region.expireTombstones(regionGCVersions, eventID, null);
break;
case 1:
Set<Object> removedKeys = (Set<Object>) clientMessage.getPart(partIdx++).getObject();
region.expireTombstoneKeys(removedKeys);
break;
default:
throw new IllegalArgumentException("unknown operation type " + op);
}
} catch (Exception e) {
handleException(": exception while removing tombstones from " + regionName, e);
}
}
Aggregations