You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ng...@apache.org on 2021/06/01 16:29:32 UTC

svn commit: r1890367 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java

Author: ngupta
Date: Tue Jun  1 16:29:31 2021
New Revision: 1890367

URL: http://svn.apache.org/viewvc?rev=1890367&view=rev
Log:
OAK-9449 | Any new (elastic) index def added after Out of the band reindexing will trigger reindexing when the async cycle will run the first index update

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java?rev=1890367&r1=1890366&r2=1890367&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java Tue Jun  1 16:29:31 2021
@@ -243,7 +243,18 @@ public class IndexUpdate implements Edit
         // See also OAK-7991.
         boolean result = !before.getChildNode(INDEX_DEFINITIONS_NAME).hasChildNode(name)
                 && !hasAnyHiddenNodes(definition);
-        if (result) {
+        // See OAK-9449
+        // In case of elasticsearch, indexed data is stored remotely and not under hidden nodes, so
+        // in case of OutOfBand indexing during content import, there is no hidden node created for elastic (not even :status)
+        // So, we log a warn and return false to avoid unnecessary reindexing. The warning is only if the someone added the new index node and forgot to add
+        // the reindex flag, in case OutOfBand Indexing has been performed, warning can be ignored.
+        // Also, in case the new elastic node has been added with reindex = true , this method would have already returned true
+        if (result && TYPE_ELASTICSEARCH.equals((type.getValue(Type.STRING)))) {
+            log.warn("Found a new elastic index node [{}]. Please set the reindex flag = true to initiate reindexing." +
+                            "Please ignore if OutOfBand Reindexing has already been performed.",
+                    name);
+            return false;
+        } else if (result) {
             log.info("Found a new index node [{}]. Reindexing is requested",
                     name);
         }