thomasmueller commented on a change in pull request #357:
URL: https://github.com/apache/jackrabbit-oak/pull/357#discussion_r701733616
##########
File path:
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
##########
@@ -72,6 +73,16 @@
private static final Logger log =
LoggerFactory.getLogger(IndexUpdate.class);
private static final String TYPE_ELASTICSEARCH = "elasticsearch";
+ public static final String DEFAULT_indexJcrTypeInvalidLogLimiter = "1000";
+ //This is used so that wrong index definitions are sparsely logged. After
every 1000 indexing cycles, index definitions
+ // with wrong nodetype will be logged.
+ private static final long indexJcrTypeInvalidLogLimiter =
Long.valueOf(System.getProperty("oak.indexer.indexJcrTypeInvalidLogLimiter",
DEFAULT_indexJcrTypeInvalidLogLimiter));
Review comment:
This should be all caps. And then I think it can be public, so you can
use it from the test.
##########
File path:
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
##########
@@ -274,16 +284,35 @@ private static boolean hasAnyHiddenNodes(NodeBuilder
builder){
return false;
}
+ private void sparseLoggger(String primaryType, String name) {
+ synchronized (countLock) {
+ if ((cyclicExecutionCount >= indexJcrTypeInvalidLogLimiter)) {
Review comment:
I liked the previous "executionCount % LIMIT == 0" better, because it's
simpler.
##########
File path:
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
##########
@@ -72,6 +73,16 @@
private static final Logger log =
LoggerFactory.getLogger(IndexUpdate.class);
private static final String TYPE_ELASTICSEARCH = "elasticsearch";
+ public static final String DEFAULT_indexJcrTypeInvalidLogLimiter = "1000";
Review comment:
I would just inline the 1000 in the line below.
##########
File path:
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
##########
@@ -274,16 +284,35 @@ private static boolean hasAnyHiddenNodes(NodeBuilder
builder){
return false;
}
+ private void sparseLoggger(String primaryType, String name) {
+ synchronized (countLock) {
Review comment:
I don't really see a point in synchronizing it... it's just a warning
message, why is it important that it's synchronized? Worst case (very unlikey),
we see two warning messages, right? Or is there some deeper reason?
--
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]