Skip to content

Fix shortcomings of QueryBatcher initial implementation #1789

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

Merged
merged 3 commits into from
Jul 11, 2018

Conversation

fredericDelaporte
Copy link
Member

@fredericDelaporte fredericDelaporte commented Jul 10, 2018

  • AutoFlush is handled too late, causing stale data to be yielded
  • Cacheable result transformation is not fully done
  • Auto discovery of types fails
  • InitializeEntitiesAndCollections may be wrongly skipped or called
  • DoExecute should be renamed ExecuteBatched
  • BeginProcess should span the whole processing

Follow up to #1718. See its reviews for more details on the above shortcomings.

 * AutoFlush is handled too late, causing stale data to be yielded
 * Cacheable result transformation is not fully done
 * Auto discovery of types fails
 * InitializeEntitiesAndCollections may be wrongly skipped or called
 * DoExecute should be renamed ExecuteBatched
 * BeginProcess should span the whole processing

 Follow up to nhibernate#1718. See its reviews for more details on the above
 shortcomings.
Additional cleanup/doc originating from nhibernate#1788 but which should be here
@fredericDelaporte
Copy link
Member Author

#1788 already contains all these changes, but they should have their own PR I think.

I will rebase #1788 once this gets merged.

hazzik
hazzik previously approved these changes Jul 10, 2018
foreach (var resultSetHandler in multiSource.GetResultSetHandler())
{
rowCount += resultSetHandler(reader);
reader.NextResult();
Copy link
Member

@bahusoid bahusoid Jul 10, 2018

Choose a reason for hiding this comment

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

I was trying to avoid code duplication in IQueryBatchItem implementations and from this point - reader.NextResult call should be responsibility of IQueryBatch implemention. And I've made suggestion that should allow to keep old interface/behavior intact.
But it seems your refactoring fixed one more issue - no async counterpart was generated for old GetResultSetHandler method.
So this implementation might be a better option as it's suppored by async generator.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, about NextResult, I understand it could be considered the responsibility of the batcher. But at the same time, that is the queries who know how many result sets they have to consume. So there is no clear cut on that subject from my point of view.

bahusoid
bahusoid previously approved these changes Jul 10, 2018
{
var future =
s
.CreateSQLQuery("select count(*) as count from EntitySimpleChild where Name like :pattern")
Copy link
Member

Choose a reason for hiding this comment

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

Firebird does not like as count part.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I should have thought using count as an alias is maybe not a good idea for all databases.

@fredericDelaporte fredericDelaporte merged commit af9021d into nhibernate:master Jul 11, 2018
@fredericDelaporte fredericDelaporte deleted the fixQueryBatch branch July 11, 2018 22:30
@hazzik
Copy link
Member

hazzik commented Jul 11, 2018

From the release management perspective. I'm not sure if we need to display this issue in the release log. Thoughts?

@fredericDelaporte
Copy link
Member Author

fredericDelaporte commented Jul 12, 2018

I agree. (But I am quite sure there is a bunch of similar cases, fixing changes before they were released.)

So flagging as fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants