NRT backend flush operation could work in parallel with Readers refresh

Description

The synchronization on org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.setupNewReadersRequirements() is intended to be quick-returning and only needed to provide a consistent read to method refreshReaders(), but doesn't need to block on existing refreshReaders() invocations, especially as these might be needing to flush deletion buffers to disks.

So a refreshReaders() operation can be relatively slow, and this prevents a flush operation to return swiftly.

This contention gets noticeable on high load exercise of parallel readers & writers on this backend.

Environment

None

Status

Assignee

Sanne Grinovero

Reporter

Sanne Grinovero

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Priority

Major