public boolean hasPersistentRegions() { Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); boolean hasPersistentRegions = false; for(DiskStoreImpl store : diskStores) { hasPersistentRegions |= store.hasPersistedData(); } return hasPersistentRegions; }
private static List<DiskStoreImpl> listDiskStores(boolean includeDataDictionary) { List<DiskStoreImpl> diskStoresList = new ArrayList<DiskStoreImpl>(); GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for (DiskStoreImpl diskStore : diskStores) { if (!diskStore.getName().equals(GfxdConstants.GFXD_DD_DISKSTORE_NAME) || includeDataDictionary) { diskStoresList.add(diskStore); } } return diskStoresList; }
private static List<DiskStoreImpl> listDiskStores(boolean includeDataDictionary) { List<DiskStoreImpl> diskStoresList = new ArrayList<DiskStoreImpl>(); GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for (DiskStoreImpl diskStore : diskStores) { if (!diskStore.getName().equals(GfxdConstants.GFXD_DD_DISKSTORE_NAME) || includeDataDictionary) { diskStoresList.add(diskStore); } } return diskStoresList; }
private static List<DiskStoreImpl> listDiskStores(boolean includeDataDictionary) { List<DiskStoreImpl> diskStoresList = new ArrayList<DiskStoreImpl>(); GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for (DiskStoreImpl diskStore : diskStores) { if (!diskStore.getName().equals(GfxdConstants.GFXD_DD_DISKSTORE_NAME) || includeDataDictionary) { diskStoresList.add(diskStore); } } return diskStoresList; }
private Collection<DiskStoreImpl> getDiskStoresToBackUp(byte diskStoresToBackup) { Collection<DiskStoreImpl> allDses = cache.listDiskStoresIncludingRegionOwned(); switch (diskStoresToBackup) { case FinishBackupRequest.DISKSTORE_ALL: return allDses; case FinishBackupRequest.DISKSTORE_ALL_BUT_DD: allDses.removeIf(ds -> ds.getName().equals("GFXD-DD-DISKSTORE")); return allDses; case FinishBackupRequest.DISKSTORE_DD: Optional<DiskStoreImpl> ods = allDses.stream().filter (ds -> ds.getName().equals("GFXD-DD-DISKSTORE")).findFirst(); if (ods.isPresent()) { return Collections.singletonList(ods.get()); } } return Collections.emptyList(); }
/** * List all the disk Stores at member level * * @param includeRegionOwned * indicates whether to show the disk belonging to any particular * region * @return list all the disk Stores name at cache level */ public String[] listDiskStores(boolean includeRegionOwned) { GemFireCacheImpl cacheImpl = (GemFireCacheImpl) cache; String[] retStr = null; Collection<DiskStoreImpl> diskCollection = null; if (includeRegionOwned) { diskCollection = cacheImpl.listDiskStoresIncludingRegionOwned(); } else { diskCollection = cacheImpl.listDiskStores(); } if (diskCollection != null && diskCollection.size() > 0) { retStr = new String[diskCollection.size()]; Iterator<DiskStoreImpl> it = diskCollection.iterator(); int i = 0; while (it.hasNext()) { retStr[i] = it.next().getName(); i++; } } return retStr; }
/** * Returns the memberId directory for this member in the baseline. The memberId may have changed if this * member has been restarted since the last backup. * @param baselineParentDir parent directory of last backup. * @return null if the baseline for this member could not be located. */ private File findBaselineForThisMember(File baselineParentDir) { File baselineDir = null; /* * Find the first matching DiskStoreId directory for this member. */ for(DiskStoreImpl diskStore : cache.listDiskStoresIncludingRegionOwned()) { baselineDir = FileUtil.find(baselineParentDir, ".*" + diskStore.getBackupDirName() + "$"); if(null != baselineDir) { break; } } /* * We found it? Good. Set this member's baseline to the backed up disk store's member dir (two levels up). */ if(null != baselineDir) { baselineDir = baselineDir.getParentFile().getParentFile(); } return baselineDir; }
/** * Returns the memberId directory for this member in the baseline. The memberId may have changed if this * member has been restarted since the last backup. * @param baselineParentDir parent directory of last backup. * @return null if the baseline for this member could not be located. */ private File findBaselineForThisMember(File baselineParentDir) { File baselineDir = null; /* * Find the first matching DiskStoreId directory for this member. */ for(DiskStoreImpl diskStore : cache.listDiskStoresIncludingRegionOwned()) { baselineDir = FileUtil.find(baselineParentDir, ".*" + diskStore.getBackupDirName() + "$"); if(null != baselineDir) { break; } } /* * We found it? Good. Set this member's baseline to the backed up disk store's member dir (two levels up). */ if(null != baselineDir) { baselineDir = baselineDir.getParentFile().getParentFile(); } return baselineDir; }
/** * An instruction to members with cache that they should compact their disk * stores. * * @return a list of compacted Disk stores */ public String[] compactAllDiskStores() { GemFireCacheImpl cacheImpl = (GemFireCacheImpl) cache; List<String> compactedStores = new ArrayList<String>(); if (cache != null && !cache.isClosed()) { for (DiskStoreImpl store : cacheImpl.listDiskStoresIncludingRegionOwned()) { if (store.forceCompaction()) { compactedStores.add(store.getPersistentID().getDirectory()); } } } String[] compactedStoresAr = new String[compactedStores.size()]; return compactedStores.toArray(compactedStoresAr); }
/** * An instruction to members with cache that they should compact their disk * stores. * * @return a list of compacted Disk stores */ public String[] compactAllDiskStores() { GemFireCacheImpl cacheImpl = (GemFireCacheImpl) cache; List<String> compactedStores = new ArrayList<String>(); if (cache != null && !cache.isClosed()) { for (DiskStoreImpl store : cacheImpl.listDiskStoresIncludingRegionOwned()) { if (store.forceCompaction()) { compactedStores.add(store.getPersistentID().getDirectory()); } } } String[] compactedStoresAr = new String[compactedStores.size()]; return compactedStores.toArray(compactedStoresAr); }
public HashSet<PersistentID> prepareBackup() { HashSet<PersistentID> persistentIds = new HashSet<PersistentID>(); Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for(DiskStoreImpl store : diskStores) { store.lockStoreBeforeBackup(); if(store.hasPersistedData()) { persistentIds.add(store.getPersistentID()); store.getStats().startBackup(); } } return persistentIds; }
public HashSet<PersistentID> prepareBackup() { HashSet<PersistentID> persistentIds = new HashSet<PersistentID>(); Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for(DiskStoreImpl store : diskStores) { store.lockStoreBeforeBackup(); if(store.hasPersistedData()) { persistentIds.add(store.getPersistentID()); store.getStats().startBackup(); } } return persistentIds; }
private void cleanup() { isCancelled = true; allowDestroys.countDown(); this.incompleteRestoreScript = null; Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for(DiskStoreImpl store : diskStores) { store.releaseBackupLock(); } final DM distributionManager = cache.getDistributedSystem().getDistributionManager(); distributionManager.removeAllMembershipListener(this); cache.clearBackupManager(); }
private void cleanup() { isCancelled = true; allowDestroys.countDown(); Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for(DiskStoreImpl store : diskStores) { store.releaseBackupLock(); } final DM distributionManager = cache.getDistributedSystem().getDistributionManager(); distributionManager.removeAllMembershipListener(this); cache.clearBackupManager(); }
@Override protected AdminResponse createResponse(DistributionManager dm) { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); HashSet<PersistentID> compactedStores = new HashSet<PersistentID>(); if(cache != null && !cache.isClosed()) { for(DiskStoreImpl store : cache.listDiskStoresIncludingRegionOwned()) { if(store.forceCompaction()) { compactedStores.add(store.getPersistentID()); } } } return new CompactResponse(this.getSender(), compactedStores); }
@Override protected AdminResponse createResponse(DistributionManager dm) { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); HashSet<PersistentID> compactedStores = new HashSet<PersistentID>(); if(cache != null && !cache.isClosed()) { for(DiskStoreImpl store : cache.listDiskStoresIncludingRegionOwned()) { if(store.forceCompaction()) { compactedStores.add(store.getPersistentID()); } } } return new CompactResponse(this.getSender(), compactedStores); }
@Override protected AdminResponse createResponse(DistributionManager dm) { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); HashSet<PersistentID> persistentIds; if(cache != null) { Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for(DiskStoreImpl store : diskStores) { store.flush(); } } return new FlushToDiskResponse(this.getSender()); }
@Override protected AdminResponse createResponse(DistributionManager dm) { GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); HashSet<PersistentID> persistentIds; if(cache != null) { Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); for(DiskStoreImpl store : diskStores) { store.flush(); } } return new FlushToDiskResponse(this.getSender()); }
void verifyConfiguration() { if(typeRegistryInUse) { return; } else { Collection<DiskStoreImpl> diskStores = cache.listDiskStoresIncludingRegionOwned(); boolean hasPersistentRegions = false; for(DiskStoreImpl store : diskStores) { hasPersistentRegions |= store.hasPersistedData(); } checkAllowed(!cache.getGatewayHubs().isEmpty(), !cache.getGatewaySenders().isEmpty(), hasPersistentRegions); for(Pool pool : PoolManager.getAll().values()) { if(!((PoolImpl) pool).isUsedByGateway()) { throw new PdxInitializationException("The PDX metadata has already been " + "created as a peer metadata region. " + "Please use ClientCacheFactory to create clients."); } } typeRegistryInUse = true; } }
@Override public void processMessage(Object[] params, DistributedMember sender) throws StandardException { String diskStoreName = (String)params[0]; SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_SYS_PROCEDURES, "GfxdSystemProcedureMessage: fsyncing diskstore " + diskStoreName); GemFireCacheImpl cache = GemFireCacheImpl.getExisting(); if (diskStoreName != null) { DiskStoreImpl diskStore = cache.findDiskStore(diskStoreName); if (diskStore == null) { // check for upper-case name diskStore = cache.findDiskStore(SharedUtils .SQLToUpperCase(diskStoreName)); if (diskStore == null) { throw StandardException.newException( SQLState.LANG_OBJECT_DOES_NOT_EXIST, "FSYNC DISKSTORE", diskStoreName); } } diskStore.flushAndSync(); } else { // fsync all disk stores for (DiskStoreImpl diskStore : cache .listDiskStoresIncludingRegionOwned()) { diskStore.flushAndSync(); } } }