Search in sources :

Example 11 with PersistentID

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);
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) InternalCache(org.apache.geode.internal.cache.InternalCache) HashSet(java.util.HashSet) PersistentID(org.apache.geode.cache.persistence.PersistentID)

Example 12 with PersistentID

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;
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) CancelException(org.apache.geode.CancelException) ReplyException(org.apache.geode.distributed.internal.ReplyException) DistributionManager(org.apache.geode.distributed.internal.DistributionManager) PersistentID(org.apache.geode.cache.persistence.PersistentID)

Example 13 with PersistentID

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);
    }
}
Also used : PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern) PersistentID(org.apache.geode.cache.persistence.PersistentID)

Example 14 with PersistentID

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);
    }
}
Also used : PersistentID(org.apache.geode.cache.persistence.PersistentID)

Example 15 with PersistentID

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;
}
Also used : PersistentMemberDetails(org.apache.geode.management.PersistentMemberDetails) PersistentID(org.apache.geode.cache.persistence.PersistentID)

Aggregations

PersistentID (org.apache.geode.cache.persistence.PersistentID)29 HashSet (java.util.HashSet)11 File (java.io.File)8 Set (java.util.Set)8 IOException (java.io.IOException)7 DiskStore (org.apache.geode.cache.DiskStore)7 InternalCache (org.apache.geode.internal.cache.InternalCache)6 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)5 DistributedMember (org.apache.geode.distributed.DistributedMember)5 Map (java.util.Map)4 AdminException (org.apache.geode.admin.AdminException)4 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)4 LinkedList (java.util.LinkedList)3 TreeSet (java.util.TreeSet)3 RegexFileFilter (org.apache.commons.io.filefilter.RegexFileFilter)3 AdminDistributedSystem (org.apache.geode.admin.AdminDistributedSystem)3 BackupStatus (org.apache.geode.admin.BackupStatus)3 DistributedSystemConfig (org.apache.geode.admin.DistributedSystemConfig)3