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

OGM-767 Add support for @BatchSize in OGM #564

Merged
merged 14 commits into from
Jul 30, 2015

Conversation

emmanuelbernard
Copy link
Member

Only for entities for now. Will come in a different issue and PR for later:

  • collection batching
  • subselect fetching

The "legacy" and default batching strategy is not implemented yet as it requires yet another big pile of code duplication and is almost like the padded one. I'm tempted to not implement it and wait for the batch fetching framework improvements to be moved back to ORM to benefit them.
Also no dialect currently make use of MultigetGridDialect but that is hopefully easier to do that the core enablement of this PR.

95% because of the legacy batching strategy. Hence feedback season is opened.

@gunnarmorling
Copy link
Member

Will you send another PR for actually implementing MultigetDialect e.g. with MongoDB?

else {
for ( EntityKey entityKey : keys ) {
// TODO use the multiload API once introduced
Tuple entry = gridDialect.getTuple( entityKey, persister.getTupleContext() );
Copy link
Member

Choose a reason for hiding this comment

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

Should be doable now, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, removing.

@gunnarmorling
Copy link
Member

@emmanuelbernard: Done with the review. My main concern are the remaining to-dos:

  • Pushing duplicated stuff back to ORM
  • Remaining to-dos in OGM; Could you open OGM JIRA issues for those remaining open after this PR?

What is the "legacy" stuff about? Didn't fully grok that. I'd vote for doing as less as possible on the OGM side and push back the required changes to ORM.

@@ -59,6 +61,14 @@ public Tuple getTuple(EntityKey key, TupleContext tupleContext) {
}

@Override
public List<Tuple> getTuples(EntityKey[] keys, TupleContext tupleContext) {
if ( log.isTraceEnabled() ) {
log.tracef( "Reading tuple with keys %1$s and context %2$s", Arrays.toString( keys ), tupleContext );
Copy link
Member

Choose a reason for hiding this comment

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

"tuples"

@emmanuelbernard
Copy link
Member Author

Will you send another PR for actually implementing MultigetDialect e.g. with MongoDB?

I was planning on other people to give a hand :)

Disabled all but one strategy for the MVP
Introduce ability to customize how the inner loader is built
as OGM and ORM have different loaders.
Introduce notion of BatchableEntityLoader to abstract OgmLoader,
the legacy EntityLoader and plan.EntityLoader.
Methods of this interface is to be moved to UniqueEntityLoader
when moving things back to ORM.
Add support for accepting several ids in OgmLoader (for entities).
Make OgmEntityPersister use the batch fetching framework to build batching loaders.
Adapt OgmLoader creators to instead get their instances from OgmEntityPersister
No dialect is currently making use of it
…getGridDialect

This avoid skewing the ORM fetch statistics
It was only containing a single entry per call to the loader
The compiler might be able to optimize better now that one call happens
…od is used

Make sure getTuples is effectively used when expected basically
MultigetGridDialect don't provide the right params
to build prepared statements ahead of time.
Also no dialect have this specific need.
@emmanuelbernard
Copy link
Member Author

@gunnarmorling I've fixed a lot of the remarks and todos form OGM-767. You can review the major changes starting at 91adb76

@emmanuelbernard emmanuelbernard changed the title OGM-767 [95% done] Add support for @BatchSize in OGM OGM-767 Add support for @BatchSize in OGM Jul 30, 2015
@gunnarmorling gunnarmorling merged commit 99fd1c1 into hibernate:master Jul 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants