Search in sources :

Example 1 with PersistentMemberPattern

use of org.apache.geode.internal.cache.persistence.PersistentMemberPattern in project geode by apache.

the class AdminDistributedSystemImpl method revokePersistentMember.

/**
   * 
   * @deprecated use {@link #revokePersistentMember(UUID)} instead
   */
public static void revokePersistentMember(DM dm, InetAddress host, String directory) {
    PersistentMemberPattern pattern = new PersistentMemberPattern(host, directory, System.currentTimeMillis());
    boolean success = false;
    try {
        // Fix for 42607 - verify that the persistent id is not already
        // running before revoking it.
        PrepareRevokePersistentIDRequest.send(dm, pattern);
        success = true;
    } finally {
        if (success) {
            // revoke the persistent member if were able to prepare the revoke
            RevokePersistentIDRequest.send(dm, pattern);
        } else {
            // otherwise, cancel the revoke.
            PrepareRevokePersistentIDRequest.cancel(dm, pattern);
        }
    }
}
Also used : PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern)

Example 2 with PersistentMemberPattern

use of org.apache.geode.internal.cache.persistence.PersistentMemberPattern in project geode by apache.

the class ClusterConfigurationService method getStatus.

/**
   * Gets the current status of the ClusterConfigurationService If the status is started , it
   * determines if the shared configuration is waiting for new configuration on other locators
   * 
   * @return {@link SharedConfigurationStatus}
   */
public SharedConfigurationStatus getStatus() {
    SharedConfigurationStatus scStatus = this.status.get();
    if (scStatus == SharedConfigurationStatus.STARTED) {
        PersistentMemberManager pmm = this.cache.getPersistentMemberManager();
        Map<String, Set<PersistentMemberID>> waitingRegions = pmm.getWaitingRegions();
        if (!waitingRegions.isEmpty()) {
            this.status.compareAndSet(SharedConfigurationStatus.STARTED, SharedConfigurationStatus.WAITING);
            Set<PersistentMemberID> persMemIds = waitingRegions.get(Region.SEPARATOR_CHAR + CONFIG_REGION_NAME);
            for (PersistentMemberID persMemId : persMemIds) {
                this.newerSharedConfigurationLocatorInfo.add(new PersistentMemberPattern(persMemId));
            }
        }
    }
    return this.status.get();
}
Also used : SharedConfigurationStatus(org.apache.geode.management.internal.configuration.domain.SharedConfigurationStatus) PersistentMemberManager(org.apache.geode.internal.cache.persistence.PersistentMemberManager) PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern) Set(java.util.Set) HashSet(java.util.HashSet) PersistentMemberID(org.apache.geode.internal.cache.persistence.PersistentMemberID)

Example 3 with PersistentMemberPattern

use of org.apache.geode.internal.cache.persistence.PersistentMemberPattern in project geode by apache.

the class MissingPersistentIDsRequest method createResponse.

@Override
protected AdminResponse createResponse(DistributionManager dm) {
    Set<PersistentID> missingIds = new HashSet<>();
    Set<PersistentID> localPatterns = new HashSet<>();
    InternalCache cache = GemFireCacheImpl.getInstance();
    if (cache != null && !cache.isClosed()) {
        PersistentMemberManager mm = cache.getPersistentMemberManager();
        Map<String, Set<PersistentMemberID>> waitingRegions = mm.getWaitingRegions();
        for (Map.Entry<String, Set<PersistentMemberID>> entry : waitingRegions.entrySet()) {
            for (PersistentMemberID id : entry.getValue()) {
                missingIds.add(new PersistentMemberPattern(id));
            }
        }
        Set<PersistentMemberID> localIds = mm.getPersistentIDs();
        for (PersistentMemberID id : localIds) {
            localPatterns.add(new PersistentMemberPattern(id));
        }
    }
    return new MissingPersistentIDsResponse(missingIds, localPatterns, this.getSender());
}
Also used : PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) InternalCache(org.apache.geode.internal.cache.InternalCache) PersistentMemberID(org.apache.geode.internal.cache.persistence.PersistentMemberID) PersistentMemberManager(org.apache.geode.internal.cache.persistence.PersistentMemberManager) Map(java.util.Map) HashSet(java.util.HashSet) PersistentID(org.apache.geode.cache.persistence.PersistentID)

Example 4 with PersistentMemberPattern

use of org.apache.geode.internal.cache.persistence.PersistentMemberPattern in project geode by apache.

the class DiskStoreCommands method toMissingDiskStoresTabularResult.

