use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class CompactRequest method createResponse.
@Override
protected AdminResponse createResponse(DistributionManager dm) {
InternalCache cache = GemFireCacheImpl.getInstance();
HashSet<PersistentID> compactedStores = new HashSet<>();
if (cache != null && !cache.isClosed()) {
for (DiskStore store : cache.listDiskStoresIncludingRegionOwned()) {
if (store.forceCompaction()) {
compactedStores.add(((DiskStoreImpl) store).getPersistentID());
}
}
}
return new CompactResponse(this.getSender(), compactedStores);
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class MissingPersistentIDsRequest method send.
public static Set<PersistentID> send(DM dm) {
Set recipients = dm.getOtherDistributionManagerIds();
MissingPersistentIDsRequest request = new MissingPersistentIDsRequest();
request.setRecipients(recipients);
MissingPersistentIDProcessor replyProcessor = new MissingPersistentIDProcessor(dm, recipients);
request.msgId = replyProcessor.getProcessorId();
dm.putOutgoing(request);
try {
replyProcessor.waitForReplies();
} catch (ReplyException e) {
if (!(e.getCause() instanceof CancelException)) {
throw e;
}
} catch (InterruptedException e) {
logger.warn(e);
}
Set<PersistentID> results = replyProcessor.missing;
Set<PersistentID> existing = replyProcessor.existing;
MissingPersistentIDsResponse localResponse = (MissingPersistentIDsResponse) request.createResponse((DistributionManager) dm);
results.addAll(localResponse.getMissingIds());
existing.addAll(localResponse.getLocalIds());
results.removeAll(existing);
return results;
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class MissingPersistentIDsResponse method fromData.
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
int size = in.readInt();
missingIds = new HashSet<PersistentID>(size);
for (int i = 0; i < size; i++) {
PersistentMemberPattern pattern = new PersistentMemberPattern();
InternalDataSerializer.invokeFromData(pattern, in);
missingIds.add(pattern);
}
size = in.readInt();
localIds = new HashSet<PersistentID>(size);
for (int i = 0; i < size; i++) {
PersistentMemberPattern pattern = new PersistentMemberPattern();
InternalDataSerializer.invokeFromData(pattern, in);
localIds.add(pattern);
}
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class MissingPersistentIDsResponse method toData.
@Override
public void toData(DataOutput out) throws IOException {
super.toData(out);
out.writeInt(missingIds.size());
for (PersistentID pattern : missingIds) {
InternalDataSerializer.invokeToData(pattern, out);
}
out.writeInt(localIds.size());
for (PersistentID pattern : localIds) {
InternalDataSerializer.invokeToData(pattern, out);
}
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class DistributedSystemBridge method listMissingDiskStores.
/**
* In case of replicated region during recovery all region recovery will wait till all the
* replicated region member are up and running so that the recovered data from the disk will be in
* sync;
*
* @return Array of PersistentMemberDetails (which contains host, directory and disk store id)
*/
public PersistentMemberDetails[] listMissingDiskStores() {
PersistentMemberDetails[] missingDiskStores = null;
Set<PersistentID> persistentMemberSet = MissingPersistentIDsRequest.send(dm);
if (persistentMemberSet != null && persistentMemberSet.size() > 0) {
missingDiskStores = new PersistentMemberDetails[persistentMemberSet.size()];
int j = 0;
for (PersistentID id : persistentMemberSet) {
missingDiskStores[j] = new PersistentMemberDetails(id.getHost().getCanonicalHostName(), id.getDirectory(), id.getUUID().toString());
j++;
}
}
return missingDiskStores;
}
Aggregations