-
Notifications
You must be signed in to change notification settings - Fork 246
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
HSEARCH-2945 Configure default mass indexing logging monitor #4314
Conversation
It's a shame that this will only work with the default monitor, no? 🤔
Ok.
Why? Regarding the solution... In order to make it work with the default monitor, but also custom ones, we could imagine allowing the monitor itself to influence the behavior? I.e.:
I'm not suggesting this exact API -- names are bad, in particular -- but you get the idea. Then making it work with the default monitor would be a matter of exposing that monitor -- e.g.: massIndexer.monitor(DefaultMassIndexingMonitor.builder().countOnStart(true));
// OR
massIndexer.monitor(DefaultMassIndexingMonitor.builder().countOnBeforeType(true));
// OR ... |
well ... the call to get the total count is currently made by mass indexer itself, and the value is passed to the monitor (no matter what the impl of that monitor is, right). So if we config this at the mass indexer level it makes sense to allow disable the count call for both the built-in one and custom ones. what you wrote made me think ... we have this in the type group monitor now: Lines 43 to 48 in 684ba49
what if instead of the total count or nothing, we pass the context that exposes some access to the loading strategy ( that can do the counting) through a context class and have something like: public interface MassIndexingTypeGroupMonitor {
void documentsAdded(long increment);
// gets called when we create a workspace for the type group
// so essentially can be used by us to do the counts before the indexing starts
void typeGroupInitialized(SomeContext context);
// gets called when the identifier loading runnable starts:
void indexingStarted(SomeContext context);
// gets called when all indexing runnables for the group are completed.
void indexingCompleted(SomeContext context);
} then in the main mass indexing monitor we |
Your suggestion makes sense to me. This is starting to get complex though, so I'd suggest:
|
452f7ee
to
3eaf77f
Compare
...jo-base/src/main/java/org/hibernate/search/mapper/pojo/massindexing/MassIndexingMonitor.java
Show resolved
Hide resolved
...rc/main/java/org/hibernate/search/mapper/pojo/massindexing/MassIndexingTypeGroupMonitor.java
Outdated
Show resolved
Hide resolved
.../hibernate/search/integrationtest/mapper/pojo/massindexing/MassIndexingDefaultMonitorIT.java
Outdated
Show resolved
Hide resolved
3eaf77f
to
12b8628
Compare
@yrodiere let me know if you'd want to have a look at this one 😉 |
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.
LGTM, thanks!
Seems you still need to add something to the migration guide? |
12b8628
to
11f5813
Compare
11f5813
to
a4bfc9b
Compare
Quality Gate passedIssues Measures |
https://hibernate.atlassian.net/browse/HSEARCH-2945
I've tried a few approaches, and it seems that having a "dedicated" method to configure the default monitor looks better than others...
Having more options on the mass indexer itself may work for a config like "don't do counts at all" but not for the "count the entities before indexing starts.
Let me know if you have any other ideas we could try. Opening as a draft for now as some more tests are needed and the impl of the monitor should be cleaned up a bit.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.