protected static String getStartupRecoveryDelay(PartitionAttributes pa) { return String.valueOf(pa.getStartupRecoveryDelay()); } protected static String getMultiuserAuthentication(Pool pool) {
/** * Returns the partition attributes as a string. For use only by {@link * RegionDescription#partitionAttributesToString(PartitionAttributes)}. */ protected static synchronized String partitionAttributesToString( PartitionAttributes p) { if (p == null) { return "null"; } StringBuffer buf = new StringBuffer(); buf.append("\n colocatedWith: " + p.getColocatedWith()); buf.append("\n fixedPartitionAttributes: " + p.getFixedPartitionAttributes()); buf.append("\n localMaxMemory: " + p.getLocalMaxMemory()); buf.append("\n partitionListeners: " + Arrays.toString(p.getPartitionListeners())); buf.append("\n partitionResolver: " + p.getPartitionResolver()); buf.append("\n recoveryDelay: " + p.getRecoveryDelay()); buf.append("\n redundantCopies: " + p.getRedundantCopies()); buf.append("\n startupRecoveryDelay: " + p.getStartupRecoveryDelay()); buf.append("\n totalMaxMemory: " + p.getTotalMaxMemory()); buf.append("\n totalNumBuckets: " + p.getTotalNumBuckets()); return buf.toString(); }
this.colocatedWith = partitionAttributes.getColocatedWith(); this.recoveryDelay = partitionAttributes.getRecoveryDelay(); this.startupRecoveryDelay = partitionAttributes.getStartupRecoveryDelay(); PartitionResolver<?, ?> partitionResolver = partitionAttributes.getPartitionResolver();
/** * Waits for recovery in self vm after reconnect */ protected void waitForSelfRecovery(){ RegionAttributes attr = aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); if(prAttr != null){ List otherVMs = new ArrayList(ClientVmMgr.getOtherClientVmids()); int numPRs = (ConfigPrms.getHadoopConfig() != null) ? 2 : 1; PRObserver.waitForRecovery(prAttr.getRecoveryDelay(), prAttr.getStartupRecoveryDelay(), new Integer(RemoteTestModule.getMyVmid()), otherVMs, 1, numPRs, null, null); } }
/** * Resets the partition description based on partition attributes, to pick up * product defaults and side-effects. */ private static void resetPartitionDescription(PartitionDescription pd, PartitionAttributes pa) { if (pd.getLocalMaxMemory() != null) { pd.setLocalMaxMemory(new Integer(pa.getLocalMaxMemory())); } // else deferred pd.setRecoveryDelay(new Long(pa.getRecoveryDelay())); pd.setRedundantCopies(new Integer(pa.getRedundantCopies())); pd.setStartupRecoveryDelay(new Long(pa.getStartupRecoveryDelay())); pd.setTotalMaxMemory(new Long(pa.getTotalMaxMemory())); pd.setTotalNumBuckets(new Integer(pa.getTotalNumBuckets())); }
/** * Waits for recovery in self vm after reconnect */ protected void waitForSelfRecovery(){ if(isNewWan()){ RegionAttributes attr = aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); if(prAttr != null){ // in newWan wbcl, the queue's shadow PR is added AsyncEventQueueDescription aed = AsyncEventQueueHelper.getAsyncEventQueueDescription("wbclQueue"); int numPRs = 1; if(aed != null && aed.getParallel().booleanValue()){ numPRs = 2; } List otherVMs = new ArrayList(ClientVmMgr.getOtherClientVmids()); PRObserver.waitForRecovery(prAttr.getRecoveryDelay(), prAttr.getStartupRecoveryDelay(), new Integer(RemoteTestModule.getMyVmid()), otherVMs, 1, numPRs, null, null); } }else{ super.waitForSelfRecovery(); } }
/** For all PRs, wait for startup recovery in this VM. * */ public static void HydraTask_waitForMyStartupRecovery() { int numPRs = 0; List prNameList = new ArrayList(); int myVmID = RemoteTestModule.getMyVmid(); for (Region aRegion: testInstance.allRegions) { if (aRegion.getAttributes().getDataPolicy().withPartitioning()) { PartitionAttributes prAttr = aRegion.getAttributes().getPartitionAttributes(); if ((prAttr.getStartupRecoveryDelay() >= 0) && (prAttr.getRedundantCopies() != 0)) { numPRs++; prNameList.add(aRegion.getFullPath()); } } } if (numPRs > 0) { PRObserver.waitForRebalRecov(myVmID, 1, numPRs, prNameList, null, false); } }
public synchronized static void HydraTask_HA_dataStoreInitialize() { if (testInstance == null) { testInstance = new EventsDuringRecoveryTest(); ((KnownKeysTest)testInstance).initInstance("dataStoreRegion"); ParRegBB.getBB().getSharedMap().put(DataStoreVmStr + RemoteTestModule.getMyVmid(), new Integer(RemoteTestModule.getMyVmid())); if (isBridgeConfiguration) { BridgeHelper.startBridgeServer("bridge"); } RegionAttributes attr = testInstance.aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(prAttr.getRecoveryDelay())); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(prAttr.getStartupRecoveryDelay())); } }
public static PartitionAttributesData getPartitionAttributesData(PartitionAttributes partAttrs) { int redundantCopies = partAttrs.getRedundantCopies(); long totalMaxMemory = partAttrs.getTotalMaxMemory(); // Total number of buckets for whole region int totalNumBuckets = partAttrs.getTotalNumBuckets(); int localMaxMemory = partAttrs.getLocalMaxMemory(); String colocatedWith = partAttrs.getColocatedWith(); String partitionResolver = null; if (partAttrs.getPartitionResolver() != null) { partitionResolver = partAttrs.getPartitionResolver().getName(); } long recoveryDelay = partAttrs.getRecoveryDelay(); long startupRecoveryDelay = partAttrs.getStartupRecoveryDelay(); String[] partitionListeners = null; if (partAttrs.getPartitionListeners() != null) { partitionListeners = new String[partAttrs.getPartitionListeners().length]; for (int i = 0; i < partAttrs.getPartitionListeners().length; i++) { partitionListeners[i] = (partAttrs.getPartitionListeners())[i].getClass().getCanonicalName(); } } PartitionAttributesData partitionAttributesData = new PartitionAttributesData(redundantCopies, totalMaxMemory, totalNumBuckets, localMaxMemory, colocatedWith, partitionResolver, recoveryDelay, startupRecoveryDelay, partitionListeners); return partitionAttributesData; }
public synchronized static void HydraTask_HA_dataStoreInitialize() { if (testInstance == null) { PRObserver.installObserverHook(); PRObserver.initialize(RemoteTestModule.getMyVmid()); testInstance = new KnownKeysTest(); ((KnownKeysTest)testInstance).initInstance("dataStoreRegion"); ParRegBB.getBB().getSharedMap().put(DataStoreVmStr + RemoteTestModule.getMyVmid(), new Integer(RemoteTestModule.getMyVmid())); RegionAttributes attr = testInstance.aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); if (prAttr == null) { // this is not a PR datastore, but probably a replicate; done in parReg/execute tests ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(-1)); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(-1)); } else { ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(prAttr.getRecoveryDelay())); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(prAttr.getStartupRecoveryDelay())); } if (isBridgeConfiguration) { BridgeHelper.startBridgeServer("bridge"); } } }
public static PartitionAttributesData getPartitionAttributesData(PartitionAttributes partAttrs) { int redundantCopies = partAttrs.getRedundantCopies(); long totalMaxMemory = partAttrs.getTotalMaxMemory(); // Total number of buckets for whole region int totalNumBuckets = partAttrs.getTotalNumBuckets(); int localMaxMemory = partAttrs.getLocalMaxMemory(); String colocatedWith = partAttrs.getColocatedWith(); String partitionResolver = null; if (partAttrs.getPartitionResolver() != null) { partitionResolver = partAttrs.getPartitionResolver().getName(); } long recoveryDelay = partAttrs.getRecoveryDelay(); long startupRecoveryDelay = partAttrs.getStartupRecoveryDelay(); String[] partitionListeners = null; if (partAttrs.getPartitionListeners() != null) { partitionListeners = new String[partAttrs.getPartitionListeners().length]; for (int i = 0; i < partAttrs.getPartitionListeners().length; i++) { partitionListeners[i] = (partAttrs.getPartitionListeners())[i].getClass().getCanonicalName(); } } PartitionAttributesData partitionAttributesData = new PartitionAttributesData(redundantCopies, totalMaxMemory, totalNumBuckets, localMaxMemory, colocatedWith, partitionResolver, recoveryDelay, startupRecoveryDelay, partitionListeners); return partitionAttributesData; }
public synchronized static void HydraTask_HA_initReplicatedDataStore() { if (testInstance == null) { // TODO : Aneesh Remove this (currently required for stop start though) PRObserver.installObserverHook(); PRObserver.initialize(RemoteTestModule.getMyVmid()); testInstance = new FunctionExecutionWithDistributedRegion(); ((FunctionExecutionWithDistributedRegion)testInstance) .initInstance("replicateServerRegion"); ParRegBB.getBB().getSharedMap().put( DataStoreVmStr + RemoteTestModule.getMyVmid(), new Integer(RemoteTestModule.getMyVmid())); RegionAttributes attr = testInstance.aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); if (prAttr == null) { // this is not a PR datastore, but probably a // replicate; done in parReg/execute tests ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(-1)); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(-1)); } else { ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(prAttr.getRecoveryDelay())); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(prAttr.getStartupRecoveryDelay())); } } }
public synchronized static void HydraTask_HA_initEmptyDataStore() { if (testInstance == null) { // TODO : Aneesh Remove this (currently required for stop start though) PRObserver.installObserverHook(); PRObserver.initialize(RemoteTestModule.getMyVmid()); testInstance = new FunctionExecutionWithDistributedRegion(); ((FunctionExecutionWithDistributedRegion)testInstance) .initInstance("emptyServerRegion"); RegionAttributes attr = testInstance.aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); if (prAttr == null) { // this is not a PR datastore, but probably a // replicate; done in parReg/execute tests ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(-1)); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(-1)); } else { ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(prAttr.getRecoveryDelay())); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(prAttr.getStartupRecoveryDelay())); } if (isBridgeConfiguration) { BridgeHelper.startBridgeServer("server"); } } }
public synchronized static void HydraTask_HA_dataStoreReinitialize() { if (testInstance == null) { Log.getLogWriter().info("Reinitializing with EventPRObserver"); EventPRObserver.installObserverHook(); EventPRObserver.initialize(RemoteTestModule.getMyVmid()); testInstance = new EventsDuringRecoveryTest(); ((KnownKeysTest)testInstance).initInstance("dataStoreRegion"); thisVMRestarted = true; ParRegBB.getBB().getSharedMap().put(DataStoreVmStr + RemoteTestModule.getMyVmid(), new Integer(RemoteTestModule.getMyVmid())); if (isBridgeConfiguration) { BridgeHelper.startBridgeServer("bridge"); } RegionAttributes attr = testInstance.aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(prAttr.getRecoveryDelay())); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(prAttr.getStartupRecoveryDelay())); } }
public synchronized static void HydraTask_HA_dataStoreInitialize() { if (testInstance == null) { PRObserver.installObserverHook(); PRObserver.initialize(RemoteTestModule.getMyVmid()); testInstance = new ExecutionAndColocationTest(); ((KnownKeysTest)testInstance).initInstance("dataStoreRegion"); ParRegBB.getBB().getSharedMap().put( DataStoreVmStr + RemoteTestModule.getMyVmid(), new Integer(RemoteTestModule.getMyVmid())); RegionAttributes attr = testInstance.aRegion.getAttributes(); PartitionAttributes prAttr = attr.getPartitionAttributes(); if (prAttr == null) { // this is not a PR datastore, but probably a // replicate; done in parReg/execute tests ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(-1)); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(-1)); } else { ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(prAttr.getRecoveryDelay())); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(prAttr.getStartupRecoveryDelay())); } if (isBridgeConfiguration) { BridgeHelper.startBridgeServer("bridge"); } } }
PartitionAttributes prAttr = attr.getPartitionAttributes(); long recoveryDelay = prAttr.getRecoveryDelay(); long startupRecoveryDelay = prAttr.getStartupRecoveryDelay(); ParRegBB.getBB().getSharedMap().put("recoveryDelay", new Long(recoveryDelay)); ParRegBB.getBB().getSharedMap().put("startupRecoveryDelay", new Long(startupRecoveryDelay));
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setEnableOffHeapMemory(((PartitionAttributesImpl) pa).getEnableOffHeapMemory()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }
@SuppressWarnings("unchecked") public void setAll(@SuppressWarnings("rawtypes") PartitionAttributes pa) { setRedundantCopies(pa.getRedundantCopies()); setLocalProperties(pa.getLocalProperties()); setGlobalProperties(pa.getGlobalProperties()); setLocalMaxMemory(pa.getLocalMaxMemory()); setTotalMaxMemory(pa.getTotalMaxMemory()); setTotalNumBuckets(pa.getTotalNumBuckets()); setPartitionResolver(pa.getPartitionResolver()); setColocatedWith(pa.getColocatedWith()); setRecoveryDelay(pa.getRecoveryDelay()); setStartupRecoveryDelay(pa.getStartupRecoveryDelay()); setOffHeap(((PartitionAttributesImpl) pa).getOffHeap()); addFixedPartitionAttributes(pa.getFixedPartitionAttributes()); }
assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(-1, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(0, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay()); assertEquals(pa.getTotalMaxMemory(), 500); assertEquals(-1, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(0, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay());
assertEquals(r.getAttributes().getPartitionAttributes().getTotalMaxMemory(),500); assertEquals(33, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(270, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay()); assertEquals(pa.getTotalMaxMemory(), 500); assertEquals(33, r.getAttributes().getPartitionAttributes().getRecoveryDelay()); assertEquals(270, r.getAttributes().getPartitionAttributes().getStartupRecoveryDelay());