use of org.apache.geode.cache.persistence.PersistentID 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.cache.persistence.PersistentID in project geode by apache.
the class CacheAndRegionListenerImpl method getMissingPersistentMembersJMX.
public TabularData getMissingPersistentMembersJMX() throws AdminException {
try {
Set<PersistentID> members = super.getMissingPersistentMembers();
TabularData results = new TabularDataSupport(PERSISTENT_ID_TABLE_TYPE);
int index = 0;
for (PersistentID id : members) {
CompositeData idData = new CompositeDataSupport(PERSISTENT_ID_TYPE, PERSISTENT_ID_FIELDS, new Object[] { id.getHost().toString(), id.getDirectory(), id.getUUID().toString() });
results.put(idData);
index++;
}
return results;
} catch (OpenDataException e) {
logger.warn("Exception occurred while getting missing persistent members.", e);
throw new AdminException(e);
}
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class AdminDistributedSystemImpl method backupAllMembers.
public static BackupStatus backupAllMembers(DM dm, File targetDir, File baselineDir) throws AdminException {
BackupStatus status = null;
if (BackupDataStoreHelper.obtainLock(dm)) {
try {
Set<PersistentID> missingMembers = getMissingPersistentMembers(dm);
Set recipients = dm.getOtherDistributionManagerIds();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
targetDir = new File(targetDir, format.format(new Date()));
BackupDataStoreResult result = BackupDataStoreHelper.backupAllMembers(dm, recipients, targetDir, baselineDir);
// should override the previous missingMembers
for (Set<PersistentID> onlineMembersIds : result.getSuccessfulMembers().values()) {
missingMembers.removeAll(onlineMembersIds);
}
result.getExistingDataStores().keySet().removeAll(result.getSuccessfulMembers().keySet());
for (Set<PersistentID> lostMembersIds : result.getExistingDataStores().values()) {
missingMembers.addAll(lostMembersIds);
}
status = new BackupStatusImpl(result.getSuccessfulMembers(), missingMembers);
} finally {
BackupDataStoreHelper.releaseLock(dm);
}
} else {
throw new AdminException(LocalizedStrings.DistributedSystem_BACKUP_ALREADY_IN_PROGRESS.toLocalizedString());
}
return status;
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class AdminDistributedSystemImpl method revokePersistentMember.
public static void revokePersistentMember(DM dm, UUID diskStoreID) {
PersistentMemberPattern pattern = new PersistentMemberPattern(diskStoreID);
boolean success = false;
try {
// make sure that the disk store we're revoking is actually missing
boolean found = false;
Set<PersistentID> details = getMissingPersistentMembers(dm);
if (details != null) {
for (PersistentID id : details) {
if (id.getUUID().equals(diskStoreID)) {
found = true;
break;
}
}
}
if (!found) {
return;
}
// 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);
}
}
}
use of org.apache.geode.cache.persistence.PersistentID in project geode by apache.
the class PrepareBackupRequest method createResponse.
@Override
protected AdminResponse createResponse(DistributionManager dm) {
InternalCache cache = GemFireCacheImpl.getInstance();
HashSet<PersistentID> persistentIds;
if (cache == null) {
persistentIds = new HashSet<>();
} else {
try {
BackupManager manager = cache.startBackup(getSender());
persistentIds = manager.prepareBackup();
} catch (IOException e) {
logger.error(LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e);
return AdminFailureResponse.create(dm, getSender(), e);
}
}
return new PrepareBackupResponse(this.getSender(), persistentIds);
}
Aggregations