mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Fix for ACE-4575 SOLR 4 - Sharded - Backup should fail gracefully
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@117847 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,6 +49,9 @@
|
|||||||
<property name="solrAdminClient">
|
<property name="solrAdminClient">
|
||||||
<ref bean="solrAdminClient" />
|
<ref bean="solrAdminClient" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="solrQueryHTTPClient">
|
||||||
|
<ref bean="search.solrQueryHTTPCLient" />
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- archive://SpacesStore - archive -->
|
<!-- archive://SpacesStore - archive -->
|
||||||
@@ -98,6 +101,9 @@
|
|||||||
<property name="solrAdminClient">
|
<property name="solrAdminClient">
|
||||||
<ref bean="solrAdminClient" />
|
<ref bean="solrAdminClient" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="solrQueryHTTPClient">
|
||||||
|
<ref bean="search.solrQueryHTTPCLient" />
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -52,6 +52,9 @@
|
|||||||
<property name="fixNumberToKeepOffByOneError">
|
<property name="fixNumberToKeepOffByOneError">
|
||||||
<value>true</value>
|
<value>true</value>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="solrQueryHTTPClient">
|
||||||
|
<ref bean="search.solrQueryHTTPCLient" />
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- archive://SpacesStore - archive -->
|
<!-- archive://SpacesStore - archive -->
|
||||||
@@ -104,6 +107,9 @@
|
|||||||
<property name="fixNumberToKeepOffByOneError">
|
<property name="fixNumberToKeepOffByOneError">
|
||||||
<value>true</value>
|
<value>true</value>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="solrQueryHTTPClient">
|
||||||
|
<ref bean="search.solrQueryHTTPCLient" />
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -55,8 +55,8 @@ public class SolrBackupClient implements InitializingBean
|
|||||||
private boolean fixNumberToKeepOffByOneError = false;
|
private boolean fixNumberToKeepOffByOneError = false;
|
||||||
|
|
||||||
private SOLRAdminClient solrAdminClient;
|
private SOLRAdminClient solrAdminClient;
|
||||||
|
|
||||||
|
|
||||||
|
private SolrQueryHTTPClient solrQueryHTTPClient;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,6 +87,11 @@ public class SolrBackupClient implements InitializingBean
|
|||||||
this.remoteBackupLocation = remoteBackupLocation;
|
this.remoteBackupLocation = remoteBackupLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSolrQueryHTTPClient(SolrQueryHTTPClient solrQueryHTTPClient)
|
||||||
|
{
|
||||||
|
this.solrQueryHTTPClient = solrQueryHTTPClient;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param numberToKeep the numberToKeep to set
|
* @param numberToKeep the numberToKeep to set
|
||||||
*/
|
*/
|
||||||
@@ -97,6 +102,10 @@ public class SolrBackupClient implements InitializingBean
|
|||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
{
|
{
|
||||||
|
if(solrQueryHTTPClient.isSharded())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String lockToken = getLock(60000);
|
String lockToken = getLock(60000);
|
||||||
if (lockToken == null)
|
if (lockToken == null)
|
||||||
|
@@ -36,6 +36,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
|||||||
import org.alfresco.opencmis.dictionary.CMISStrictDictionaryService;
|
import org.alfresco.opencmis.dictionary.CMISStrictDictionaryService;
|
||||||
import org.alfresco.repo.admin.RepositoryState;
|
import org.alfresco.repo.admin.RepositoryState;
|
||||||
import org.alfresco.repo.domain.node.NodeDAO;
|
import org.alfresco.repo.domain.node.NodeDAO;
|
||||||
|
import org.alfresco.repo.index.shard.Floc;
|
||||||
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.search.impl.lucene.JSONResult;
|
import org.alfresco.repo.search.impl.lucene.JSONResult;
|
||||||
@@ -931,4 +932,35 @@ public class SolrQueryHTTPClient implements BeanFactoryAware, InitializingBean
|
|||||||
throw new LuceneQueryParserException("", e);
|
throw new LuceneQueryParserException("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isSharded()
|
||||||
|
{
|
||||||
|
if((shardRegistry != null) && useDynamicShardRegistration)
|
||||||
|
{
|
||||||
|
for( Floc floc : shardRegistry.getFlocs().keySet())
|
||||||
|
{
|
||||||
|
if(floc.getNumberOfShards() > 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(SolrStoreMappingWrapper mapping : mappingLookup.values())
|
||||||
|
{
|
||||||
|
if(mapping.isSharded())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user