You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "fabriziofortino (via GitHub)" <gi...@apache.org> on 2023/09/08 08:25:22 UTC

[GitHub] [jackrabbit-oak] fabriziofortino commented on a diff in pull request #1108: OAK-10433 | Throttle warn logs for multivalued ordered property

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


##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java:
##########
@@ -362,10 +371,15 @@ private boolean addTypedOrderedFields(D doc,
                                           PropertyDefinition pd) {
         // Ignore and warn if property multi-valued as not supported
         if (property.getType().isArray()) {
-            log.warn(
-                    "[{}] Ignoring ordered property {} of type {} for path {} as multivalued ordered property not supported",
-                    getIndexName(), pname,
-                    Type.fromTag(property.getType().tag(), true), path);
+            // Log the warning if the counter goes beyond 1000.
+            // We could miss certain paths being logged here since the DocumentMaker is created for each node state for each index.
+            // But ideally a warning with the property in question should suffice.
+            if (!throttleWarnLogs || (throttleWarnLogs && WARN_LOG_COUNTER_MV_ORDERED_PROPERTY.incrementAndGet() > 1000)) {

Review Comment:
   should we make the threshold (1000) configurable?



##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextDocumentMaker.java:
##########
@@ -362,10 +371,15 @@ private boolean addTypedOrderedFields(D doc,
                                           PropertyDefinition pd) {
         // Ignore and warn if property multi-valued as not supported
         if (property.getType().isArray()) {
-            log.warn(
-                    "[{}] Ignoring ordered property {} of type {} for path {} as multivalued ordered property not supported",
-                    getIndexName(), pname,
-                    Type.fromTag(property.getType().tag(), true), path);
+            // Log the warning if the counter goes beyond 1000.
+            // We could miss certain paths being logged here since the DocumentMaker is created for each node state for each index.
+            // But ideally a warning with the property in question should suffice.
+            if (!throttleWarnLogs || (throttleWarnLogs && WARN_LOG_COUNTER_MV_ORDERED_PROPERTY.incrementAndGet() > 1000)) {

Review Comment:
   this can be simplified
   ```suggestion
               if (!throttleWarnLogs || WARN_LOG_COUNTER_MV_ORDERED_PROPERTY.incrementAndGet() > 1000) {
   ```



-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org