OK so I decided to go get my hands dirty and debug the issue.
private bool TryGetInMemoryJsonDocuments(Guid nextDocEtag, List<JsonDocument> items)
{
if (context.Configuration.DisableDocumentPreFetchingForIndexing)
return false;
JsonDocument result;
bool hasDocs = false;
while (inMemoryDocs.TryPeek(out result) &&
ComparableByteArray.CompareTo(nextDocEtag.ToByteArray(),result.Etag.Value.ToByteArray()) >= 0)
{
// safe to do peek then dequeue because we are the only one doing the dequeues
// and here we are single threaded
inMemoryDocs.TryDequeue(out result);
if (result.Etag.Value != nextDocEtag)
continue;
items.Add(result);
hasDocs = true;
nextDocEtag = Etag.Increment(nextDocEtag, 1);
}
return hasDocs;
}
It will only ever return the document(s) involved in a single transaction.
I set "Raven/DisableDocumentPreFetchingForIndexing" to true and now it is indexing as you'd expect (attached).
Please note that setting the property InMemoryRavenConfiguration.DisableDocumentPreFetchingForIndexing to true had no effect - that value appears to be ignored or overwritten.