private void reserveDocs(long addedNumDocs) {
    assert addedNumDocs >= 0;
    if (pendingNumDocs.addAndGet(addedNumDocs) > actualMaxDocs) {
      // Reserve failed: put the docs back and throw exc:
      pendingNumDocs.addAndGet(-addedNumDocs);
      tooManyDocs(addedNumDocs);
    }
  }