You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/01/15 18:12:05 UTC

svn commit: r1433530 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/update/processor/ solr/core/src/test-files/solr/collection1/conf/ solr/core/src/test/org/apache/solr/update/processor/

Author: shalin
Date: Tue Jan 15 17:12:04 2013
New Revision: 1433530

URL: http://svn.apache.org/viewvc?rev=1433530&view=rev
Log:
SOLR-4016: Deduplication does not work with atomic/partial updates so disallow atomic update requests which change signature generating fields.

Added:
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/TestPartialUpdateDeduplication.java
      - copied unchanged from r1433013, lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/processor/TestPartialUpdateDeduplication.java
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1433530&r1=1433529&r2=1433530&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Tue Jan 15 17:12:04 2013
@@ -617,6 +617,10 @@ Other Changes
 * SOLR-4287: Removed "apache-" prefix from Solr distribution and artifact
   filenames. (Ryan Ernst, Robert Muir, Steve Rowe)
 
+* SOLR-4016: Deduplication does not work with atomic/partial updates so
+  disallow atomic update requests which change signature generating fields.
+  (Joel Nothman, yonik, shalin)
+
 ==================  4.0.0 ==================
 
 Versions of Major Components

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java?rev=1433530&r1=1433529&r2=1433530&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/processor/SignatureUpdateProcessorFactory.java Tue Jan 15 17:12:04 2013
@@ -134,7 +134,13 @@ public class SignatureUpdateProcessorFac
       if (enabled) {
         SolrInputDocument doc = cmd.getSolrInputDocument();
         List<String> currDocSigFields = null;
+        boolean isPartialUpdate = DistributedUpdateProcessor.isAtomicUpdate(cmd);
         if (sigFields == null || sigFields.size() == 0) {
+          if (isPartialUpdate)  {
+            throw new SolrException
+                (ErrorCode.SERVER_ERROR,
+                    "Can't use SignatureUpdateProcessor with partial updates on signature fields");
+          }
           Collection<String> docFields = doc.getFieldNames();
           currDocSigFields = new ArrayList<String>(docFields.size());
           currDocSigFields.addAll(docFields);
@@ -149,6 +155,12 @@ public class SignatureUpdateProcessorFac
         for (String field : currDocSigFields) {
           SolrInputField f = doc.getField(field);
           if (f != null) {
+            if (isPartialUpdate)  {
+              throw new SolrException
+                  (ErrorCode.SERVER_ERROR,
+                      "Can't use SignatureUpdateProcessor with partial update request " +
+                          "containing signature field: " + field);
+            }
             sig.add(field);
             Object o = f.getValue();
             if (o instanceof Collection) {

Modified: lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml?rev=1433530&r1=1433529&r2=1433530&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml Tue Jan 15 17:12:04 2013
@@ -47,6 +47,29 @@
     </updateLog>
   </updateHandler>
 
+  <updateRequestProcessorChain name="dedupe">
+    <processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
+      <bool name="enabled">true</bool>
+      <bool name="overwriteDupes">true</bool>
+      <str name="fields">v_t,t_field</str>
+      <str name="signatureClass">org.apache.solr.update.processor.TextProfileSignature</str>
+    </processor>
+    <processor class="solr.RunUpdateProcessorFactory" />
+  </updateRequestProcessorChain>
+  <updateRequestProcessorChain name="stored_sig">
+    <!-- this chain is valid even though the signature field is not
+         indexed, because we are not asking for dups to be overwritten
+      -->
+    <processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
+      <bool name="enabled">true</bool>
+      <str name="signatureField">non_indexed_signature_sS</str>
+      <bool name="overwriteDupes">false</bool>
+      <str name="fields">v_t,t_field</str>
+      <str name="signatureClass">org.apache.solr.update.processor.TextProfileSignature</str>
+    </processor>
+    <processor class="solr.RunUpdateProcessorFactory" />
+  </updateRequestProcessorChain>
+
   <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
 
 </config>

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java?rev=1433530&r1=1433529&r2=1433530&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/update/processor/SignatureUpdateProcessorFactoryTest.java Tue Jan 15 17:12:04 2013
@@ -64,7 +64,7 @@ public class SignatureUpdateProcessorFac
     chain = "dedupe"; // set the default that most tests expect
   }
 
-  void checkNumDocs(int n) {
+  static void checkNumDocs(int n) {
     SolrQueryRequest req = req();
     try {
       assertEquals(n, req.getSearcher().getIndexReader().numDocs());
@@ -353,7 +353,11 @@ public class SignatureUpdateProcessorFac
     }
   }
 
-  private void addDoc(String doc) throws Exception {
+  private void addDoc(String doc) throws Exception  {
+    addDoc(doc, chain);
+  }
+
+  static void addDoc(String doc, String chain) throws Exception {
     Map<String, String[]> params = new HashMap<String, String[]>();
     MultiMapSolrParams mmparams = new MultiMapSolrParams(params);
     params.put(UpdateParams.UPDATE_CHAIN, new String[] { chain });