REPO-4969: - merge branch 'master' into support/SP/7.N

This commit is contained in:
Andrei Forascu
2020-02-26 15:05:17 +02:00
5 changed files with 53 additions and 49 deletions

View File

@@ -32,6 +32,12 @@ jobs:
- curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.jar
# Run WhiteSource Unified Agent
- java -jar wss-unified-agent.jar -apiKey ${WHITESOURCE_API_KEY} -c .wss-unified-agent.config
- name: "Source Clear Scan"
# only on SP branches or master and if it is not a PR
if: fork = false AND (branch = master OR branch =~ /support\/SP\/.*/) AND type != pull_request
script: skip
addons:
srcclr: true
- stage: release
name: "Push to Nexus"
if: fork = false AND (branch = master OR branch =~ /support\/.*/) AND type != pull_request AND commit_message !~ /\[no-release\]/

57
pom.xml
View File

@@ -26,8 +26,8 @@
</distributionManagement>
<properties>
<dependency.spring.version>5.1.8.RELEASE</dependency.spring.version>
<dependency.surf.version>7.9</dependency.surf.version>
<dependency.spring.version>5.2.3.RELEASE</dependency.spring.version>
<dependency.surf.version>8.1</dependency.surf.version>
<maven.build.sourceVersion>11</maven.build.sourceVersion>
</properties>
@@ -35,12 +35,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
<version>1.14</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
@@ -68,22 +63,6 @@
<version>2.0.0</version>
<classifier>asl</classifier>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.5</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@@ -112,15 +91,10 @@
<artifactId>spring-context</artifactId>
<version>${dependency.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${dependency.spring.version}</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.1</version>
<version>2.3.2</version>
<!-- exclude c3p0 -->
<!-- see https://issues.alfresco.com/jira/browse/REPO-3447 -->
<exclusions>
@@ -163,12 +137,7 @@
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
<version>2.10.5</version>
</dependency>
<!-- provided dependencies -->
@@ -183,25 +152,19 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.28</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${dependency.spring.version}</version>
<version>1.7.30</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<version>3.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -228,7 +191,7 @@
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.0</version>
<executions>
<execution>
<goals>

View File

@@ -21,6 +21,8 @@ package org.alfresco.util.shard;
import java.util.LinkedList;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
/**
* Common ACL based index sharding behaviour for SOLR and the repository
*
@@ -67,6 +69,13 @@ public class ExplicitShardingPolicy
{
if (test % numNodes == nodeInstance - 1)
{
// This algorithm fails for some sets of parameters. (See SEARCH-1785)
if (shardIds.contains(shard % numShards))
{
throw new AlfrescoRuntimeException("Sharding configuration not supported - unable to create shard list for node " + nodeInstance
+ " (shards:" + numShards + ", replication:" + replicationFactor + ", nodes:" + numNodes + ")."
+ " Please set up the shards manually or use a different sharding configuration.");
}
shardIds.add(shard % numShards);
}
test++;

View File

@@ -36,6 +36,7 @@ import org.springframework.transaction.CannotCreateTransactionException;
import org.springframework.transaction.NoTransactionException;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.transaction.interceptor.TransactionAttribute;
@@ -410,8 +411,15 @@ public class SpringAwareUserTransaction
// begin a transaction
try
{
TransactionManager tm = getTransactionManager();
if (tm != null && !(tm instanceof PlatformTransactionManager))
{
throw new IllegalStateException("Specified transaction manager is not a PlatformTransactionManager: " + tm);
}
internalTxnInfo = createTransactionIfNecessary(
getTransactionManager(), getTransactionAttribute(null, null), getName());
(PlatformTransactionManager) tm, getTransactionAttribute(null, null), getName());
}
catch (CannotCreateTransactionException e)
{

View File

@@ -20,8 +20,11 @@ package org.alfresco.util.shard;
import static org.junit.Assert.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.junit.Test;
/**
@@ -116,6 +119,20 @@ public class ExplicitShardingPolicyTest
{
buildAndTest(10, 2, 4);
}
/** ExplicitShardingPolicy algorithm fails for 2 shards, 3 replicas, 3 nodes. (See SEARCH-1785) */
@Test(expected = AlfrescoRuntimeException.class)
public void search1785_233()
{
buildAndTest(2, 3, 3);
}
/** ExplicitShardingPolicy algorithm fails for 4 shards, 3 replicas, 6 nodes. (See SEARCH-1785) */
@Test (expected = AlfrescoRuntimeException.class)
public void search1785_436()
{
buildAndTest(4, 3, 6);
}
@Test
public void check_10_2()
@@ -163,7 +180,8 @@ public class ExplicitShardingPolicyTest
int[] found = new int[numShards];
for (int i = 0; i < numNodes; i++)
{
List<Integer> shardIds = policy.getShardIdsForNode(i + 1);
// Convert to a set to remove any duplicates.
Set<Integer> shardIds = new HashSet<>(policy.getShardIdsForNode(i + 1));
assertEquals(numShards * replicationFactor / numNodes, shardIds.size());
for (Integer shardId : shardIds)
{