-
Notifications
You must be signed in to change notification settings - Fork 3k
Hibernate ORM extension config overhaul #1121
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
Conversation
The maximum size of the query plan cache. | ||
|
||
`quarkus.hibernate-orm.query.batch-fetch-size`:: (defaults to `-1` i.e. batch fetching is disabled). | ||
The size of the batches used when loading entities and collections. |
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.
This one I'm not totally sure about. It's not exactly about queries but about the loaders but having a loader category would be very specific.
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'm not sure. Either query
, tuning
or loaders
works for me.
tuning
could be a choice but that's assuming we'll eventually have more such options? Also possibly too generic.
loaders
is the most appropriate, but I doubt we'll have more, so hard justifies having a "category".
Maybe shouldn't be a category, this is getting too deep already? Just quarkus.hibernate-orm.batch-fetch-size
?
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.
Yeah, it's not clear that people have to understand the distinction between query and jdbc batch size settings, or is it important?
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.
They are totally different things and used to tune totally different things.
I can see how it is not easy to see the distinction but that's why there is a jdbc
category. Because it's really about fine-tuning the behavior of the JDBC driver.
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.
-1 for jdbc
, it's not like we're reconfiguring the jdbc driver, we're just loading things in efficient blocks.. so that would be confusing.
Let's go with quarkus.hibernate-orm.batch-fetch-size
? N.B. it's not used only for queries, it's a more global, general tuning.
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 was not suggesting using jdbc
for batch-fetch-size
. I was talking about the JDBC fetch/batch settings Stéphane referred to. They are entirely different things.
batch-fetch-size
is only used for loading entities/collections.
I can get it out of a category though.
Default precedence of null values in `ORDER BY` clauses. | ||
Options are `none`, `first`, `last`. | ||
|
||
`quarkus.hibernate-orm.transaction.isolation-level`:: |
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.
So let's remove this one as it needs to be handled by Agroal.
P.S. The good thing about removing this one is that it didn't fully belong under "Query" section either
The default catalog to use for the database objects. | ||
|
||
`quarkus.hibernate-orm.schema.default-schema`:: | ||
The default schema to use for the database objects. |
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.
Would quarkus.hibernate-orm.schema
and quarkus.hibernate-orm.catalog
make sense for the defaults to use?
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.
+1 yeah that sounds quite better actually
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 don't think it's a good idea. Especially for schema as we have schema.generation
. And they are different things.
Having the default
prefix helps to understand what it does IMHO.
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.
well it's not like one can switch schema at runtime.. so what is the "default" for?
AFAIK the only case is one can override the schema for a specific entity; I did that a couple of times but TBH I don't remember if that was a hack..
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.
schema.default-schema
looks like something went wrong, though, which is why I brought this up.
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.
Well, unfortunately, the same name is used for the database schema and the notion of schema in a database.
I renamed .schema.
to .database.
to make things hopefully clearer and a few other adjustments to get something hopefully better.
|
||
==== JDBC | ||
|
||
`quarkus.hibernate-orm.jdbc.timezone`:: |
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.
Do we have more than one timezone setting? Does it matter that it is used via JDBC?
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.
Not at the moment. I must admit I wondered if we should just have quarkus.hibernate-orm.timezone
.
I just thought being cautious wouldn't hurt here as what it does is pretty clear.
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.
let's keep the jdbc prefix as it clarifies the scope.
Not sure if it shouldn't just be jdbc-timezone
? I wonder if we're not abusing the period: should be reserved for sub-categories?
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.
Well. It may clarify the scope for people who understand what that scope means. If you think it's important that users understand that it's jdbc
then fine. If this timezone thing would be relevant to users no matter if they need to know if it's jdbc or not, then it's wrong.
I personally don't know enough about its function to judge, so it's a honest question.
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.
It's the timezone used by the JDBC driver, which might be different of the timezone of the JVM.
So it's important to know it's the one from the JDBC driver.
`quarkus.hibernate-orm.log.sql`:: (defaults to `false`). | ||
Show SQL logs and format them nicely. | ||
|
||
`quarkus.hibernate-orm.log.jdbc-warnings`:: (defaults to `false`). |
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.
Do we expect more kinds of warnings? If not how about log.warnings
?
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.
They are really specific to JDBC and the capability of the driver to get them.
So having warnings
wouldn't make sense.
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.
So it really is important to single out jdbc warnings from non-jdbc warnings?
Again, I've no clue, so it's a honest user question. I sort of assumed that hibernate had warnings, and that jdbc warnings would be a category within them.
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.
they are different. Essentially this allows the Database to issue warnings which we relay to the application log.. sometimes that's very useful as the DB can give you some very good clues, but if you're not opting in specifically, the fact that we do this is really weird.
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.
So you collect jdbc/db warnings and log them in the ORM logger somewhere. From a clueless user perspective, it sounds like something I would force to true (and set log level to debug) and let users decide if they want to see them by bumping up those log's category.
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.
Apparently, this things is there because you could have weird issues depending on your driver/database and you need some knob to be able to disable it/enable it if needed.
Ideally, it's something that should be managed automatically but that's not the case right now.
Apparently, it was judged sufficiently important by the Hibernate ORM team to get to the Hibernate ORM - Quarkus config document so let's not have this discussion again.
|
||
==== Statistics | ||
|
||
`quarkus.hibernate-orm.statistics.enabled`:: (defaults to `false`) |
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 assume these statistics are not going via the logs then?
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.
It's the collection of statistics that is enabled.
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.
OK, so they're collected in some API. Would quarkus.hibernate-orm.statistics (defaults to 'disabled/false')
not be enough?
Do we have a convention on config keys that end with .enabled
? Sounds like we should really make feature toggles consistent across every extension and document those consistency rules somewhere.
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.
good points.
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 used that because I suspect we might want to have some more fine-grained statistics tuning in the future. I suppose we could shoe it in later.
It has to be done in Agroal config as it is the pool managing that.
@Sanne @FroMage I tried to address most of your comments in follow-up commits with specific commit messages so that you can quickly see what has been done. I think it's better now. About categories, the idea is to structure the configuration a bit as I'm pretty sure we will add more in the future. Hopefully, it will help with consistency and clarity in the long run. |
Looks great 💯 Let's merge this, perfection can be achieved later |
P.S. we'll need to update the properties used in demos and quickstarts. I might do that later today, but first need to finish the cache release. |
Created #1158 |
* fix: Make sure jbang bash script can update on Windows Now that we no longer delegate to the jbang .cmd file when running inside a Bash shell on Windows the bash script needs to be able to perform the Windows update procedure. * fix: `jbang edit` using wrong paths on Windows Another regression now that we no longer delegate to CMD when using a bash environment on Windows.
@Sanne here what I came up with.
I tried to organize properties a bit. The doc update might be a good starting point to have a general overview.
Still on my TODO list:
I'll try to get the first two in before the release.