fabriziofortino commented on code in PR #871:
URL: https://github.com/apache/jackrabbit-oak/pull/871#discussion_r1136644360


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java:
##########
@@ -330,9 +334,14 @@ private void collectIndexEditors(NodeBuilder definitions,
                     // then we don't need to handle missing handler
                     if (definition.hasProperty(ASYNC_PROPERTY_NAME) && 
rootState.async == null) {
                         if (!TYPE_DISABLED.equals(type)) {
-                            log.warn("Missing provider for nrt/sync index: {} 
(rootState.async: {}). " +
-                                    "Please note, it means that index data 
should be trusted only after this index " +
-                                    "is processed in an async indexing 
cycle.", definition, rootState.async);
+                            long now = System.currentTimeMillis();
+                            if (now > lastMissingProviderMessageTime + 60 * 
1000) {
+                                lastMissingProviderMessageTime = now;
+                                log.warn("Missing provider for nrt/sync index: 
{} (rootState.async: {}). " +
+                                        "Please note, it means that index data 
should be trusted only after this index " +
+                                        "is processed in an async indexing 
cycle. " +
+                                        "This message is silenced for one 
minute.", definition, rootState.async);

Review Comment:
   `rootState.async` is always null here (see check at line 335)



##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java:
##########
@@ -330,9 +334,14 @@ private void collectIndexEditors(NodeBuilder definitions,
                     // then we don't need to handle missing handler
                     if (definition.hasProperty(ASYNC_PROPERTY_NAME) && 
rootState.async == null) {
                         if (!TYPE_DISABLED.equals(type)) {
-                            log.warn("Missing provider for nrt/sync index: {} 
(rootState.async: {}). " +
-                                    "Please note, it means that index data 
should be trusted only after this index " +
-                                    "is processed in an async indexing 
cycle.", definition, rootState.async);
+                            long now = System.currentTimeMillis();
+                            if (now > lastMissingProviderMessageTime + 60 * 
1000) {
+                                lastMissingProviderMessageTime = now;
+                                log.warn("Missing provider for nrt/sync index: 
{} (rootState.async: {}). " +
+                                        "Please note, it means that index data 
should be trusted only after this index " +
+                                        "is processed in an async indexing 
cycle. " +
+                                        "This message is silenced for one 
minute.", definition, rootState.async);

Review Comment:
   the placeholder in 
   
   ```Missing provider for nrt/sync index: {}```
   
   is replaced with the variable `definition` which is an instance of 
NodeBuilder. Should we instead pass `indexPath` defined at line 312?



##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java:
##########
@@ -82,6 +82,10 @@ public class IndexUpdate implements Editor, PathSource {
     // This counter is cyclically incremented till 
indexJcrTypeInvalidLogLimiter and then reset to 0
     private static volatile long cyclicExecutionCount = 
INDEX_JCR_TYPE_INVALID_LOG_LIMITER;
 
+    // Warnings about missing index providers are rate limitted, so that the 
log file is not filled with them.

Review Comment:
   typo + minor suggestion
   ```suggestion
       // Warnings about missing index providers are rate limited, so the log 
file is not filled with them.
   ```



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