ALF-9860: RSOLR 034: Incremental Index Fix

- generic fix, supprot to request purge, index and reindex for tx, node, acl-tx and acl (partly to make broken indexes)
- expose index fix via JMX
- migrate logging in the SOLR project to slf4j to fit the SOLR logging pattern (config to come)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29904 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2011-08-19 10:10:46 +00:00
parent d093b6a8e4
commit 4427a22e03
8 changed files with 108 additions and 34 deletions

View File

@@ -15,6 +15,7 @@
<property name="qnameDAO" ref="qnameDAO"/>
<property name="solrDAO" ref="solrDAO" />
<property name="dictionaryDAO" ref="dictionaryDAO" />
<property name="aclDAO" ref="aclDAO" />
<property name="enabled">
<value>${search.solrTrackingSupport.enabled}</value>
</property>

View File

@@ -81,7 +81,10 @@ public class SolrQueryHTTPClient
{
MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
httpClient = new HttpClient(connectionManager);
httpClient.getParams().setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true);
HttpClientParams params = httpClient.getParams();
params.setBooleanParameter("http.tcp.nodelay", true);
params.setBooleanParameter("http.connection.stalecheck", false);
params.setBooleanParameter(HttpClientParams.PREEMPTIVE_AUTHENTICATION, true);
httpClient.getState().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials("admin", "admin"));
}

View File

@@ -75,4 +75,10 @@ public interface AccessControlListProperties
* @return the id
*/
public Long getId();
/**
* Get the acl change set
* @return - the id of the change set
*/
public Long getAclChangeSetId();
}

View File

