You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2017/01/05 13:26:30 UTC

lucene-solr:jira/solr-5944: SOLR-5944: Changing the clearIndex() call in standalone test, adding new schema fieldnames for a test

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-5944 0213b10a1 -> 7431268ab


SOLR-5944: Changing the clearIndex() call in standalone test, adding new schema fieldnames for a test


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7431268a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7431268a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7431268a

Branch: refs/heads/jira/solr-5944
Commit: 7431268ab764723df141e4fc8d72e2bf578c97e7
Parents: 0213b10
Author: Ishan Chattopadhyaya <is...@apache.org>
Authored: Thu Jan 5 18:56:17 2017 +0530
Committer: Ishan Chattopadhyaya <is...@apache.org>
Committed: Thu Jan 5 18:56:17 2017 +0530

----------------------------------------------------------------------
 .../collection1/conf/schema-inplace-updates.xml |  4 +++
 .../update/TestInPlaceUpdatesStandalone.java    | 32 +++++++++++---------
 2 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7431268a/solr/core/src/test-files/solr/collection1/conf/schema-inplace-updates.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-inplace-updates.xml b/solr/core/src/test-files/solr/collection1/conf/schema-inplace-updates.xml
index 2676f0a..d3e86c4 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-inplace-updates.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-inplace-updates.xml
@@ -28,6 +28,10 @@
   <field name="inplace_updatable_float" type="float" indexed="false" stored="false" docValues="true" default="0"/>
   <field name="inplace_updatable_int"   type="int"   indexed="false" stored="false" docValues="true" default="0"/>
 
+  <!-- To be used only in a single test, TestInPlaceUpdatesStandalone#testComputeInPlaceUpdateableFields() -->
+  <field name="inplace_updateable_without_default" type="float" indexed="false" stored="false" docValues="true"/>
+  <field name="inplace_updateable_with_default"    type="float" indexed="false" stored="false" docValues="true" default="0"/>
+
   <!-- dynamic fields which *ONLY* use docValues so they can be updated in place -->
   <dynamicField name="*_i_dvo" multiValued="false" type="int"   docValues="true" indexed="false" stored="false"/>
   <dynamicField name="*_f_dvo" multiValued="false" type="float" docValues="true" indexed="false" stored="false"/>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7431268a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java
index 663e592..465ffe0 100644
--- a/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java
+++ b/solr/core/src/test/org/apache/solr/update/TestInPlaceUpdatesStandalone.java
@@ -20,7 +20,6 @@ package org.apache.solr.update;
 
 import static org.junit.internal.matchers.StringContains.containsString;
 import static org.apache.solr.update.UpdateLogTest.buildAddUpdateCommand;
-import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -42,7 +41,6 @@ import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.SolrInputField;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.update.processor.DistributedUpdateProcessor;
-import org.apache.solr.update.processor.DistributedUpdateProcessor.DistribPhase;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.SolrIndexSearcher;
@@ -72,7 +70,8 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {
 
     // validate that the schema was not changed to an unexpected state
     IndexSchema schema = h.getCore().getLatestSchema();
-    for (String fieldName : Arrays.asList("_version_", "inplace_updatable_float", "inplace_l_dvo")) {
+    for (String fieldName : Arrays.asList("_version_", "inplace_updatable_float", "inplace_l_dvo",
+        "inplace_updateable_with_default", "inplace_updateable_without_default")) {
       // these fields must only be using docValues to support inplace updates
       SchemaField field = schema.getField(fieldName);
       assertTrue(field.toString(),
@@ -90,7 +89,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {
 
   @Before
   public void deleteAllAndCommit() throws Exception {
-    deleteByQueryAndGetVersion("*:*", params("_version_", Long.toString(-Long.MAX_VALUE), DISTRIB_UPDATE_PARAM, DistribPhase.FROMLEADER.toString()));
+    clearIndex();
     assertU(commit("softCommit", "false"));
   }
 
@@ -980,27 +979,30 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {
    * @see AtomicUpdateDocumentMerger#computeInPlaceUpdateableFields 
    */
   @Test
-  public void testIsInPlaceUpdate() throws Exception { // nocommit: rename when isInPlaceUpdate is renamed
+  public void testComputeInPlaceUpdateableFields() throws Exception {
     Set<String> inPlaceUpdatedFields = new HashSet<String>();
 
     // In-place updateable field updated before it exists SHOULD NOT BE in-place updated:
     inPlaceUpdatedFields = callComputeInPlaceUpdateableFields(sdoc("id", "1", "_version_", 42L,
-                                                    "inplace_updatable_float", map("set", 10)));
-    assertFalse(inPlaceUpdatedFields.contains("inplace_updatable_float"));
+                                                    "inplace_updateable_without_default", map("set", 10)));
+    assertFalse(inPlaceUpdatedFields.contains("inplace_updateable_without_default"));
 
     // In-place updateable field updated after it exists SHOULD BE in-place updated:
-    addAndGetVersion(sdoc("id", "1", "inplace_updatable_float", "0"), params()); // setting up the dv
+    addAndGetVersion(sdoc("id", "1", "inplace_updateable_without_default", "0"), params()); // setting up the dv
     inPlaceUpdatedFields = callComputeInPlaceUpdateableFields(sdoc("id", "1", "_version_", 42L,
-                                                    "inplace_updatable_float", map("set", 10)));
-    assertTrue(inPlaceUpdatedFields.contains("inplace_updatable_float"));
+                                                    "inplace_updateable_without_default", map("set", 10)));
+    assertTrue(inPlaceUpdatedFields.contains("inplace_updateable_without_default"));
 
     inPlaceUpdatedFields = callComputeInPlaceUpdateableFields(sdoc("id", "1", "_version_", 42L,
-                                                    "inplace_updatable_float", map("inc", 10)));
-    assertTrue(inPlaceUpdatedFields.contains("inplace_updatable_float"));
+                                                    "inplace_updateable_without_default", map("inc", 10)));
+    assertTrue(inPlaceUpdatedFields.contains("inplace_updateable_without_default"));
     
+    // Updating an in-place updateable field (with a default) for the first time.
+    // DV for it should have been already created when first document was indexed,
+    // since it has a default value
     inPlaceUpdatedFields = callComputeInPlaceUpdateableFields(sdoc("id", "1", "_version_", 42L,
-                                                    "inplace_updatable_int", map("set", 10)));
-    assertTrue(inPlaceUpdatedFields.contains("inplace_updatable_int"));
+                                                    "inplace_updateable_with_default", map("set", 10)));
+    assertTrue(inPlaceUpdatedFields.contains("inplace_updateable_with_default"));
     
     // Non in-place updates
     addAndGetVersion(sdoc("id", "1", "stored_i", "0"), params()); // setting up the dv
@@ -1009,7 +1011,7 @@ public class TestInPlaceUpdatesStandalone extends SolrTestCaseJ4 {
     
     assertTrue("No map means full document update",
                callComputeInPlaceUpdateableFields(sdoc("id", "1", "_version_", 42L,
-                                        "inplace_updatable_int", "100")).isEmpty());
+                                        "inplace_updateable_with_default", "100")).isEmpty());
   
     assertTrue("non existent dynamic dv field updated first time",
                callComputeInPlaceUpdateableFields(sdoc("id", "1", "_version_", 42L,