Browse files

AS7-5753 deprecate Infinispan subsystem virtual-nodes attribute and i…

…ntroduce segments instead
  • Loading branch information...
1 parent 4cb1b3a commit 27dffbfadc12ef8f9e673058fbd8bca08cd98cab @rhusar committed Nov 12, 2012
Showing with 58 additions and 22 deletions.
  1. +2 −2 build/src/main/resources/docs/schema/jboss-as-infinispan_1_4.xsd
  2. +7 −1 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/InfinispanLogger.java
  3. +2 −1 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/Attribute.java
  4. +3 −3 ...ng/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/DistributedCacheAdd.java
  5. +17 −2 ...finispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/DistributedCacheResource.java
  6. +3 −0 ...ng/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanExtension.java
  7. +4 −0 ...rc/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemTransformer_1_3.java
  8. +1 −1 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_0.java
  9. +2 −1 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_1.java
  10. +3 −1 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_2.java
  11. +3 −2 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_3.java
  12. +2 −2 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_4.java
  13. +1 −1 ...span/src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLWriter.java
  14. +2 −1 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ModelKeys.java
  15. +3 −1 ...span/src/main/resources/org/jboss/as/clustering/infinispan/subsystem/LocalDescriptions.properties
  16. +1 −1 ...an/src/test/resources/org/jboss/as/clustering/infinispan/subsystem/infinispan-transformer_1_4.xml
  17. +1 −1 clustering/infinispan/src/test/resources/subsystem-infinispan-test.xml
  18. +1 −1 clustering/infinispan/src/test/resources/subsystem-infinispan_1_4.xml
