Skip to content

Commit

Permalink
[WFLY-245] Add support for cross-site replication of Infinispan cache…
Browse files Browse the repository at this point in the history
…s via RELAY2
  • Loading branch information
pferraro authored and bstansberry committed Jun 7, 2013
1 parent 45ff0af commit a9ed468
Show file tree
Hide file tree
Showing 44 changed files with 3,799 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
<config>
<extension-module>org.jboss.as.clustering.jgroups</extension-module>
<subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="udp">
<subsystem xmlns="urn:jboss:domain:jgroups:1.2" default-stack="udp">
<stack name="udp">
<transport type="UDP" socket-binding="jgroups-udp"/>
<protocol type="PING"/>
Expand Down
20 changes: 9 additions & 11 deletions build/src/main/resources/docs/schema/jboss-as-infinispan_1_4.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,11 @@

<xs:complexType name="invalidation-cache">
<xs:complexContent>
<xs:extension base="tns:clustered-cache">
</xs:extension>
<xs:extension base="tns:clustered-cache"/>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="replicated-cache">
<xs:complexType name="shared-state-cache" abstract="true">
<xs:complexContent>
<xs:extension base="tns:clustered-cache">
<xs:sequence>
Expand All @@ -402,16 +401,15 @@
</xs:complexContent>
</xs:complexType>

<xs:complexType name="replicated-cache">
<xs:complexContent>
<xs:extension base="tns:shared-state-cache"/>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="distributed-cache">
<xs:complexContent>
<xs:extension base="tns:clustered-cache">
<xs:sequence>
<xs:element name="state-transfer" type="tns:state-transfer" minOccurs="0">
<xs:annotation>
<xs:documentation>The state transfer configuration for distribution and replicated caches.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:extension base="tns:shared-state-cache">
<xs:attribute name="owners" type="xs:int" default="2">
<xs:annotation>
<xs:documentation>Number of cluster-wide replicas for each cache entry.</xs:documentation>
Expand Down
1,031 changes: 1,031 additions & 0 deletions build/src/main/resources/docs/schema/jboss-as-infinispan_1_5.xsd

Large diffs are not rendered by default.

193 changes: 193 additions & 0 deletions build/src/main/resources/docs/schema/jboss-as-jgroups_1_2.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2011, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<xs:schema targetNamespace="urn:jboss:domain:jgroups:1.2"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:jboss:domain:jgroups:1.2"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1.2">

<xs:element name="subsystem" type="tns:subsystem">
<xs:annotation>
<xs:documentation>Enumerates the protocol stacks available to the channel factory.</xs:documentation>
</xs:annotation>
</xs:element>

<xs:complexType name="subsystem">
<xs:sequence>
<xs:element name="stack" type="tns:stack" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Defines a protocol stack.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="default-stack" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Identifies the default protocol stack.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>

<xs:complexType name="stack">
<xs:sequence>
<xs:element name="transport" type="tns:transport">
<xs:annotation>
<xs:documentation>Defines the transport protocol for a stack.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="protocol" type="tns:protocol" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Defines a non-transport protocol for a stack.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="relay" type="tns:relay" minOccurs="0">
<xs:annotation>
<xs:documentation>Defines a relay protocol for a stack.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Uniquely identifies this stack.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>

<xs:complexType name="protocol">
<xs:sequence>
<xs:element name="property" type="tns:property" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Defines a property override for a protocol.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Identifies the protocol type, e.g. TCP, UDP, PING, etc.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="socket-binding" type="xs:string">
<xs:annotation>
<xs:documentation>Provides an address/port binding for a protocol.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>