@@ -22,7 +22,6 @@ package org.alfresco.repo.security.permissions;
* Basic implementation of access control list properties
*
* @author andyh
*
*/
public class SimpleAccessControlListProperties implements AccessControlListProperties
{
@@ -40,6 +39,8 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
private String aclId;
private Long aclChangeSetId;
// Default constructor
public SimpleAccessControlListProperties()
{
@@ -58,17 +59,17 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
public String getAclId()
{
return aclId;
return aclId;
}
public ACLType getAclType()
{
return aclType;
return aclType;
}
public Long getAclVersion()
{
return aclVersion;
return aclVersion;
}
public Boolean getInherits()
@@ -83,11 +84,12 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
public Boolean isVersioned()
{
return versioned;
return versioned;
}
/**
* Set the acl id
*
* @param aclId
*/
public void setAclId(String aclId)
@@ -97,6 +99,7 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
/**
* Set the acl type
*
* @param aclType
*/
public void setAclType(ACLType aclType)
@@ -106,6 +109,7 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
/**
* Set the acl version
*
* @param aclVersion
*/
public void setAclVersion(Long aclVersion)
@@ -115,6 +119,7 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
/**
* Set inheritance
*
* @param inherits
*/
public void setInherits(boolean inherits)
@@ -124,6 +129,7 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
/**
* Set latest
*
* @param latest
*/
public void setLatest(boolean latest)
@@ -133,6 +139,7 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
/**
* Set versioned
*
* @param versioned
*/
public void setVersioned(boolean versioned)
@@ -147,10 +154,27 @@ public class SimpleAccessControlListProperties implements AccessControlListPrope
/**
* Set the id
*
* @param id
*/
public void setId(Long id)
{
this.id = id;
}
/*
* (non-Javadoc)
* @see org.alfresco.repo.security.permissions.AccessControlListProperties#getChangeSetId()
*/
@Override
public Long getAclChangeSetId()
{
return aclChangeSetId;
}
public void setAclChangeSetId(Long aclChangeSetId)
{
this.aclChangeSetId = aclChangeSetId;
}
}

View File

@@ -30,13 +30,13 @@ public class AclReaders
{
private Long aclId;
private Set<String> readers;
private long aclChangeSetId;
@Override
public String toString()
{
return "AclReaders [aclId=" + aclId + ", readers=" + readers + "]";
return "AclReaders [aclId=" + aclId + ", readers=" + readers + ", aclChangeSetId=" + aclChangeSetId + "]";
}
public Long getAclId()
{
return aclId;
@@ -53,4 +53,13 @@ public class AclReaders
{
this.readers = aclReaders;
}
public long getAclChangeSetId()
{
return aclChangeSetId;
}
public void setAclChangeSetId(long aclChangeSetId)
{
this.aclChangeSetId = aclChangeSetId;
}
}

View File

@@ -36,6 +36,7 @@ public class MetaDataResultsFilter
private boolean includeChildAssociations = true;
private boolean includeNodeRef = true;
private boolean includeChildIds = true;
private boolean includeTxnId = true;
public boolean getIncludeChildAssociations()
{
@@ -117,5 +118,12 @@ public class MetaDataResultsFilter
{
this.includeChildIds = includeChildIds;
}
public boolean getIncludeTxnId()
{
return includeTxnId;
}
public void setIncludeTxnId(boolean includeTxnId)
{
this.includeTxnId = includeTxnId;
}
}

View File

@@ -49,6 +49,7 @@ public class NodeMetaData
private List<ChildAssociationRef> parentAssocs;
private Long parentAssocsCrc;
private List<Long> childIds;
private Long txnId;
public String getOwner()
{
@@ -148,4 +149,13 @@ public class NodeMetaData
{
this.childIds = childIds;
}
public Long getTxnId()
{
return txnId;
}
public void setTxnId(Long txnId)
{
this.txnId = txnId;
}
}

View File

@@ -42,6 +42,7 @@ import org.alfresco.repo.domain.CrcHelper;
import org.alfresco.repo.domain.node.Node;
import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.domain.node.NodeDAO.ChildAssocRefQueryCallback;
import org.alfresco.repo.domain.permissions.AclDAO;
import org.alfresco.repo.domain.qname.QNameDAO;
import org.alfresco.repo.domain.solr.SOLRDAO;
import org.alfresco.repo.solr.AlfrescoModelDiff.TYPE;
@@ -76,6 +77,7 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
private SOLRDAO solrDAO;
private DictionaryDAO dictionaryDAO;
private PermissionService permissionService;
private AclDAO aclDAO;
private OwnableService ownableService;
private TenantService tenantService;
private DictionaryService dictionaryService;
@@ -129,7 +131,10 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
this.dictionaryService = dictionaryService;
}
public void setAclDAO(AclDAO aclDAO)
{
this.aclDAO = aclDAO;
}
public void setDictionaryDAO(DictionaryDAO dictionaryDAO)
{
@@ -149,6 +154,7 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
PropertyCheck.mandatory(this, "tenantService", tenantService);
PropertyCheck.mandatory(this, "dictionaryService", dictionaryService);
PropertyCheck.mandatory(this, "dictionaryDAO", dictionaryDAO);
PropertyCheck.mandatory(this, "aclDAO", aclDAO);
}
@Override
@@ -195,6 +201,7 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
AclReaders readers = new AclReaders();
readers.setAclId(aclId);
readers.setReaders(readersSet);
readers.setAclChangeSetId(aclDAO.getAccessControlList(aclId).getProperties().getAclChangeSetId());
aclsReaders.add(readers);
}
@@ -472,6 +479,7 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
boolean includeChildAssociations = (resultFilter == null ? true : resultFilter.getIncludeChildAssociations());
boolean includeOwner = (resultFilter == null ? true : resultFilter.getIncludeOwner());
boolean includeChildIds = (resultFilter == null ? true : resultFilter.getIncludeChildIds());
boolean includeTxnId = (resultFilter == null ? true : resultFilter.getIncludeTxnId());
List<Long> nodeIds = preCacheNodes(nodeMetaDataParameters);
@@ -492,6 +500,11 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
Pair<Long, NodeRef> pair = nodeDAO.getNodePair(nodeId);
nodeMetaData.setAclId(nodeDAO.getNodeAclId(nodeId));
if(includeTxnId)
{
nodeMetaData.setTxnId(nodeDAO.getNodeRefStatus(pair.getSecond()).getDbTxnId());
}
if(includeType)
{
QName nodeType = nodeDAO.getNodeType(nodeId);