View
4 build/src/main/resources/docs/schema/jboss-as-infinispan_1_4.xsd
@@ -417,9 +417,9 @@
<xs:documentation>Number of cluster-wide replicas for each cache entry.</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="virtual-nodes" type="xs:int" default="1">
+ <xs:attribute name="segments" type="xs:int" default="80">
<xs:annotation>
- <xs:documentation>Controls the number of virtual nodes per "real" node.</xs:documentation>
+ <xs:documentation>Number of hash space segments (per cluster). The recommended value is 10 * cluster size.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="l1-lifespan" type="xs:long" default="600000">
View
8 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/InfinispanLogger.java
@@ -78,7 +78,6 @@
/**
* Logs a warning message indicating that the eager attribute of the transactional element
* is no longer valid
- *
*/
@LogMessage(level = WARN)
@Message(id = 10283, value = "The 'eager' attribute specified on the 'transaction' element of a cache is no longer valid")
@@ -100,4 +99,11 @@
@Message(id = 10285, value = "'%s' cache container installed.")
void cacheContainerInstalled(String containerName);
+ /**
+ * Logs a warning message stating that the 'virtual-nodes' attribute is deprecated.
+ */
+ @LogMessage(level = WARN)
+ @Message(id = 10286, value = "Attribute 'virtual-nodes' has been deprecated and has no effect.")
+ void virtualNodesAttributeDeprecated();
+
}
View
3 ...ring/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/Attribute.java
@@ -89,6 +89,7 @@
RELATIVE_TO(ModelKeys.RELATIVE_TO),
REMOTE_TIMEOUT(ModelKeys.REMOTE_TIMEOUT),
REPLICATION_QUEUE_EXECUTOR(ModelKeys.REPLICATION_QUEUE_EXECUTOR),
+ SEGMENTS(ModelKeys.SEGMENTS),
SHARED(ModelKeys.SHARED),
SHUTDOWN_TIMEOUT(ModelKeys.SHUTDOWN_TIMEOUT),
SINGLETON(ModelKeys.SINGLETON),
@@ -103,7 +104,7 @@
THREAD_POOL_SIZE(ModelKeys.THREAD_POOL_SIZE),
TIMEOUT(ModelKeys.TIMEOUT),
TYPE(ModelKeys.TYPE),
- VIRTUAL_NODES(ModelKeys.VIRTUAL_NODES),
+ @Deprecated VIRTUAL_NODES("virtual-nodes"),
;
private final String name;
View
6 ...ispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/DistributedCacheAdd.java
@@ -56,7 +56,7 @@ void populate(ModelNode fromModel, ModelNode toModel) throws OperationFailedExce
super.populate(fromModel, toModel);
DistributedCacheResource.OWNERS.validateAndSet(fromModel, toModel);
- DistributedCacheResource.VIRTUAL_NODES.validateAndSet(fromModel, toModel);
+ DistributedCacheResource.SEGMENTS.validateAndSet(fromModel, toModel);
DistributedCacheResource.L1_LIFESPAN.validateAndSet(fromModel, toModel);
}
@@ -77,13 +77,13 @@ void processModelNode(OperationContext context, String containerName, ModelNode
super.processModelNode(context, containerName, cache, builder, dependencies);
final int owners = DistributedCacheResource.OWNERS.resolveModelAttribute(context, cache).asInt();
- final int virtualNodes = DistributedCacheResource.VIRTUAL_NODES.resolveModelAttribute(context, cache).asInt();
+ final int segments = DistributedCacheResource.SEGMENTS.resolveModelAttribute(context, cache).asInt();
final long lifespan = DistributedCacheResource.L1_LIFESPAN.resolveModelAttribute(context, cache).asLong();
// process the additional distributed attributes and elements
builder.clustering().hash()
.numOwners(owners)
- .numSegments(virtualNodes)
+ .numSegments(segments)
;
if (lifespan > 0) {
builder.clustering().l1().lifespan(lifespan);
View
19 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/DistributedCacheResource.java
@@ -23,6 +23,7 @@
package org.jboss.as.clustering.infinispan.subsystem;
import org.jboss.as.controller.AttributeDefinition;
+import org.jboss.as.controller.ModelVersion;
import org.jboss.as.controller.OperationStepHandler;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;
@@ -62,15 +63,26 @@
.setDefaultValue(new ModelNode().set(2))
.build();
- static final SimpleAttributeDefinition VIRTUAL_NODES =
+ @SuppressWarnings("deprecation")
+ @Deprecated
+ private static final SimpleAttributeDefinition VIRTUAL_NODES =
new SimpleAttributeDefinitionBuilder(ModelKeys.VIRTUAL_NODES, ModelType.INT, true)
.setXmlName(Attribute.VIRTUAL_NODES.getLocalName())
.setAllowExpression(false)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode().set(1))
+ .setDeprecated(ModelVersion.create(1, 4, 0))
.build();
- static final AttributeDefinition[] DISTRIBUTED_CACHE_ATTRIBUTES = {OWNERS, VIRTUAL_NODES, L1_LIFESPAN};
+ static final SimpleAttributeDefinition SEGMENTS =
+ new SimpleAttributeDefinitionBuilder(ModelKeys.SEGMENTS, ModelType.INT, true)
+ .setXmlName(Attribute.SEGMENTS.getLocalName())
+ .setAllowExpression(false)
+ .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
+ .setDefaultValue(new ModelNode().set(80)) // Recommended value is 10 * max_cluster_size.
+ .build();
+
+ static final AttributeDefinition[] DISTRIBUTED_CACHE_ATTRIBUTES = {OWNERS, SEGMENTS, L1_LIFESPAN};
public DistributedCacheResource(final ResolvePathHandler resolvePathHandler) {
super(DISTRIBUTED_CACHE_PATH,
@@ -88,5 +100,8 @@ public void registerAttributes(ManagementResourceRegistration resourceRegistrati
for (AttributeDefinition attr : DISTRIBUTED_CACHE_ATTRIBUTES) {
resourceRegistration.registerReadWriteAttribute(attr, null, writeHandler);
}
+
+ // Legacy attributes
+ resourceRegistration.registerReadOnlyAttribute(VIRTUAL_NODES, null);
}
}
View
3 ...ispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanExtension.java
@@ -110,6 +110,9 @@ protected ModelNode transform(TransformationContext context, PathAddress address
if (operation.has(ModelKeys.INDEXING_PROPERTIES)){
operation.remove(ModelKeys.INDEXING_PROPERTIES);
}
+ if (operation.has(ModelKeys.SEGMENTS)) {
+ operation.remove(ModelKeys.SEGMENTS);
+ }
return operation;
}
}
View
4 ...java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemTransformer_1_3.java
@@ -59,6 +59,10 @@ private void transformCache(final ModelNode model, final String containerName, f
if (cache.has(ModelKeys.INDEXING_PROPERTIES)) {
cache.remove(ModelKeys.INDEXING_PROPERTIES);
}
+ if (cache.has(ModelKeys.SEGMENTS)) {
+ cache.remove(ModelKeys.SEGMENTS);
+ }
+
model.get(ModelKeys.CACHE_CONTAINER, containerName, cacheType, c.getName()).set(cache);
}
}
View
2 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_0.java
@@ -336,7 +336,7 @@ private void parseDistributedCache(XMLExtendedStreamReader reader, ModelNode con
break;
}
case VIRTUAL_NODES: {
- DistributedCacheResource.VIRTUAL_NODES.parseAndSetParameter(value, cache, reader);
+ ROOT_LOGGER.virtualNodesAttributeDeprecated();
break;
}
case L1_LIFESPAN: {
View
3 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_1.java
@@ -22,6 +22,7 @@
package org.jboss.as.clustering.infinispan.subsystem;
+import static org.jboss.as.clustering.infinispan.InfinispanLogger.ROOT_LOGGER;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
import java.util.ArrayList;
@@ -328,7 +329,7 @@ private void parseDistributedCache(XMLExtendedStreamReader reader, ModelNode con
break;
}
case VIRTUAL_NODES: {
- DistributedCacheResource.VIRTUAL_NODES.parseAndSetParameter(value, cache, reader);
+ ROOT_LOGGER.virtualNodesAttributeDeprecated();
break;
}
case L1_LIFESPAN: {
View
4 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_2.java
@@ -22,6 +22,8 @@
package org.jboss.as.clustering.infinispan.subsystem;
+import static org.jboss.as.clustering.infinispan.InfinispanLogger.ROOT_LOGGER;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
@@ -334,7 +336,7 @@ private void parseDistributedCache(XMLExtendedStreamReader reader, ModelNode con
break;
}
case VIRTUAL_NODES: {
- DistributedCacheResource.VIRTUAL_NODES.parseAndSetParameter(value, cache, reader);
+ ROOT_LOGGER.virtualNodesAttributeDeprecated();
break;
}
case L1_LIFESPAN: {
View
5 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_3.java
@@ -22,6 +22,7 @@
package org.jboss.as.clustering.infinispan.subsystem;
+import static org.jboss.as.clustering.infinispan.InfinispanLogger.ROOT_LOGGER;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
@@ -209,7 +210,7 @@ private void parseTransport(XMLExtendedStreamReader reader, PathAddress containe
operations.add(transport);
}
- protected void parseCacheAttribute(XMLExtendedStreamReader reader, int index, Attribute attribute, String value, ModelNode cache) throws XMLStreamException {
+ private void parseCacheAttribute(XMLExtendedStreamReader reader, int index, Attribute attribute, String value, ModelNode cache) throws XMLStreamException {
switch (attribute) {
case NAME: {
CacheResource.NAME.parseAndSetParameter(value, cache, reader);
@@ -321,7 +322,7 @@ private void parseDistributedCache(XMLExtendedStreamReader reader, PathAddress c
break;
}
case VIRTUAL_NODES: {
- DistributedCacheResource.VIRTUAL_NODES.parseAndSetParameter(value, cache, reader);
+ ROOT_LOGGER.virtualNodesAttributeDeprecated();
break;
}
case L1_LIFESPAN: {
View
4 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_4.java
@@ -317,8 +317,8 @@ private void parseDistributedCache(XMLExtendedStreamReader reader, PathAddress c
DistributedCacheResource.OWNERS.parseAndSetParameter(value, cache, reader);
break;
}
- case VIRTUAL_NODES: {
- DistributedCacheResource.VIRTUAL_NODES.parseAndSetParameter(value, cache, reader);
+ case SEGMENTS: {
+ DistributedCacheResource.SEGMENTS.parseAndSetParameter(value, cache, reader);
break;
}
case L1_LIFESPAN: {
View
2 .../main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLWriter.java
@@ -137,7 +137,7 @@ public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingCon
writer.writeAttribute(Attribute.NAME.getLocalName(), distributedCacheName);
// distributed cache attributes
this.writeOptional(writer, Attribute.OWNERS, distributedCache, ModelKeys.OWNERS);
- this.writeOptional(writer, Attribute.VIRTUAL_NODES, distributedCache, ModelKeys.VIRTUAL_NODES);
+ this.writeOptional(writer, Attribute.SEGMENTS, distributedCache, ModelKeys.SEGMENTS);
this.writeOptional(writer, Attribute.L1_LIFESPAN, distributedCache, ModelKeys.L1_LIFESPAN);
processCommonClusteredCacheAttributes(writer, distributedCache);
View
3 ...ring/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ModelKeys.java
@@ -112,6 +112,7 @@
static final String REMOTE_TIMEOUT = "remote-timeout";
static final String REPLICATED_CACHE = "replicated-cache";
static final String REPLICATION_QUEUE_EXECUTOR = "replication-queue-executor";
+ static final String SEGMENTS = "segments";
static final String SHARED = "shared";
static final String SHUTDOWN_TIMEOUT = "shutdown-timeout";
static final String SINGLETON = "singleton";
@@ -135,7 +136,7 @@
static final String TRANSPORT = "transport";
static final String TRANSPORT_NAME = "TRANSPORT";
static final String TYPE = "type";
- static final String VIRTUAL_NODES = "virtual-nodes";
+ @Deprecated static final String VIRTUAL_NODES = "virtual-nodes";
static final String WAIT = "wait";
static final String WRITE_BEHIND = "write-behind";
static final String WRITE_BEHIND_NAME = "WRITE_BEHIND";
View
4 .../main/resources/org/jboss/as/clustering/infinispan/subsystem/LocalDescriptions.properties
@@ -78,7 +78,9 @@ infinispan.state-transfer.remove=Remove a state transfer configuration.
#infinispan.distributed-cache=The distributed cache configuration.
infinispan.distributed-cache=A distributed cache
infinispan.distributed-cache.owners=Number of cluster-wide replicas for each cache entry.
-infinispan.distributed-cache.virtual-nodes=Controls the number of virtual nodes per "real" node. If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used.
+infinispan.distributed-cache.virtual-nodes=Deprecated. Has no effect.
+infinispan.distributed-cache.virtual-nodes.deprecated=Deprecated. Has no effect.
+infinispan.distributed-cache.segments=Controls the number of hash space segments which is the granularity for key distribution in the cluster. Value must be strictly positive.
infinispan.distributed-cache.l1-lifespan=Maximum lifespan of an entry placed in the L1 cache. This element configures the L1 cache behavior in 'distributed' caches instances. In any other cache modes, this element is ignored.
infinispan.distributed-cache.add=Add a distributed cache to this cache container
infinispan.distributed-cache.remove=Remove a distributed cache from this cache container
View
2 ...est/resources/org/jboss/as/clustering/infinispan/subsystem/infinispan-transformer_1_4.xml
@@ -66,7 +66,7 @@
</store>
<indexing index="NONE" />
</replicated-cache>
- <distributed-cache name="dist" mode="SYNC" batching="true" l1-lifespan="1200000" owners="4" remote-timeout="35000" start="EAGER" virtual-nodes="2" async-marshalling="true">
+ <distributed-cache name="dist" mode="SYNC" batching="true" l1-lifespan="1200000" owners="4" remote-timeout="35000" start="EAGER" segments="2" async-marshalling="true">
<locking acquire-timeout="30000" concurrency-level="2000" isolation="READ_COMMITTED" striping="true"/>
<transaction mode="FULL_XA" stop-timeout="60000" locking="OPTIMISTIC"/>
<eviction max-entries="20000" strategy="UNORDERED"/>
View
2 clustering/infinispan/src/test/resources/subsystem-infinispan-test.xml
@@ -39,7 +39,7 @@
</store>
<indexing index="NONE" />
</replicated-cache>
- <distributed-cache name="dist" mode="SYNC" batching="true" l1-lifespan="1200000" owners="4" remote-timeout="35000" start="EAGER" virtual-nodes="2" async-marshalling="true">
+ <distributed-cache name="dist" mode="SYNC" batching="true" l1-lifespan="1200000" owners="4" remote-timeout="35000" start="EAGER" segments="2" async-marshalling="true">
<locking acquire-timeout="30000" concurrency-level="2000" isolation="READ_COMMITTED" striping="true"/>
<transaction mode="FULL_XA" stop-timeout="60000" locking="OPTIMISTIC"/>
<eviction max-entries="20000" strategy="UNORDERED"/>
View
2 clustering/infinispan/src/test/resources/subsystem-infinispan_1_4.xml
@@ -63,7 +63,7 @@
</store>
<indexing index="NONE" />
</replicated-cache>
- <distributed-cache name="dist" mode="SYNC" batching="true" l1-lifespan="1200000" owners="4" remote-timeout="35000" start="EAGER" virtual-nodes="2" async-marshalling="true">
+ <distributed-cache name="dist" mode="SYNC" batching="true" l1-lifespan="1200000" owners="4" remote-timeout="35000" start="EAGER" segments="2" async-marshalling="true">
<locking acquire-timeout="30000" concurrency-level="2000" isolation="READ_COMMITTED" striping="true"/>
<transaction mode="FULL_XA" stop-timeout="60000" locking="OPTIMISTIC"/>
<eviction max-entries="20000" strategy="UNORDERED"/>

0 comments on commit 27dffbf

Please sign in to comment.