New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAK-8718: LuceneIndexStatsUpdateCallback is slow and synchronous whic… #157
Conversation
…h leads to slowness
+1 LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just "formatting" changes
.../src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProvider.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/AsyncIndexesSizeStatsUpdate.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/AsyncIndexesSizeStatsUpdate.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/AsyncIndexesSizeStatsUpdate.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/AsyncIndexesSizeStatsUpdate.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditorProvider.java
Outdated
Show resolved
Hide resolved
try { | ||
long startTime = System.currentTimeMillis(); | ||
int docCount = Integer.parseInt(luceneIndexMBean.getDocCount(indexPath)); | ||
HistogramStats docCountHistogram = statisticsProvider.getHistogram(indexPath + NO_DOCS, StatsOptions.METRICS_ONLY); | ||
docCountHistogram.update(docCount); | ||
log.trace("{} stats updated, docCount {}, timeToUpdate {}", indexPath, docCount, System.currentTimeMillis() - startTime); | ||
long indexSize = Long.parseLong(luceneIndexMBean.getSize(indexPath)); | ||
HistogramStats indexSizeHistogram = statisticsProvider.getHistogram(indexPath + INDEX_SIZE, StatsOptions.METRICS_ONLY); | ||
indexSizeHistogram.update(indexSize); | ||
long endTime = System.currentTimeMillis(); | ||
asyncIndexesSizeStatsUpdate.setLastStatsUpdateTime(indexPath, endTime); | ||
log.debug("{} stats updated; docCount {}, size {}, timeToUpdate {}", indexPath, docCount, indexSize, endTime - startTime); | ||
} catch (IOException e) { | ||
log.debug("could not update no_docs/index_size stats for index at {}", indexPath, e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added other suggestions on top of @thomasmueller ones. Moreover, could we have some unit tests around this?
...rc/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/AsyncIndexesSizeStatsUpdate.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/AsyncIndexesSizeStatsUpdate.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProviderService.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProviderService.java
Show resolved
Hide resolved
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
...main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexStatsUpdateCallback.java
Outdated
Show resolved
Hide resolved
I'd do the review a bit later... But had a general comment - would it be useful to have an interface that's used to store stats. There can then a NOOP implementation which does nothing. A working one which is essentially things extracted from current patch. |
…h leads to slowness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to approve
This PR is stale because it has been open 24 months with no activity. Remove stale label or comment or this will be closed in 30 days. |
…h leads to slowness