You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/10/25 13:25:29 UTC
svn commit: r1188611 - in /incubator/lcf/trunk: CHANGES.txt
framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java
Author: kwright
Date: Tue Oct 25 11:25:28 2011
New Revision: 1188611
URL: http://svn.apache.org/viewvc?rev=1188611&view=rev
Log:
Fix for CONNECTORS-282.
Modified:
incubator/lcf/trunk/CHANGES.txt
incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java
Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1188611&r1=1188610&r2=1188611&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Tue Oct 25 11:25:28 2011
@@ -3,6 +3,11 @@ $Id$
======================= 0.4-dev =====================
+CONNECTORS-282: Change order in which the incremental ingester does
+things so we don't typically get unique constraint violation warnings in
+the log.
+(Karl Wright)
+
CONNECTORS-280: The job state "DELETESTARTINGUP" was not being
checked for in the status. This meant that during the time that a
job delete was beginning, "Not yet run" would be displayed as the status.
Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java?rev=1188611&r1=1188610&r2=1188611&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java (original)
+++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java Tue Oct 25 11:25:28 2011
@@ -1307,6 +1307,7 @@ public class IncrementalIngester extends
long ingestTime, String documentURI, String documentURIHash)
throws ManifoldCFException
{
+ HashMap map = new HashMap();
while (true)
{
// The table can have at most one row per URI, for non-null URIs. It can also have at most one row per document identifier.
@@ -1327,53 +1328,7 @@ public class IncrementalIngester extends
// If the UPDATE does not appear to modify any rows, this is also a signal that the INSERT must be retried.
//
- // Set up for insert
- HashMap map = new HashMap();
- map.put(lastVersionField,documentVersion);
- map.put(lastOutputVersionField,outputVersion);
- map.put(lastIngestField,new Long(ingestTime));
- if (documentURI != null)
- {
- map.put(docURIField,documentURI);
- map.put(uriHashField,documentURIHash);
- }
- if (authorityNameString != null)
- map.put(authorityNameField,authorityNameString);
- else
- map.put(authorityNameField,"");
-
- Long id = new Long(IDFactory.make(threadContext));
- map.put(idField,id);
- map.put(outputConnNameField,outputConnectionName);
- map.put(docKeyField,docKey);
- map.put(changeCountField,new Long(1));
- map.put(firstIngestField,map.get(lastIngestField));
- beginTransaction();
- try
- {
- performInsert(map,null);
- noteModifications(1,0,0);
- return;
- }
- catch (ManifoldCFException e)
- {
- signalRollback();
- // If this is simply a constraint violation, we just want to fall through and try the update!
- if (e.getErrorCode() != ManifoldCFException.DATABASE_TRANSACTION_ABORT)
- throw e;
- // Otherwise, exit transaction and fall through to 'update' attempt
- }
- catch (Error e)
- {
- signalRollback();
- throw e;
- }
- finally
- {
- endTransaction();
- }
-
- // Insert must have failed. Attempt an update.
+ // Try the update first. Typically this succeeds except in the case where a doc is indexed for the first time.
map.clear();
map.put(lastVersionField,documentVersion);
map.put(lastOutputVersionField,outputVersion);
@@ -1419,7 +1374,8 @@ public class IncrementalIngester extends
return;
}
- // Update failed to find a matching record, so cycle back to retry the insert
+ // Update failed to find a matching record, so try the insert
+ break;
}
catch (ManifoldCFException e)
{
@@ -1445,6 +1401,54 @@ public class IncrementalIngester extends
sleepFor(sleepAmt);
}
}
+
+ // Set up for insert
+ map.clear();
+ map.put(lastVersionField,documentVersion);
+ map.put(lastOutputVersionField,outputVersion);
+ map.put(lastIngestField,new Long(ingestTime));
+ if (documentURI != null)
+ {
+ map.put(docURIField,documentURI);
+ map.put(uriHashField,documentURIHash);
+ }
+ if (authorityNameString != null)
+ map.put(authorityNameField,authorityNameString);
+ else
+ map.put(authorityNameField,"");
+
+ Long id = new Long(IDFactory.make(threadContext));
+ map.put(idField,id);
+ map.put(outputConnNameField,outputConnectionName);
+ map.put(docKeyField,docKey);
+ map.put(changeCountField,new Long(1));
+ map.put(firstIngestField,map.get(lastIngestField));
+ beginTransaction();
+ try
+ {
+ performInsert(map,null);
+ noteModifications(1,0,0);
+ return;
+ }
+ catch (ManifoldCFException e)
+ {
+ signalRollback();
+ // If this is simply a constraint violation, we just want to fall through and try the update!
+ if (e.getErrorCode() != ManifoldCFException.DATABASE_TRANSACTION_ABORT)
+ throw e;
+ // Otherwise, exit transaction and fall through to 'update' attempt
+ }
+ catch (Error e)
+ {
+ signalRollback();
+ throw e;
+ }
+ finally
+ {
+ endTransaction();
+ }
+
+ // Insert must have failed. Attempt an update.
}
}