Mergd V4.1-BUG-FIX to HEAD

40195: Merged V3.4-BUG-FIX to V4.1-BUG-FIX
      40193: ALF-15307 / ALF-15190: FTS indexing can stick forever on purged nodes
         - May cut 50 minutes off the build time when merged to V4.1-BUG-FIX!


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@40196 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-08-08 09:33:08 +00:00
parent bb42c798a0
commit 75c3447570

View File

@@ -58,6 +58,7 @@ import org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexer;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.tenant.TenantService; import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
@@ -737,13 +738,10 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
final NodeRef nodeRef = new NodeRef(stringNodeRef); final NodeRef nodeRef = new NodeRef(stringNodeRef);
final NodeRef.Status nodeStatus = nodeService.getNodeStatus(nodeRef); final NodeRef.Status nodeStatus = nodeService.getNodeStatus(nodeRef);
final List<Document> docs = new LinkedList<Document>(); final List<Document> docs = new LinkedList<Document>();
if (nodeStatus == null)
if (nodeStatus == null || nodeStatus.isDeleted())
{ {
throw new InvalidNodeRefException("Node does not exist: " + nodeRef, nodeRef); // If we are being called in non FTS mode on a deleted or purged node, we must still create a new FTS marker
}
else if (nodeStatus.isDeleted())
{
// If we are being called in non FTS mode on a deleted node, we must still create a new FTS marker
// document, in case FTS is currently in progress and about to restore our node! // document, in case FTS is currently in progress and about to restore our node!
addFtsStatusDoc(docs, ftsStatus, nodeRef, nodeStatus); addFtsStatusDoc(docs, ftsStatus, nodeRef, nodeStatus);
return docs; return docs;
@@ -1027,9 +1025,8 @@ public class ADMLuceneIndexerImpl extends AbstractLuceneIndexerImpl<NodeRef> imp
Document doc = new Document(); Document doc = new Document();
doc.add(new Field("ID", GUID.generate(), Field.Store.YES, Field.Index.NO_NORMS, Field.TermVector.NO)); doc.add(new Field("ID", GUID.generate(), Field.Store.YES, Field.Index.NO_NORMS, Field.TermVector.NO));
doc.add(new Field("FTSREF", nodeRef.toString(), Field.Store.YES, Field.Index.NO_NORMS, Field.TermVector.NO)); doc.add(new Field("FTSREF", nodeRef.toString(), Field.Store.YES, Field.Index.NO_NORMS, Field.TermVector.NO));
doc doc.add(new Field("TX", nodeStatus == null ? AlfrescoTransactionSupport.getTransactionId() : nodeStatus
.add(new Field("TX", nodeStatus.getChangeTxnId(), Field.Store.YES, Field.Index.NO_NORMS, .getChangeTxnId(), Field.Store.YES, Field.Index.NO_NORMS, Field.TermVector.NO));
Field.TermVector.NO));
doc.add(new Field("FTSSTATUS", ftsStatus.name(), Field.Store.NO, Field.Index.NO_NORMS, Field.TermVector.NO)); doc.add(new Field("FTSSTATUS", ftsStatus.name(), Field.Store.NO, Field.Index.NO_NORMS, Field.TermVector.NO));
docs.add(doc); docs.add(doc);
} }