Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff068d8d3f | ||
|
|
354ea3f337 | ||
|
|
ed2251065d | ||
|
|
1aa133876a | ||
|
|
b737bccd1c | ||
|
|
18ca6f09c5 |
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>asie-platform-module-parent</artifactId>
|
<artifactId>asie-platform-module-parent</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
+33
-34
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>asie-platform-module-parent</artifactId>
|
<artifactId>asie-platform-module-parent</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
@@ -33,39 +33,6 @@
|
|||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to shared -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.inteligr8</groupId>
|
|
||||||
<artifactId>common-rest-client</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to solr-api -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.ws.rs</groupId>
|
|
||||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
|
||||||
<version>4.0.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.annotation</groupId>
|
|
||||||
<artifactId>jakarta.annotation-api</artifactId>
|
|
||||||
<version>3.0.0</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
||||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
||||||
<version>2.17.3</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.module</groupId>
|
|
||||||
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
|
|
||||||
<version>2.17.2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
@@ -90,6 +57,38 @@
|
|||||||
<version>1.3.2-acs-v23.3</version>
|
<version>1.3.2-acs-v23.3</version>
|
||||||
<type>amp</type>
|
<type>amp</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to shared -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.inteligr8</groupId>
|
||||||
|
<artifactId>common-rest-client</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Provided by cxf-jaxrs-platform-module, but packaged due to solr-api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.ws.rs</groupId>
|
||||||
|
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||||
|
<version>4.0.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.annotation</groupId>
|
||||||
|
<artifactId>jakarta.annotation-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>2.17.3</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.module</groupId>
|
||||||
|
<artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
|
||||||
|
<version>2.17.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Including for testing purposes only -->
|
<!-- Including for testing purposes only -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>asie-platform-module-parent</artifactId>
|
<artifactId>asie-platform-module-parent</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>ASIE Platform Module Parent</name>
|
<name>ASIE Platform Module Parent</name>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>asie-platform-module-parent</artifactId>
|
<artifactId>asie-platform-module-parent</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
+51
-28
@@ -11,6 +11,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.index.shard.Floc;
|
import org.alfresco.repo.index.shard.Floc;
|
||||||
@@ -18,6 +19,8 @@ import org.alfresco.repo.index.shard.Shard;
|
|||||||
import org.alfresco.repo.index.shard.ShardInstance;
|
import org.alfresco.repo.index.shard.ShardInstance;
|
||||||
import org.alfresco.repo.index.shard.ShardRegistry;
|
import org.alfresco.repo.index.shard.ShardRegistry;
|
||||||
import org.alfresco.repo.index.shard.ShardState;
|
import org.alfresco.repo.index.shard.ShardState;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchParameters;
|
import org.alfresco.service.cmr.search.SearchParameters;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
@@ -48,12 +51,18 @@ public abstract class AbstractNodeActionService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NamespaceService namespaceService;
|
private NamespaceService namespaceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApiService apiService;
|
private ApiService apiService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ExecutorManager executorManager;
|
private ExecutorManager executorManager;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SolrShardHashService shardHashService;
|
||||||
|
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
@Qualifier(Constants.QUALIFIER_ASIE)
|
@Qualifier(Constants.QUALIFIER_ASIE)
|
||||||
private ShardRegistry shardRegistry;
|
private ShardRegistry shardRegistry;
|
||||||
@@ -216,42 +225,56 @@ public abstract class AbstractNodeActionService {
|
|||||||
|
|
||||||
List<com.inteligr8.alfresco.asie.model.ShardInstance> instances = new LinkedList<>();
|
List<com.inteligr8.alfresco.asie.model.ShardInstance> instances = new LinkedList<>();
|
||||||
|
|
||||||
List<ShardInstance> slicedInstances = this.shardRegistry.getIndexSlice(searchParams);
|
// we need a ShardRegistry method like getIndexSlice, but
|
||||||
if (slicedInstances != null) {
|
// (1) works with shard methods other than explicit
|
||||||
this.logger.trace("Due to a sharding method, considering only applicable shards and their ASIE nodes: {}: {}", nodeDbId, slicedInstances);
|
// (2) returns all possible instances/nodes, not just one node per instance
|
||||||
|
|
||||||
for (ShardInstance instance : slicedInstances)
|
for (Entry<Floc, Map<Shard, Set<ShardState>>> floc : this.shardRegistry.getFlocs().entrySet()) {
|
||||||
instances.add(this.toModel(instance));
|
if (!floc.getKey().getStoreRefs().contains(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE))
|
||||||
} else {
|
continue;
|
||||||
for (Entry<Floc, Map<Shard, Set<ShardState>>> floc : this.shardRegistry.getFlocs().entrySet()) {
|
|
||||||
if (!floc.getKey().getStoreRefs().contains(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE))
|
Integer shardHash = null;
|
||||||
continue;
|
ShardSet shardset = null;
|
||||||
for (Entry<Shard, Set<ShardState>> shard : floc.getValue().entrySet()) {
|
for (Entry<Shard, Set<ShardState>> shard : floc.getValue().entrySet()) {
|
||||||
for (ShardState shardState : shard.getValue())
|
for (ShardState shardState : shard.getValue()) {
|
||||||
|
// every shard and instance (state) in the FLOC is the same
|
||||||
|
// but we need one ShardState to determine the full configuration
|
||||||
|
// so we are computing the shardHash once and caching it
|
||||||
|
if (shardset == null) {
|
||||||
|
shardset = ShardSet.from(floc.getKey(), shardState);
|
||||||
|
switch (shardset.getMethod()) {
|
||||||
|
case PROPERTY:
|
||||||
|
this.logger.trace("Using property-based sharding method; discovering target shard ...");
|
||||||
|
NodeRef nodeRef = this.nodeService.getNodeRef(nodeDbId);
|
||||||
|
Object propValue = this.nodeService.getProperty(nodeRef, QName.createQName(shardset.getPrefixedProperty(), this.namespaceService));
|
||||||
|
if (propValue != null) {
|
||||||
|
this.logger.trace("Discovered node property for sharding: {} <=> {} => {}", nodeDbId, nodeRef, propValue);
|
||||||
|
Matcher matcher = shardset.getRegex().matcher(propValue.toString());
|
||||||
|
String hashable = matcher.group(1);
|
||||||
|
this.logger.trace("Extracted shardable value from node: {} <=> {} => {}", nodeDbId, propValue, hashable);
|
||||||
|
shardHash = this.shardHashService.hash(hashable, shardset.getShards().intValue());
|
||||||
|
this.logger.debug("Hash shardable value to shard instance ID: {} <=> {} => {}", nodeDbId, hashable, shardHash);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this.logger.trace("Despite sharding, considering all shards and nodes without optimization: {}: {}", nodeDbId, instances);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shardHash != null) {
|
||||||
|
if (shard.getKey().getInstance() == shardHash)
|
||||||
|
instances.add(this.toModel(shardState.getShardInstance(), shardState));
|
||||||
|
} else {
|
||||||
instances.add(this.toModel(shardState.getShardInstance(), shardState));
|
instances.add(this.toModel(shardState.getShardInstance(), shardState));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.trace("Despite sharding, considering all shards and nodes: {}: {}", nodeDbId, instances);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return instances;
|
return instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
private com.inteligr8.alfresco.asie.model.ShardInstance toModel(ShardInstance instance) {
|
|
||||||
// get any random shardState
|
|
||||||
Floc floc = instance.getShard().getFloc();
|
|
||||||
Map<Shard, Set<ShardState>> shardsStates = this.shardRegistry.getFlocs().get(floc);
|
|
||||||
if (shardsStates == null)
|
|
||||||
throw new IllegalStateException();
|
|
||||||
Set<ShardState> shardStates = shardsStates.get(instance.getShard());
|
|
||||||
if (shardStates == null || shardStates.isEmpty())
|
|
||||||
throw new IllegalStateException();
|
|
||||||
ShardState anyShardState = shardStates.iterator().next();
|
|
||||||
|
|
||||||
return this.toModel(instance, anyShardState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private com.inteligr8.alfresco.asie.model.ShardInstance toModel(ShardInstance instance, ShardState anyShardState) {
|
private com.inteligr8.alfresco.asie.model.ShardInstance toModel(ShardInstance instance, ShardState anyShardState) {
|
||||||
Floc floc = instance.getShard().getFloc();
|
Floc floc = instance.getShard().getFloc();
|
||||||
|
|
||||||
|
|||||||
@@ -289,19 +289,19 @@ public class AcsReconcileService implements InitializingBean, DisposableBean {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void success(ShardInstance instance) {
|
public void success(ShardInstance instance) {
|
||||||
reconcileLogger.info("INDEXED: {} <=> {}", nodeDbId, nodeRef);
|
reconcileLogger.info("INDEXED: {} <=> {} in {}", nodeDbId, nodeRef, instance);
|
||||||
syncHosts.add(instance);
|
syncHosts.add(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduled(ShardInstance instance) {
|
public void scheduled(ShardInstance instance) {
|
||||||
reconcileLogger.info("INDEXING: {} <=> {}", nodeDbId, nodeRef);
|
reconcileLogger.info("INDEXING: {} <=> {} in {}", nodeDbId, nodeRef, instance);
|
||||||
asyncHosts.add(instance);
|
asyncHosts.add(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(ShardInstance instance, String message) {
|
public void error(ShardInstance instance, String message) {
|
||||||
reconcileLogger.info("FAILED INDEX: {} <=> {}", nodeDbId, nodeRef);
|
reconcileLogger.info("FAILED INDEX: {} <=> {} in {}", nodeDbId, nodeRef, instance);
|
||||||
errorHosts.put(instance, message);
|
errorHosts.put(instance, message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -331,19 +331,19 @@ public class AcsReconcileService implements InitializingBean, DisposableBean {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void success(ShardInstance instance) {
|
public void success(ShardInstance instance) {
|
||||||
reconcileLogger.info("REINDEXED: {} <=> {}", nodeDbId, nodeRef);
|
reconcileLogger.info("REINDEXED: {} <=> {} in {}", nodeDbId, nodeRef, instance);
|
||||||
syncHosts.add(instance);
|
syncHosts.add(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduled(ShardInstance instance) {
|
public void scheduled(ShardInstance instance) {
|
||||||
reconcileLogger.info("REINDEXING: {} <=> {}", nodeDbId, nodeRef);
|
reconcileLogger.info("REINDEXING: {} <=> {} in {}", nodeDbId, nodeRef, instance);
|
||||||
asyncHosts.add(instance);
|
asyncHosts.add(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(ShardInstance instance, String message) {
|
public void error(ShardInstance instance, String message) {
|
||||||
reconcileLogger.info("FAILED REINDEX: {} <=> {}", nodeDbId, nodeRef);
|
reconcileLogger.info("FAILED REINDEX: {} <=> {} in {}", nodeDbId, nodeRef, instance);
|
||||||
errorHosts.put(instance, message);
|
errorHosts.put(instance, message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
<artifactId>asie-platform-module-parent</artifactId>
|
<artifactId>asie-platform-module-parent</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<relativePath>../</relativePath>
|
<relativePath>../</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user