tihom88 commented on a change in pull request #367:
URL: https://github.com/apache/jackrabbit-oak/pull/367#discussion_r705473362



##########
File path: 
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
##########
@@ -280,10 +288,25 @@ private void collectIndexEditors(NodeBuilder definitions,
             NodeBuilder definition = definitions.getChildNode(name);
             if (isIncluded(rootState.async, definition)) {
                 String type = definition.getString(TYPE_PROPERTY_NAME);
+                String primaryType = 
definition.getName(JcrConstants.JCR_PRIMARYTYPE);
                 if (type == null) {
                     // probably not an index def
                     continue;
                 }
+                /*
+                 Log a warning after every indexJcrTypeInvalidLogLimiter 
cycles of indexer where nodeState changed.
+                 and skip further execution for invalid nodetype of index 
definition.
+                 */
+                if 
(!IndexConstants.INDEX_DEFINITIONS_NODE_TYPE.equals(primaryType)) {
+                    // It is a cyclic counter which reset back to 0 after 
INDEX_JCR_TYPE_INVALID_LOG_LIMITER
+                    // This is to sparsely log this warning.
+                    if ((cyclicExecutionCount >= 
INDEX_JCR_TYPE_INVALID_LOG_LIMITER)) {

Review comment:
       Well the case is already taken care of as we are setting :
   `private static volatile long cyclicExecutionCount = 
INDEX_JCR_TYPE_INVALID_LOG_LIMITER;`
   So on first call itself the condition to log is met.
   
   But I can change it to modulo, if it is about readability of code.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to