Skip to content

Futures not batching correctly in NH 5.2.x #2173

Closed
@mattzink

Description

@mattzink

While attempting to upgrade from NH 5.1.3 to 5.2.5, we have a performance test that started failing relating to batching of .Future() queries. The following test passed as expected in NH 5.1.3, but is now failing in NH 5.2.5 with a statement count of 11(!). I've verified the NH statement statistic count is correct from observing commands issued in the Npgsql driver log.

long preRequestPrepareStatementCount = _sessionFactory.Statistics.PrepareStatementCount;

session.QueryOver<VolumeAttachment>()
    .Where(va => va.Id.IsIn(volumeAttachmentIds))
    .Left.JoinQueryOver(va => va.StatusConditions)
    .Future();

session.QueryOver<VolumeAttachment>()
    .Where(va => va.Id.IsIn(volumeAttachmentIds))
    .Left.JoinQueryOver<VolumeAttachmentPath>(va => va.VolumeAttachmentPaths)
    .Left.JoinQueryOver(vap => vap.StatusConditions)
    .Future();

session.QueryOver<VolumeAttachment>()
    .Where(va => va.Id.IsIn(volumeAttachmentIds))
    .Left.JoinQueryOver<VolumeAttachmentPath>(va => va.VolumeAttachmentPaths)
    .Left.JoinQueryOver(vap => vap.Path)
    .Left.JoinQueryOver(p => p.StatusConditions)
    .Future();

session.QueryOver<VolumeAttachment>()
    .Where(va => va.Id.IsIn(volumeAttachmentIds))
    .Left.JoinQueryOver<VolumeAttachmentPath>(va => va.VolumeAttachmentPaths)
    .Left.JoinQueryOver(vap => vap.Path)
    .Left.JoinQueryOver(p => p.TargetPorts)
    .Future()
    .GetEnumerable();

long prepareStatementDelta = _sessionFactory.Statistics.PrepareStatementCount - preRequestPrepareStatementCount;

Assert.Equals(1, prepareStatementDelta);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions