use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class MemberMBeanBridge method compactAllDiskStores.
/**
* An instruction to members with cache that they should compact their disk stores.
*
* @return a list of compacted Disk stores
*/
public String[] compactAllDiskStores() {
List<String> compactedStores = new ArrayList<String>();
if (cache != null && !cache.isClosed()) {
for (DiskStore store : this.cache.listDiskStoresIncludingRegionOwned()) {
if (store.forceCompaction()) {
compactedStores.add(((DiskStoreImpl) store).getPersistentID().getDirectory());
}
}
}
String[] compactedStoresAr = new String[compactedStores.size()];
return compactedStores.toArray(compactedStoresAr);
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class CompactRequest method compactDiskStore.
public static PersistentID compactDiskStore(String diskStoreName) {
PersistentID persistentID = null;
InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
DiskStoreImpl diskStore = (DiskStoreImpl) cache.findDiskStore(diskStoreName);
if (diskStore != null && diskStore.forceCompaction()) {
persistentID = diskStore.getPersistentID();
}
}
return persistentID;
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class BackupManager method finishBackup.
public HashSet<PersistentID> finishBackup(File targetDir, File baselineDir, boolean abort) throws IOException {
try {
if (abort) {
return new HashSet<PersistentID>();
}
File backupDir = getBackupDir(targetDir);
// Make sure our baseline is okay for this member
baselineDir = checkBaseline(baselineDir);
// Create an inspector for the baseline backup
BackupInspector inspector = (baselineDir == null ? null : BackupInspector.createInspector(baselineDir));
File storesDir = new File(backupDir, DATA_STORES);
RestoreScript restoreScript = new RestoreScript();
HashSet<PersistentID> persistentIds = new HashSet<PersistentID>();
Collection<DiskStore> diskStores = new ArrayList<DiskStore>(cache.listDiskStoresIncludingRegionOwned());
boolean foundPersistentData = false;
for (Iterator<DiskStore> itr = diskStores.iterator(); itr.hasNext(); ) {
DiskStoreImpl store = (DiskStoreImpl) itr.next();
if (store.hasPersistedData()) {
if (!foundPersistentData) {
createBackupDir(backupDir);
foundPersistentData = true;
}
File diskStoreDir = new File(storesDir, store.getBackupDirName());
diskStoreDir.mkdir();
store.startBackup(diskStoreDir, inspector, restoreScript);
} else {
itr.remove();
}
store.releaseBackupLock();
}
allowDestroys.countDown();
for (DiskStore store : diskStores) {
DiskStoreImpl storeImpl = (DiskStoreImpl) store;
storeImpl.finishBackup(this);
storeImpl.getStats().endBackup();
persistentIds.add(storeImpl.getPersistentID());
}
if (foundPersistentData) {
backupConfigFiles(restoreScript, backupDir);
backupUserFiles(restoreScript, backupDir);
backupDeployedJars(restoreScript, backupDir);
restoreScript.generate(backupDir);
File incompleteFile = new File(backupDir, INCOMPLETE_BACKUP);
if (!incompleteFile.delete()) {
throw new IOException("Could not delete file " + INCOMPLETE_BACKUP);
}
}
return persistentIds;
} finally {
cleanup();
}
}
use of org.apache.geode.internal.cache.DiskStoreImpl in project geode by apache.
the class BackupManager method prepareBackup.
public HashSet<PersistentID> prepareBackup() {
HashSet<PersistentID> persistentIds = new HashSet<PersistentID>();
Collection<DiskStore> diskStores = cache.listDiskStoresIncludingRegionOwned();
for (DiskStore store : diskStores) {
DiskStoreImpl storeImpl = (DiskStoreImpl) store;
storeImpl.lockStoreBeforeBackup();
if (storeImpl.hasPersistedData()) {
persistentIds.add(storeImpl.getPersistentID());
storeImpl.getStats().startBackup();
}
}
return persistentIds;
}
Aggregations