protected Result toMissingDiskStoresTabularResult(final List<Object> resultDetails) throws ResultDataException {
    CompositeResultData crd = ResultBuilder.createCompositeResultData();
    List<PersistentMemberPattern> missingDiskStores = new ArrayList<PersistentMemberPattern>();
    List<ColocatedRegionDetails> missingColocatedRegions = new ArrayList<ColocatedRegionDetails>();
    for (Object detail : resultDetails) {
        if (detail instanceof PersistentMemberPattern) {
            missingDiskStores.add((PersistentMemberPattern) detail);
        } else if (detail instanceof ColocatedRegionDetails) {
            missingColocatedRegions.add((ColocatedRegionDetails) detail);
        } else {
            throw new ResultDataException("Unknown type of PersistentRecoveryFailures result");
        }
    }
    boolean hasMissingDiskStores = !missingDiskStores.isEmpty();
    boolean hasMissingColocatedRegions = !missingColocatedRegions.isEmpty();
    if (hasMissingDiskStores) {
        SectionResultData missingDiskStoresSection = crd.addSection();
        missingDiskStoresSection.setHeader("Missing Disk Stores");
        TabularResultData missingDiskStoreData = missingDiskStoresSection.addTable();
        for (PersistentMemberPattern peristentMemberDetails : missingDiskStores) {
            missingDiskStoreData.accumulate("Disk Store ID", peristentMemberDetails.getUUID());
            missingDiskStoreData.accumulate("Host", peristentMemberDetails.getHost());
            missingDiskStoreData.accumulate("Directory", peristentMemberDetails.getDirectory());
        }
    } else {
        SectionResultData noMissingDiskStores = crd.addSection();
        noMissingDiskStores.setHeader("No missing disk store found");
    }
    if (hasMissingDiskStores || hasMissingColocatedRegions) {
        // For clarity, separate disk store and colocated region information
        crd.addSection().setHeader("\n");
    }
    if (hasMissingColocatedRegions) {
        SectionResultData missingRegionsSection = crd.addSection();
        missingRegionsSection.setHeader("Missing Colocated Regions");
        TabularResultData missingRegionData = missingRegionsSection.addTable();
        for (ColocatedRegionDetails colocatedRegionDetails : missingColocatedRegions) {
            missingRegionData.accumulate("Host", colocatedRegionDetails.getHost());
            missingRegionData.accumulate("Distributed Member", colocatedRegionDetails.getMember());
            missingRegionData.accumulate("Parent Region", colocatedRegionDetails.getParent());
            missingRegionData.accumulate("Missing Colocated Region", colocatedRegionDetails.getChild());
        }
    } else {
        SectionResultData noMissingColocatedRegions = crd.addSection();
        noMissingColocatedRegions.setHeader("No missing colocated region found");
    }
    return ResultBuilder.buildResult(crd);
}
Also used : PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern) CompositeResultData(org.apache.geode.management.internal.cli.result.CompositeResultData) TabularResultData(org.apache.geode.management.internal.cli.result.TabularResultData) ColocatedRegionDetails(org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails) ResultDataException(org.apache.geode.management.internal.cli.result.ResultDataException) ArrayList(java.util.ArrayList) SectionResultData(org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)

Example 5 with PersistentMemberPattern

use of org.apache.geode.internal.cache.persistence.PersistentMemberPattern in project geode by apache.

the class ShowMissingDiskStoresFunction method execute.

@Override
public void execute(FunctionContext context) {
    final Set<PersistentMemberPattern> memberMissingIDs = new HashSet<PersistentMemberPattern>();
    Set<ColocatedRegionDetails> missingColocatedRegions = new HashSet<ColocatedRegionDetails>();
    if (context == null) {
        throw new RuntimeException();
    }
    try {
        final InternalCache cache = getCache();
        if (cache != null && !cache.isClosed()) {
            final DistributedMember member = cache.getMyId();
            // Missing DiskStores
            PersistentMemberManager mm = cache.getPersistentMemberManager();
            Map<String, Set<PersistentMemberID>> waitingRegions = mm.getWaitingRegions();
            for (Set<PersistentMemberID> entry : waitingRegions.values()) {
                for (PersistentMemberID id : entry) {
                    memberMissingIDs.add(new PersistentMemberPattern(id));
                }
            }
            // Missing colocated regions
            Set<PartitionedRegion> prs = cache.getPartitionedRegions();
            for (PartitionedRegion pr : prs) {
                List<String> missingChildRegions = pr.getMissingColocatedChildren();
                for (String child : missingChildRegions) {
                    missingColocatedRegions.add(new ColocatedRegionDetails(member.getHost(), member.getName(), pr.getFullPath(), child));
                }
            }
        }
        if (memberMissingIDs.isEmpty() && missingColocatedRegions.isEmpty()) {
            context.getResultSender().lastResult(null);
        } else {
            if (!memberMissingIDs.isEmpty()) {
                if (missingColocatedRegions.isEmpty()) {
                    context.getResultSender().lastResult(memberMissingIDs);
                } else {
                    context.getResultSender().sendResult(memberMissingIDs);
                }
            }
            if (!missingColocatedRegions.isEmpty()) {
                context.getResultSender().lastResult(missingColocatedRegions);
            }
        }
    } catch (Exception e) {
        context.getResultSender().sendException(e);
    }
}
Also used : PersistentMemberPattern(org.apache.geode.internal.cache.persistence.PersistentMemberPattern) Set(java.util.Set) HashSet(java.util.HashSet) InternalCache(org.apache.geode.internal.cache.InternalCache) PersistentMemberID(org.apache.geode.internal.cache.persistence.PersistentMemberID) PersistentMemberManager(org.apache.geode.internal.cache.persistence.PersistentMemberManager) ColocatedRegionDetails(org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) DistributedMember(org.apache.geode.distributed.DistributedMember) HashSet(java.util.HashSet)

Aggregations

PersistentMemberPattern (org.apache.geode.internal.cache.persistence.PersistentMemberPattern)14 HashSet (java.util.HashSet)5 Set (java.util.Set)5 PersistentMemberID (org.apache.geode.internal.cache.persistence.PersistentMemberID)5 PersistentID (org.apache.geode.cache.persistence.PersistentID)3 ColocatedRegionDetails (org.apache.geode.internal.cache.partitioned.ColocatedRegionDetails)3 PersistentMemberManager (org.apache.geode.internal.cache.persistence.PersistentMemberManager)3 InetAddress (java.net.InetAddress)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 InternalCache (org.apache.geode.internal.cache.InternalCache)2 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)2 DiskStoreID (org.apache.geode.internal.cache.persistence.DiskStoreID)2 UnitTest (org.apache.geode.test.junit.categories.UnitTest)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 DistributedMember (org.apache.geode.distributed.DistributedMember)1