<xs:complexType name="transport">
<xs:complexContent>
<xs:extension base="tns:protocol">
<xs:attribute name="shared" type="xs:boolean" default="true">
<xs:annotation>
<xs:documentation>Indicates whether or not the channels created for this stack should use a single, shared transport.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="diagnostics-socket-binding" type="xs:string">
<xs:annotation>
<xs:documentation>If specified, enables diagnostics and specified the multicast address/port on which to communicate.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="default-executor" type="xs:string">
<xs:annotation>
<xs:documentation>Defines the thread pool used for default messages received by this transport.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="oob-executor" type="xs:string">
<xs:annotation>
<xs:documentation>Defines the thread pool used for OOB messages received by this transport.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="timer-executor" type="xs:string">
<xs:annotation>
<xs:documentation>Defines the timer thread pool used by this transport.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="thread-factory" type="xs:string">
<xs:annotation>
<xs:documentation>Defines the thread factory used by this transport.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="site" type="xs:string">
<xs:annotation>
<xs:documentation>Identifies the site where this node runs.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="rack" type="xs:string">
<xs:annotation>
<xs:documentation>Identifies the rack where this node runs.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="machine" type="xs:string">
<xs:annotation>
<xs:documentation>Identifies the machine where this node runs.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>

<xs:complexType name="property">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Defines the name of a protocol property.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<xs:complexType name="relay">
<xs:sequence>
<xs:element name="remote-site" type="tns:remote-site" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Defines a remote site to which to bridge.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="site" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The name of our site.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>

<xs:complexType name="remote-site">
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The name of the remote site.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="stack" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The stack name used to create a bridge channel to this remote site.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cluster" type="xs:string">
<xs:annotation>
<xs:documentation>The cluster name of the channel that bridges this remote site.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public enum Attribute {
ACQUIRE_TIMEOUT(ModelKeys.ACQUIRE_TIMEOUT),
ALIASES(ModelKeys.ALIASES),
ASYNC_MARSHALLING(ModelKeys.ASYNC_MARSHALLING),
BACKUP_FAILURE_POLICY(ModelKeys.BACKUP_FAILURE_POLICY),
BATCH_SIZE(ModelKeys.BATCH_SIZE),
BATCHING(ModelKeys.BATCHING),
CACHE(ModelKeys.CACHE),
Expand Down Expand Up @@ -100,6 +101,8 @@ public enum Attribute {
STOP_TIMEOUT(ModelKeys.STOP_TIMEOUT),
STRATEGY(ModelKeys.STRATEGY),
STRIPING(ModelKeys.STRIPING),
TAKE_BACKUP_OFFLINE_AFTER_FAILURES(ModelKeys.TAKE_BACKUP_OFFLINE_AFTER_FAILURES),
TAKE_BACKUP_OFFLINE_MIN_WAIT(ModelKeys.TAKE_BACKUP_OFFLINE_MIN_WAIT),
TCP_NO_DELAY(ModelKeys.TCP_NO_DELAY),
THREAD_POOL_SIZE(ModelKeys.THREAD_POOL_SIZE),
TIMEOUT(ModelKeys.TIMEOUT),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2012, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.clustering.infinispan.subsystem;

import org.infinispan.configuration.cache.BackupConfiguration.BackupStrategy;
import org.infinispan.configuration.cache.BackupFailurePolicy;
import org.jboss.as.clustering.infinispan.subsystem.CacheConfigOperationHandlers.CacheConfigAdd;
import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.OperationStepHandler;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.operations.validation.EnumValidator;
import org.jboss.as.controller.registry.AttributeAccess;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.dmr.ModelNode;
import org.jboss.dmr.ModelType;

/**
* @author Paul Ferraro
*
*/
public class BackupSiteResource extends SimpleResourceDefinition {

static final SimpleAttributeDefinition FAILURE_POLICY = new SimpleAttributeDefinitionBuilder(ModelKeys.BACKUP_FAILURE_POLICY, ModelType.STRING, true)
.setXmlName(Attribute.BACKUP_FAILURE_POLICY.getLocalName())
.setAllowExpression(true)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setValidator(new EnumValidator<BackupFailurePolicy>(BackupFailurePolicy.class, true, true))
.setDefaultValue(new ModelNode().set(BackupFailurePolicy.WARN.name()))
.build()
;
static final SimpleAttributeDefinition STRATEGY = new SimpleAttributeDefinitionBuilder(ModelKeys.BACKUP_STRATEGY, ModelType.STRING, true)
.setXmlName(Attribute.STRATEGY.getLocalName())
.setAllowExpression(true)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setValidator(new EnumValidator<BackupStrategy>(BackupStrategy.class, true, true))
.setDefaultValue(new ModelNode().set(BackupStrategy.ASYNC.name()))
.build()
;
static final SimpleAttributeDefinition REPLICATION_TIMEOUT = new SimpleAttributeDefinitionBuilder(ModelKeys.TIMEOUT, ModelType.STRING, true)
.setXmlName(Attribute.TIMEOUT.getLocalName())
.setAllowExpression(true)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode().set(10000L))
.build()
;
static final SimpleAttributeDefinition ENABLED = new SimpleAttributeDefinitionBuilder(ModelKeys.ENABLED, ModelType.BOOLEAN, true)
.setXmlName(Attribute.ENABLED.getLocalName())
.setAllowExpression(true)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode().set(true))
.build()
;
static final SimpleAttributeDefinition TAKE_OFFLINE_AFTER_FAILURES = new SimpleAttributeDefinitionBuilder(ModelKeys.TAKE_BACKUP_OFFLINE_AFTER_FAILURES, ModelType.INT, true)
.setXmlName(Attribute.TAKE_BACKUP_OFFLINE_AFTER_FAILURES.getLocalName())
.setAllowExpression(true)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode().set(0))
.build()
;
static final SimpleAttributeDefinition TAKE_OFFLINE_MIN_WAIT = new SimpleAttributeDefinitionBuilder(ModelKeys.TAKE_BACKUP_OFFLINE_MIN_WAIT, ModelType.INT, true)
.setXmlName(Attribute.TAKE_BACKUP_OFFLINE_MIN_WAIT.getLocalName())
.setAllowExpression(true)
.setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES)
.setDefaultValue(new ModelNode().set(0))
.build()
;

