use of org.apache.geode.internal.cache.EventTracker.BulkOpHolder in project geode by apache.
the class DistributedRegionJUnitTest method retriedBulkOpGetsSavedVersionTag.
@Test
public void retriedBulkOpGetsSavedVersionTag() {
DistributedRegion region = prepare(true, true);
DistributedMember member = mock(DistributedMember.class);
ClientProxyMembershipID memberId = mock(ClientProxyMembershipID.class);
doReturn(false).when(region).isUsedForPartitionedRegionBucket();
byte[] memId = { 1, 2, 3 };
long threadId = 1;
long retrySeqId = 1;
ThreadIdentifier tid = new ThreadIdentifier(memId, threadId);
EventID retryEventID = new EventID(memId, threadId, retrySeqId);
boolean skipCallbacks = true;
int size = 2;
recordPutAllEvents(region, memId, threadId, skipCallbacks, member, memberId, size);
EventTracker eventTracker = region.getEventTracker();
ConcurrentMap<ThreadIdentifier, BulkOpHolder> map = eventTracker.getRecordedBulkOpVersionTags();
BulkOpHolder holder = map.get(tid);
EntryEventImpl retryEvent = EntryEventImpl.create(region, Operation.PUTALL_CREATE, "key1", "value1", null, false, member, !skipCallbacks, retryEventID);
retryEvent.setContext(memberId);
retryEvent.setPutAllOperation(mock(DistributedPutAllOperation.class));
region.hasSeenEvent(retryEvent);
assertTrue(retryEvent.getVersionTag().equals(holder.entryVersionTags.get(retryEventID)));
}
use of org.apache.geode.internal.cache.EventTracker.BulkOpHolder in project geode by apache.
the class EventTrackerTest method retriedBulkOpDoesNotRemoveRecordedBulkOpVersionTags.
@Test
public void retriedBulkOpDoesNotRemoveRecordedBulkOpVersionTags() {
byte[] memId = { 1, 2, 3 };
long threadId = 1;
long retrySeqId = 1;
ThreadIdentifier tid = new ThreadIdentifier(memId, threadId);
EventID retryEventID = new EventID(memId, threadId, retrySeqId);
boolean skipCallbacks = true;
int size = 5;
recordPutAllEvents(memId, threadId, skipCallbacks, size);
ConcurrentMap<ThreadIdentifier, BulkOpHolder> map = eventTracker.getRecordedBulkOpVersionTags();
BulkOpHolder holder = map.get(tid);
int beforeSize = holder.entryVersionTags.size();
eventTracker.recordBulkOpStart(tid, retryEventID);
map = eventTracker.getRecordedBulkOpVersionTags();
holder = map.get(tid);
// Retried bulk op should not remove exiting BulkOpVersionTags
assertTrue(holder.entryVersionTags.size() == beforeSize);
}
use of org.apache.geode.internal.cache.EventTracker.BulkOpHolder in project geode by apache.
the class EventTrackerDUnitTest method checkEventTracker.
private void checkEventTracker(LocalRegion region, int numberOfEvents) {
EventTracker tracker = region.getEventTracker();
ConcurrentMap<ThreadIdentifier, BulkOpHolder> memberToTags = tracker.getRecordedBulkOpVersionTags();
assertEquals("memberToTags=" + memberToTags, 1, memberToTags.size());
BulkOpHolder holder = memberToTags.values().iterator().next();
// We expect the holder to retain only the last putAll that was performed.
assertEquals("entryToVersionTags=" + holder.entryVersionTags, numberOfEvents, holder.entryVersionTags.size());
}
Aggregations