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

@@ -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()
{
@@ -147,5 +148,14 @@ public class NodeMetaData
public void setChildIds(List<Long> childIds)
{
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;
@@ -128,9 +130,12 @@ public class SOLRTrackingComponentImpl implements SOLRTrackingComponent
{
this.dictionaryService = dictionaryService;
}
public void setAclDAO(AclDAO aclDAO)
{
this.aclDAO = aclDAO;
}
public void setDictionaryDAO(DictionaryDAO dictionaryDAO)
{
this.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);