Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #577 from zanata/infinispan
Browse files Browse the repository at this point in the history
Introduce Infinispan as cache and hibernate back-end

Full functional tests passed. Not attempting a squash merge.
  • Loading branch information
carlosmunoz committed Mar 12, 2015
2 parents 8769ce1 + 72a6b50 commit 5decdf0
Show file tree
Hide file tree
Showing 59 changed files with 569 additions and 327 deletions.
4 changes: 1 addition & 3 deletions docs/configuration/infinispan.md
@@ -1,6 +1,4 @@
# Infinispan

_This section is still under review and is about features that have not been released yet_
# Infinispan for caching

Zanata uses Infinispan to manage its internal data caches and search indexes. Configuration for these caches happens in JBoss' `standalone/configuration/standalone.xml`. There are two different caches that need to be configured for Zanata:

Expand Down
6 changes: 6 additions & 0 deletions docs/release-notes.md
@@ -1,3 +1,9 @@
## 3.7

<h5>Infrastructure Changes</h5>

Zanata now uses Infinispan as its cache provider, and the cache needs to be configured in Jboss' `standalone.xml` file. Please see the [Infinispan](configuration/infinispan) section for more information.

## 3.6

<h5>New Editor (Alpha)</h5>
Expand Down
13 changes: 13 additions & 0 deletions functional-test/src/test/resources/conf/standalone.xml
Expand Up @@ -182,6 +182,7 @@
</local-cache>
</cache-container>
<cache-container name="hibernate" default-cache="local-query"
jndi-name="java:jboss/infinispan/container/hibernate" start="EAGER"
module="org.jboss.as.jpa.hibernate:4">
<local-cache name="entity">
<transaction mode="NON_XA" />
Expand All @@ -198,6 +199,18 @@
<eviction strategy="NONE" />
</local-cache>
</cache-container>
<!--
Zanata multi-purpose caches.
-->
<cache-container name="zanata" default-cache="default" jndi-name="java:jboss/infinispan/container/zanata"
start="EAGER"
module="org.jboss.as.clustering.web.infinispan">
<local-cache name="default">
<transaction mode="NON_XA"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0" />
<subsystem xmlns="urn:jboss:domain:jca:1.1">
Expand Down
16 changes: 15 additions & 1 deletion functional-test/src/test/resources/conf/standalone_wildfly.xml
Expand Up @@ -233,7 +233,8 @@
<file-store passivation="false" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate"
jndi-name="java:jboss/infinispan/container/hibernate" start="EAGER">
<local-cache name="entity">
<transaction mode="NON_XA"/>
<eviction strategy="LRU" max-entries="10000"/>
Expand All @@ -249,6 +250,19 @@
<eviction strategy="NONE"/>
</local-cache>
</cache-container>
<!--
Zanata multi-purpose caches.
-->
<cache-container name="zanata" default-cache="default"
jndi-name="java:jboss/infinispan/container/zanata"
start="EAGER"
module="org.jboss.as.clustering.web.infinispan">
<local-cache name="default">
<transaction mode="NON_XA" />
<eviction strategy="LRU" max-entries="10000" />
<expiration max-idle="100000" />
</local-cache>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
<subsystem xmlns="urn:jboss:domain:jca:2.0">
Expand Down
3 changes: 1 addition & 2 deletions mkdocs.yml
Expand Up @@ -13,8 +13,7 @@ pages:
- ['configuration/document-storage-directory.md', 'Configuration', 'Document Storage Directory']
# Once pull request https://github.com/zanata/zanata-server/pull/633 is integrated, this can be uncommented
# - ['configuration/email.md', 'Configuration', 'Email']
# Once pull request https://github.com/zanata/zanata-server/pull/577 is integrated, this can be uncommented
# - ['configuration/infinispan.md', 'Configuration', 'Caches']
- ['configuration/infinispan.md', 'Configuration', 'Caches']
- ['configuration/jms-messaging.md', 'Configuration', 'JMS Messaging']

