thomasmueller commented on a change in pull request #351:
URL: https://github.com/apache/jackrabbit-oak/pull/351#discussion_r698269599



##########
File path: 
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
##########
@@ -280,10 +296,19 @@ 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.
+                 */
+                if 
(!IndexConstants.INDEX_DEFINITIONS_NODE_TYPE.equals(primaryType)
+                        && totalExecutionCount % indexJcrTypeInvalidLogLimiter 
== 0) {

Review comment:
       This isn't relevant here, but just FYI:
   
   "%" (modulo) is a relatively slow CPU instructions (same as division). 
Multiplication is faster, and bitwise and is even faster. 
   
   Here, in theory, it would be possible to use bitwise and, but then 
indexJcrTypeInvalidLogLimiter would need to be a power of 2. 
   
   To avoid modulo for e.g. a hash map, when calculating the bucket from the 
hash code, if the number of buckets isn't a power of 2, one can use 
multiplication & shift. See 
https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/




-- 
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