Skip to content

Commit

Permalink
Update error message when lucene document limit is breached
Browse files Browse the repository at this point in the history
  • Loading branch information
rayshrey committed Nov 23, 2023
1 parent 8673fa9 commit 8ba742f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ public void testMaxDocsLimit() throws Exception {
IllegalArgumentException.class,
() -> client().prepareDelete("test", "any-id").get()
);
assertThat(deleteError.getMessage(), containsString("Number of documents in the index can't exceed [" + maxDocs.get() + "]"));
assertThat(
deleteError.getMessage(),
containsString("Number of documents in single shard of index can't exceed [" + maxDocs.get() + "]")
);
client().admin().indices().prepareRefresh("test").get();
SearchResponse searchResponse = client().prepareSearch("test")
.setQuery(new MatchAllQueryBuilder())
Expand Down Expand Up @@ -208,7 +211,10 @@ static IndexingResult indexDocs(int numRequests, int numThreads) throws Exceptio
assertThat(resp.status(), equalTo(RestStatus.CREATED));
} catch (IllegalArgumentException e) {
numFailure.incrementAndGet();
assertThat(e.getMessage(), containsString("Number of documents in the index can't exceed [" + maxDocs.get() + "]"));
assertThat(
e.getMessage(),
containsString("Number of documents in single shard of index can't exceed [" + maxDocs.get() + "]")
);
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,9 @@ private Exception tryAcquireInFlightDocs(Operation operation, int addingDocs) {
final long totalDocs = indexWriter.getPendingNumDocs() + inFlightDocCount.addAndGet(addingDocs);
if (totalDocs > maxDocs) {
releaseInFlightDocs(addingDocs);
return new IllegalArgumentException("Number of documents in the index can't exceed [" + maxDocs + "]");
return new IllegalArgumentException(
"Number of documents in single shard of index can't exceed [" + maxDocs + "] - " + shardId.toString()
);
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7801,7 +7801,7 @@ public void testMaxDocsOnPrimary() throws Exception {
assertNotNull(result.getFailure());
assertThat(
result.getFailure().getMessage(),
containsString("Number of documents in the index can't exceed [" + maxDocs + "]")
containsString("Number of documents in single shard of index can't exceed [" + maxDocs + "]")
);
assertThat(result.getSeqNo(), equalTo(UNASSIGNED_SEQ_NO));
assertThat(engine.getLocalCheckpointTracker().getMaxSeqNo(), equalTo(maxSeqNo));
Expand Down

0 comments on commit 8ba742f

Please sign in to comment.