static final AttributeDefinition[] ATTRIBUTES = new AttributeDefinition[] { FAILURE_POLICY, STRATEGY, REPLICATION_TIMEOUT, ENABLED, TAKE_OFFLINE_AFTER_FAILURES, TAKE_OFFLINE_MIN_WAIT };

BackupSiteResource() {
super(PathElement.pathElement(ModelKeys.BACKUP), InfinispanExtension.getResourceDescriptionResolver(ModelKeys.BACKUP), new CacheConfigAdd(ATTRIBUTES), ReloadRequiredRemoveStepHandler.INSTANCE);
}

@Override
public void registerAttributes(ManagementResourceRegistration registration) {
final OperationStepHandler writeHandler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES);
for (AttributeDefinition attribute: ATTRIBUTES) {
registration.registerReadWriteAttribute(attribute, null, writeHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public enum Element {
UNKNOWN((String)null),

ALIAS(ModelKeys.ALIAS),
BACKUP(ModelKeys.BACKUP),
BACKUPS(ModelKeys.BACKUPS),
BINARY_KEYED_TABLE(ModelKeys.BINARY_KEYED_TABLE),
@Deprecated BUCKET_TABLE(ModelKeys.BUCKET_TABLE),
CACHE_CONTAINER(ModelKeys.CACHE_CONTAINER),
Expand All @@ -65,6 +67,7 @@ public enum Element {
STATE_TRANSFER(ModelKeys.STATE_TRANSFER),
STORE(ModelKeys.STORE),
STRING_KEYED_TABLE(ModelKeys.STRING_KEYED_TABLE),
TAKE_OFFLINE("take-offline"),
TIMESTAMP_COLUMN(ModelKeys.TIMESTAMP_COLUMN),
TRANSACTION(ModelKeys.TRANSACTION),
TRANSPORT(ModelKeys.TRANSPORT),
Expand Down

0 comments on commit a9ed468

Please sign in to comment.