# Release notes
Expand Down
46 changes: 28 additions & 18 deletions pom.xml
Expand Up @@ -340,6 +340,20 @@
<version>3.2.3.Final</version>
</dependency>

<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
<version>1.4.6.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
<version>1.4.6.Final</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
Expand Down Expand Up @@ -686,6 +700,20 @@
<scope>${hibernate.search.scope}</scope>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-infinispan</artifactId>
<version>${hibernate.search.version}</version>
<scope>${hibernate.search.scope}</scope>
<exclusions>
<!-- Slightly older version provided by the app server -->
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
Expand All @@ -708,12 +736,6 @@
<artifactId>jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
<!--<version>${hibernate.version}</version>-->
</dependency>

Expand Down Expand Up @@ -1486,24 +1508,12 @@
<version>1.2.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
<version>1.4.6.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<version>1.5.2.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling-river</artifactId>
<version>1.4.6.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.modules</groupId>
<artifactId>jboss-modules</artifactId>
Expand Down
10 changes: 5 additions & 5 deletions zanata-model/src/main/java/org/zanata/model/HAccount.java
Expand Up @@ -64,7 +64,7 @@
*
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "username"))
@Indexed
@Setter
Expand All @@ -86,21 +86,21 @@ public class HAccount extends ModelEntityBase implements Serializable {
private HAccount mergedInto;
private Map<String, HAccountOption> editorOptions;

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY,
mappedBy = "account")
public HAccountActivationKey getAccountActivationKey() {
return accountActivationKey;
}

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY,
mappedBy = "account")
public HAccountResetPasswordKey getAccountResetPasswordKey() {
return accountResetPasswordKey;
}

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@OneToOne(mappedBy = "account", cascade = CascadeType.ALL)
public HPerson getPerson() {
return person;
Expand Down Expand Up @@ -134,7 +134,7 @@ public String getApiKey() {
return apiKey;
}

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@UserRoles
@ManyToMany(targetEntity = HAccountRole.class)
@JoinTable(name = "HAccountMembership", joinColumns = @JoinColumn(
Expand Down
Expand Up @@ -28,7 +28,7 @@
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class HAccountResetPasswordKey extends AccountKeyBase implements
Serializable {

Expand Down
Expand Up @@ -43,7 +43,7 @@
@Entity
@TypeDef(name = "conditionRuleAction",
typeClass = ConditionRuleActionType.class)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Setter
@NoArgsConstructor
@AllArgsConstructor
Expand Down
2 changes: 1 addition & 1 deletion zanata-model/src/main/java/org/zanata/model/HDocument.java
Expand Up @@ -82,7 +82,7 @@
*/
@Entity
@EntityListeners({HDocument.EntityListener.class})
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@TypeDef(name = "contentType", typeClass = ContentTypeType.class)
@Setter
@NoArgsConstructor
Expand Down
Expand Up @@ -50,7 +50,7 @@
*
**/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Indexed
@Setter
@EqualsAndHashCode(callSuper = true, doNotUseGetters = true,
Expand Down
Expand Up @@ -59,7 +59,7 @@
*
**/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Indexed
@FullTextFilterDef(name = "glossaryLocaleFilter",
impl = LocaleFilterFactory.class,
Expand Down
4 changes: 2 additions & 2 deletions zanata-model/src/main/java/org/zanata/model/HLocale.java
Expand Up @@ -51,7 +51,7 @@
import com.ibm.icu.util.ULocale;

@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@TypeDef(name = "localeId", typeClass = LocaleIdType.class)
@Setter
@NoArgsConstructor
Expand Down Expand Up @@ -103,7 +103,7 @@ LocaleId getLocaleId() {
}

@OneToMany(cascade = CascadeType.ALL, mappedBy = "id.supportedLanguage")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public Set<HLocaleMember> getMembers() {
if (this.members == null) {
this.members = new HashSet<HLocaleMember>();
Expand Down
2 changes: 1 addition & 1 deletion zanata-model/src/main/java/org/zanata/model/HPerson.java
Expand Up @@ -51,7 +51,7 @@
*
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Setter
@EqualsAndHashCode(callSuper = true, of = { "id", "email", "name" },
doNotUseGetters = true)
Expand Down
6 changes: 3 additions & 3 deletions zanata-model/src/main/java/org/zanata/model/HProject.java
Expand Up @@ -80,7 +80,7 @@
*
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Access(AccessType.FIELD)
@TypeDefs({
@TypeDef(name = "entityStatus", typeClass = EntityStatusType.class),
Expand Down Expand Up @@ -151,7 +151,7 @@ public class HProject extends SlugEntityBase implements Serializable,
@JoinTable(name = "HProject_Maintainer", joinColumns = @JoinColumn(
name = "projectId"), inverseJoinColumns = @JoinColumn(
name = "personId"))
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
private Set<HPerson> maintainers = Sets.newHashSet();

@ManyToMany
Expand All @@ -168,7 +168,7 @@ public class HProject extends SlugEntityBase implements Serializable,
private Map<String, String> customizedValidations = Maps.newHashMap();

@OneToMany(mappedBy = "project")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
private List<HProjectIteration> projectIterations = Lists.newArrayList();

@Type(type = "entityStatus")
Expand Down
Expand Up @@ -76,7 +76,7 @@
import com.google.common.collect.Sets;

@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@TypeDef(name = "entityStatus", typeClass = EntityStatusType.class)
@Restrict
@EntityRestrict({ INSERT, UPDATE, DELETE })
Expand Down
Expand Up @@ -38,7 +38,7 @@
* href="mailto:camunoz@redhat.com">camunoz@redhat.com</a>
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Setter
@ToString(callSuper = true)
public class HRoleAssignmentRule extends ModelEntityBase {
Expand Down
Expand Up @@ -50,7 +50,7 @@
*/
@Entity
@EntityListeners({ HSimpleComment.EntityListener.class })
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@BatchSize(size = 20)
@Setter
@NoArgsConstructor
Expand Down
Expand Up @@ -45,7 +45,7 @@
*
**/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Setter
@NoArgsConstructor
@ToString(of = "comment")
Expand Down
4 changes: 2 additions & 2 deletions zanata-model/src/main/java/org/zanata/model/HTextFlow.java
Expand Up @@ -88,7 +88,7 @@
*/
@Entity
@EntityListeners({ HTextFlow.EntityListener.class })
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Setter
@NoArgsConstructor
@ToString(of = { "resId", "revision", "comment", "obsolete" })
Expand Down Expand Up @@ -384,7 +384,7 @@ public Map<Integer, HTextFlowHistory> getHistory() {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "textFlow")
@MapKeyColumn(name = "locale")
@BatchSize(size = 10)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public Map<Long, HTextFlowTarget> getTargets() {
if (targets == null) {
targets = new HashMap<Long, HTextFlowTarget>();
Expand Down
Expand Up @@ -83,7 +83,7 @@
*/
@Entity
@EntityListeners({ HTextFlowTarget.EntityListener.class })
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Indexed
@Setter
@NoArgsConstructor
Expand Down
Expand Up @@ -49,7 +49,7 @@
*/
@Entity
@Immutable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@BatchSize(size = 20)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Access(AccessType.FIELD)
Expand Down
Expand Up @@ -33,7 +33,7 @@
* @see org.zanata.rest.dto.extensions.gettext.PoHeader
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@ToString(callSuper = true)
public class HPoHeader extends PoHeaderBase {
private static final long serialVersionUID = 1L;
Expand Down
Expand Up @@ -39,7 +39,7 @@
* @see org.zanata.rest.dto.extensions.gettext.PoTargetHeader
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@Setter
@ToString(callSuper = true, of = "targetLanguage")
public class HPoTargetHeader extends PoHeaderBase {
Expand Down

0 comments on commit 5decdf0

Please sign in to comment.