use of org.apache.geode.internal.cache.persistence.DiskRegionView in project geode by apache.
the class DiskInitFile method cmnOnlineMemberId.
public void cmnOnlineMemberId(long drId, PersistentMemberID pmid) {
DiskRegionView dr = getDiskRegionById(drId);
if (dr != null) {
dr.addOnlineMember(pmid);
if (dr.rmOfflineMember(pmid) || dr.rmEqualMember(pmid)) {
this.ifLiveRecordCount--;
}
this.ifLiveRecordCount++;
this.ifTotalRecordCount++;
} else {
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "bad disk region id!");
} else {
throw new IllegalStateException("bad disk region id");
}
}
}
use of org.apache.geode.internal.cache.persistence.DiskRegionView in project geode by apache.
the class DiskInitFile method getRegionsToDump.
/**
* Returns a map of region_name->(pr_buckets|replicated_region)
*
* @param regName
*/
private Map<String, List<PlaceHolderDiskRegion>> getRegionsToDump(String regName) {
if (regName == null) {
Map<String, List<PlaceHolderDiskRegion>> regions = new HashMap<String, List<PlaceHolderDiskRegion>>();
for (DiskRegionView drv : this.drMap.values()) {
if (drv instanceof PlaceHolderDiskRegion) {
PlaceHolderDiskRegion dr = (PlaceHolderDiskRegion) drv;
if (dr.isBucket()) {
List<PlaceHolderDiskRegion> buckets = regions.get(dr.getPrName());
if (buckets == null) {
buckets = new ArrayList<PlaceHolderDiskRegion>();
regions.put(dr.getPrName(), buckets);
}
buckets.add(dr);
} else {
regions.put(drv.getName(), Collections.singletonList(dr));
}
}
}
return regions;
} else {
DiskRegionView drv = getDiskRegionByName(regName);
if (drv == null) {
List<PlaceHolderDiskRegion> buckets = new ArrayList<PlaceHolderDiskRegion>();
for (PlaceHolderDiskRegion dr : this.drMapByName.values()) {
if (dr.isBucket()) {
if (dr.getName().equals(dr.getPrName())) {
buckets.add(dr);
}
}
}
if (buckets.isEmpty()) {
throw new IllegalArgumentException("The disk store does not contain a region named " + regName);
} else {
return Collections.singletonMap(regName, buckets);
}
} else if (drv instanceof PlaceHolderDiskRegion) {
return Collections.singletonMap(regName, Collections.singletonList((PlaceHolderDiskRegion) drv));
} else {
return Collections.emptyMap();
}
}
}
use of org.apache.geode.internal.cache.persistence.DiskRegionView in project geode by apache.
the class DiskInitFile method close.
void close() {
lock.lock();
try {
if (this.closed)
return;
this.closed = true;
stopListeningForDataSerializerChanges();
try {
this.ifRAF.close();
} catch (IOException ignore) {
}
for (DiskRegionView k : this.getKnown()) {
k.close();
}
if (this.liveRegions == 0 && !parent.isValidating()) {
basicDestroy();
}
} finally {
lock.unlock();
}
}
use of org.apache.geode.internal.cache.persistence.DiskRegionView in project geode by apache.
the class DiskInitFile method cmnOfflineMemberId.
public void cmnOfflineMemberId(long drId, PersistentMemberID pmid) {
DiskRegionView dr = getDiskRegionById(drId);
if (dr != null) {
dr.addOfflineMember(pmid);
if (dr.rmOnlineMember(pmid) || dr.rmEqualMember(pmid)) {
this.ifLiveRecordCount--;
}
this.ifLiveRecordCount++;
this.ifTotalRecordCount++;
} else {
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "bad disk region id!");
} else {
throw new IllegalStateException("bad disk region id");
}
}
}
use of org.apache.geode.internal.cache.persistence.DiskRegionView in project geode by apache.
the class DiskInitFile method cmnClearRegion.
public void cmnClearRegion(long drId, long clearOplogEntryId) {
DiskRegionView drv = getDiskRegionById(drId);
if (drv.getClearOplogEntryId() == DiskStoreImpl.INVALID_ID) {
this.ifLiveRecordCount++;
}
// otherwise previous clear is cancelled so don't change liveRecordCount
this.ifTotalRecordCount++;
drv.setClearOplogEntryId(clearOplogEntryId);
if (clearOplogEntryId > clearOplogEntryIdHWM) {
clearOplogEntryIdHWM = clearOplogEntryId;
}
}
Aggregations