public String getColocatedWith() { // [GemFireXD] use PartitionAttributes to get colocated region // since it may change after ALTER TABLE return this.partitionAttributes.getColocatedWith(); }
public String getColocatedWith() { // [SQLFabric] use PartitionAttributes to get colocated region // since it may change after ALTER TABLE return this.partitionAttributes.getColocatedWith(); }
protected static String getColocatedWith(PartitionAttributes pa) { return pa.getColocatedWith().toString(); } protected static String getRecoveryDelay(PartitionAttributes pa) {
private void validateColocatedWith(final PartitionRegionConfig prconf, final PartitionAttributes userPA) { if (userPA.getColocatedWith() == null && prconf.getColocatedWith() != null) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_COLOCATED_WITH .toLocalizedString(new Object[] { "null", prconf.getColocatedWith() })); } if (userPA.getColocatedWith() != null && prconf.getColocatedWith() != null) { if (!(prconf.getColocatedWith().equals(userPA.getColocatedWith()))) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_COLOCATED_WITH .toLocalizedString(new Object[] { userPA.getColocatedWith(), prconf.getColocatedWith() })); } } }
private void validateColocatedWith(final PartitionRegionConfig prconf, final PartitionAttributes userPA) { if (userPA.getColocatedWith() == null && prconf.getColocatedWith() != null) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_COLOCATED_WITH .toLocalizedString(new Object[] { "null", prconf.getColocatedWith() })); } if (userPA.getColocatedWith() != null && prconf.getColocatedWith() != null) { if (!(prconf.getColocatedWith().equals(userPA.getColocatedWith()))) { throw new IllegalStateException( LocalizedStrings.PartitionRegionConfigValidator_INCOMPATIBLE_COLOCATED_WITH .toLocalizedString(new Object[] { userPA.getColocatedWith(), prconf.getColocatedWith() })); } } }
/** * Constructor. */ PartitionRegionConfig(int prId, String path, PartitionAttributes prAtt, Scope sc) { this.prId = prId; this.pAttrs = (PartitionAttributesImpl)prAtt; this.scope = sc; this.isDestroying = false; this.nodes = new VersionedArrayList(); if (prAtt.getPartitionResolver() != null) { this.partitionResolver = prAtt.getPartitionResolver().getClass().getName(); } this.colocatedWith = prAtt.getColocatedWith(); this.isColocationComplete = colocatedWith == null; this.fullPath = path; this.firstDataStoreCreated = prAtt.getLocalMaxMemory() != 0; this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); PartitionListener[] prListeners = prAtt.getPartitionListeners(); if (prListeners != null && prListeners.length != 0) { for (int i = 0; i < prListeners.length; i++) { PartitionListener listener = prListeners[i]; this.partitionListenerClassNames.add(listener.getClass().getName()); } } }
/** * 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(); }
/** * Constructor. */ PartitionRegionConfig(int prId, String path, PartitionAttributes prAtt, Scope sc) { this.prId = prId; this.pAttrs = (PartitionAttributesImpl)prAtt; this.scope = sc; this.isDestroying = false; this.nodes = new VersionedArrayList(); if (prAtt.getPartitionResolver() != null) { this.partitionResolver = prAtt.getPartitionResolver().getClass().getName(); } this.colocatedWith = prAtt.getColocatedWith(); this.isColocationComplete = colocatedWith == null; this.fullPath = path; this.firstDataStoreCreated = prAtt.getLocalMaxMemory() > 0; this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); PartitionListener[] prListeners = prAtt.getPartitionListeners(); if (prListeners != null && prListeners.length != 0) { for (int i = 0; i < prListeners.length; i++) { PartitionListener listener = prListeners[i]; this.partitionListenerClassNames.add(listener.getClass().getName()); } } }
/** Return a String describing important attributes of the given region. * * @param aRegion The region to describe. */ private static String getRegionStr(Region aRegion) { StringBuffer aStr = new StringBuffer(); aStr.append(aRegion.getFullPath() + " (size " + aRegion.size() + " dataPolicy " + aRegion.getAttributes().getDataPolicy() + " eviction " + aRegion.getAttributes().getEvictionAttributes()); PartitionAttributes prAttr = aRegion.getAttributes().getPartitionAttributes(); if (prAttr != null) { aStr.append(" localMaxMemory=" + aRegion.getAttributes().getPartitionAttributes().getLocalMaxMemory()); aStr.append(" redundantCopies=" + aRegion.getAttributes().getPartitionAttributes().getRedundantCopies()); if (prAttr.getColocatedWith() != null) { aStr.append(" colocatedWith=" + prAttr.getColocatedWith()); } } RecoveryTestVersionHelper.logDiskStore(aRegion, aStr); aStr.append(")\n"); return aStr.toString(); }
prNames.add(aRegion.getFullPath()); if (prAttr.getColocatedWith() != null) { numColocatedRegions++;
public void testPartitionedRegionAttributesForCoLocation2(){ closeCache(); setXmlFile(findFile("coLocation.xml")); Cache c = getCache(); assertNotNull(c); Region cust = c.getRegion(Region.SEPARATOR+"Customer"); assertNotNull(cust); Region order = c.getRegion(Region.SEPARATOR+"Order"); assertNotNull(order); assertTrue(cust.getAttributes().getPartitionAttributes().getColocatedWith()==null); assertTrue(order.getAttributes().getPartitionAttributes().getColocatedWith().equals("Customer")); }
private static String getLeaderRegionPath(String regionPath, RegionAttributes regionAttributes, Cache cache) { String colocated; while (regionAttributes.getPartitionAttributes() != null && (colocated = regionAttributes.getPartitionAttributes().getColocatedWith()) != null) { // Do not waitOnInitialization() for PR GemFireCacheImpl gfc = (GemFireCacheImpl) cache; Region colocatedRegion = gfc.getPartitionedRegion(colocated, false); if (colocatedRegion == null) { Assert.fail("Could not find parent region " + colocated + " for " + regionPath); } regionAttributes = colocatedRegion.getAttributes(); regionPath = colocatedRegion.getFullPath(); } return regionPath; }
public void testPartitionedRegionAttributesForCoLocation3(){ closeCache(); setXmlFile(findFile("coLocation3.xml")); Cache c = getCache(); assertNotNull(c); Region cust = c.getRegion(Region.SEPARATOR+"Customer"); assertNotNull(cust); Region order = c.getRegion(Region.SEPARATOR+"Order"); assertNotNull(order); assertTrue(cust.getAttributes().getPartitionAttributes().getColocatedWith()==null); assertTrue(order.getAttributes().getPartitionAttributes().getColocatedWith().equals("Customer")); } }
private static String getLeaderRegionPath(String regionPath, RegionAttributes regionAttributes, Cache cache) { String colocated; while(regionAttributes.getPartitionAttributes() != null && (colocated = regionAttributes.getPartitionAttributes().getColocatedWith()) != null) { // Do not waitOnInitialization() for PR GemFireCacheImpl gfc = (GemFireCacheImpl)cache; Region colocatedRegion = gfc.getPartitionedRegion(colocated, false); if(colocatedRegion == null) { Assert.fail("Could not find parent region " + colocated + " for " + regionPath); } regionAttributes = colocatedRegion.getAttributes(); regionPath = colocatedRegion.getFullPath(); } return regionPath; }
protected String getHDFSEventQueueName() { if (!this.getDataPolicy().withHDFS()) return null; String colocatedWith = this.getPartitionAttributes().getColocatedWith(); String eventQueueName; if (colocatedWith != null) { PartitionedRegion leader = ColocationHelper.getLeaderRegionName(this); eventQueueName = HDFSStoreFactoryImpl.getEventQueueName(leader .getFullPath()); } else { eventQueueName = HDFSStoreFactoryImpl.getEventQueueName(getFullPath()); } return eventQueueName; }
protected String getHDFSEventQueueName() { if (!this.getDataPolicy().withHDFS()) return null; String colocatedWith = this.getPartitionAttributes().getColocatedWith(); String eventQueueName; if (colocatedWith != null) { PartitionedRegion leader = ColocationHelper.getLeaderRegionName(this); eventQueueName = HDFSStoreFactoryImpl.getEventQueueName(leader .getFullPath()); } else { eventQueueName = HDFSStoreFactoryImpl.getEventQueueName(getFullPath()); } return eventQueueName; }
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 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; }
@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()); }