Skip to content
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

Re-create Elasticsearch schema on startup in tests/dev mode with Hibernate Search and Elasticsearch dev services #26186

Merged

Conversation

yrodiere
Copy link
Member

@yrodiere yrodiere commented Jun 16, 2022

Fixes #24923
Supersedes #26175

As explained in #24923, the "validation on startup" feature doesn't make sense here, but dropping and re-creating indexes on startup when using dev services does make sense, especially for tests.

This simplifies configuration:

  • We don't need to specify quarkus.hibernate-orm.database.generation = drop-and-create for tests / dev mode
  • [New in this PR] We don't need to specify quarkus.hibernate-search-orm.schema-management.strategy = drop-and-create-and-drop for tests / dev mode

(Ok it's not that much simpler, but more PRs are coming)

Creating as draft, because this PR is based on #26184 , which must be merged first. => Done

@quarkus-bot

This comment has been minimized.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a couple of small comments/questions. Nothing big.

devServicesAdditionalConfigProducer
.produce(new DevServicesAdditionalConfigBuildItem(propertyKeyIndicatingHostsConfigured,
schemaManagementStrategyPropertyKey, forcedValue,
() -> LOG.infof("Setting %s=%s to initialize Dev Services managed Elasticsearch server",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the INFO here. We usually try to avoid verbosity. I don't have a very strong opinion on it but it might be a bit cumbersome if it's the new normal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's consistent with what we do for databases in the ORM extension.

It appears only in dev mode, and before we even display the banner (somewhere around the stuff about docker containers), so I feel it's fine.

But if you want, I can open a ticket and I'll handle that for Hibernate ORM, Hibernate Search, and any other extension that does something like this (I don't think there is any, but I'll check).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. Let's leave it at that for now.

@yrodiere
Copy link
Member Author

Thanks! I definitely need to get "Dev Services" right, next time... Anyway, I addressed your comments.

@yrodiere yrodiere force-pushed the i24923-recreate-schema-in-tests-and-dev-mode branch from 8a65777 to b0fd4fb Compare June 23, 2022 07:08
Quarkus Documentation automation moved this from To do to Reviewer approved Jun 23, 2022
@gsmet gsmet merged commit 1abfe28 into quarkusio:main Jun 23, 2022
Quarkus Documentation automation moved this from Reviewer approved to Done Jun 23, 2022
@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jun 23, 2022
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Jun 23, 2022
@yrodiere yrodiere deleted the i24923-recreate-schema-in-tests-and-dev-mode branch August 2, 2022 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants