-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add Hibernate Search management endpoint #35065
Add Hibernate Search management endpoint #35065
Conversation
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.
Thanks! Comments below.
Is it ok for management endpoints to be more complex than simple GET
Well for a start, in this case it most definitely should be a POST, because GET semantics are not a good match :)
And I guess you should be able to accept a payload, yes.
Do we want the mass-indexer configuration to be available at all
It's certainly useful, I'm just not sure we want to maintain this.
But if you've already started working on this... let's say "yes, but be sure to mark this as preview technology in the documentation"? I don't see any documentation, btw :)
Do we want to be more flexible and allow indexing not all but a subset of entities? There's a filter in a query params for now that can do it, but again, maybe it would be better to move it to the request body?
Makes sense. I'd suggest relying on entity type names: searchMapping.scope( Object.class, Arrays.asList( "entityName1", "entityName2" ) )
Same about tenants, with an improvement we've added to Search mass-indexer should pick all tenants automatically, but maybe we want to have a filter for tenants too?
Makes sense.
How about more granular operations like reindexing a specific entity (by ID)? We could do it through an indexing plan...
Looks interesting, and indeed I've used such things myself, but I'd suggest creating a separate ticket as we need to refine the requirements: should this trigger reindexing of containing classes (in which case IndexingPlan
makes sense)? Or just the entity we're being pointed to (in which case MassIndexer
with a condition is more appropriate).
I remember implementing similar logic in the webapps quite often
I'd be interested in discussing those webapps (offline); I thought you hadn't used Hibernate Search much before joining the team :)
...s/hibernate/search/orm/elasticsearch/runtime/management/HibernateSearchManagementConfig.java
Outdated
Show resolved
Hide resolved
...s/hibernate/search/orm/elasticsearch/runtime/management/HibernateSearchManagementConfig.java
Outdated
Show resolved
Hide resolved
integration-tests/hibernate-search-orm-elasticsearch/src/main/resources/application.properties
Outdated
Show resolved
Hide resolved
.../quarkus/it/hibernate/search/orm/elasticsearch/management/HibernateSearchManagementTest.java
Outdated
Show resolved
Hide resolved
86e03cd
to
cfdfa59
Compare
Hey Yoann 😃
I've also noticed that there seems to be a problem with Flyway... |
🙈 The PR is closed and the preview is expired. |
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.
Thanks. A few comments below.
I've also noticed that there seems to be a problem with Flyway... quarkus.flyway.clean-at-start cleans the records (including the ones in the flyway_schema_history, but it keeps the tables. This means if the tests are executed against the same container, they try to run the migration, but that fails because all the DB objects are still there... so I've added a couple of drop statements to the script to address the issue for the tests. But overall this looks like a bug to me...
No idea what is going on. Maybe open a bug report?
...s/hibernate/search/orm/elasticsearch/runtime/management/HibernateSearchManagementConfig.java
Outdated
Show resolved
Hide resolved
.../hibernate/search/orm/elasticsearch/runtime/management/HibernateSearchManagementHandler.java
Outdated
Show resolved
Hide resolved
...bernate/search/orm/elasticsearch/runtime/management/HibernateSearchPostRequestProcessor.java
Outdated
Show resolved
Hide resolved
.../quarkus/it/hibernate/search/orm/elasticsearch/management/HibernateSearchManagementTest.java
Outdated
Show resolved
Hide resolved
cfdfa59
to
4cdcf29
Compare
4cdcf29
to
5a33f53
Compare
...bernate/search/orm/elasticsearch/runtime/management/HibernateSearchPostRequestProcessor.java
Outdated
Show resolved
Hide resolved
...kus/hibernate/search/orm/elasticsearch/deployment/HibernateSearchElasticsearchProcessor.java
Outdated
Show resolved
Hide resolved
5a33f53
to
795bba0
Compare
Thanks @marko-bekhta , LGTM. I'll mark this as ready for review, since... it's already been reviewed :) Let's see what CI has to say about it. |
This comment has been minimized.
This comment has been minimized.
@marko-bekhta Tests seem to fail, see ^ |
yeah 😔
this is coming from the <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-deployment</artifactId>
<optional>true</optional>
</dependency> being an optional dependency... But I'm not sure whether it can be non-optional in The other failure is from the label change... so that's easier to fix 😃 |
Ok, makes sense.
It is non-optional for Micrometer at least: quarkus/extensions/micrometer/deployment/pom.xml Lines 35 to 38 in 351195a
If we're talking about the deployment artifact only, I think the non-optional dependency is fine? It won't be present at runtime, only at build time. TBH I'm not sure why the dependency was optional in the first place.
No I don't think we need an additional artifact here. |
Hey hey @cescoffier We are trying to add some optional management endpoints to the Hibernate Search Extension. Having <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-deployment</artifactId>
<optional>true</optional>
</dependency> as a dependency in build (and
Making the build dependency required while leaving the runtime dependency as optional doesn't work since it leads to:
Yoann suggested to ping you for an idea/example on how we could make these management endpoints optional and only available if the user has |
To clarify, I suspect that we would need to move |
I need to think about it. We can move it to an SPI module, but there is more than this build item. How it's managed (main router, application router, management endpoint) is particularly tricky, and I think it will drag a bit of this logic in the SPI (which is not something great, as it's an internal detail). Don't we have other cases where the routes are optional? In micrometer, we use a lot of optional extensions (so, I would look into a pattern there). |
From what I can see Micrometer depends on "optional" extensions at runtime only (no build items required from those optional extensions). In our case we need to depend on @marko-bekhta did you try a non-optional dependency at build time ( |
Yeah 😔, that's when that maven build failure happens because of the check:
to be clear, that's when I'd put in <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-deployment</artifactId>
</dependency> and <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http</artifactId>
<optional>true</optional>
</dependency> |
Right. I guess that makes sense since Hence the suggestion to introduce an SPI... if that SPI only declares dependencies + build items, and does not trigger any bytecode generation by itself, then it becomes fine to depend on that SPI in |
Hey @cescoffier, any news on that |
Please create an issue, I didn't look at it yet. |
Done: #37144 |
795bba0
to
630af7a
Compare
This comment has been minimized.
This comment has been minimized.
630af7a
to
6e1081c
Compare
This comment has been minimized.
This comment has been minimized.
Yay, it works :) Let's wait for #38143 to be merged first though :) |
- to reindex either all or subset of indexed entities
6e1081c
to
d66baea
Compare
I rebased it on top of Clément's PR, now that it has been merged. |
Thanks! I was about to go fetch a laptop to rebase it 🙈 😃 |
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. You can consult the Develocity build scans. |
Merging, thanks everyone! |
Fixes #34553
Opening this as a draft so we can discuss it. A couple of questions from my side:
I remember implementing similar logic in the webapps quite often, and if these endpoints would be available to an admin in prod mode, it could save people some time 😃