Skip to content

Commit

Permalink
Update error message as per review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shreyansh Ray <[email protected]>
  • Loading branch information
rayshrey committed Nov 28, 2023
1 parent 69f1cf9 commit 3b842e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void testMaxDocsLimit() throws Exception {
);
assertThat(
deleteError.getMessage(),
containsString("Number of documents in shard " + shardId + " can't exceed [" + maxDocs.get() + "]")
containsString("Number of documents in shard " + shardId + " exceeds the limit of [" + maxDocs.get() + "] documents per shard")
);
client().admin().indices().prepareRefresh("test").get();
SearchResponse searchResponse = client().prepareSearch("test")
Expand Down Expand Up @@ -216,7 +216,13 @@ static IndexingResult indexDocs(int numRequests, int numThreads) throws Exceptio
numFailure.incrementAndGet();
assertThat(
e.getMessage(),
containsString("Number of documents in shard " + shardId + " can't exceed [" + maxDocs.get() + "]")
containsString(
"Number of documents in shard "
+ shardId
+ " exceeds the limit of ["
+ maxDocs.get()
+ "] documents per shard"
)
);
}
}
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 shard " + shardId + " can't exceed [" + maxDocs + "]");
return new IllegalArgumentException(
"Number of documents in shard " + shardId + " exceeds the limit of [" + maxDocs + "] documents per shard"
);
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7801,7 +7801,9 @@ public void testMaxDocsOnPrimary() throws Exception {
assertNotNull(result.getFailure());
assertThat(
result.getFailure().getMessage(),
containsString("Number of documents in shard " + shardId + " can't exceed [" + maxDocs + "]")
containsString(
"Number of documents in shard " + shardId + " exceeds the limit of [" + maxDocs + "] documents per shard"
)
);
assertThat(result.getSeqNo(), equalTo(UNASSIGNED_SEQ_NO));
assertThat(engine.getLocalCheckpointTracker().getMaxSeqNo(), equalTo(maxSeqNo));
Expand Down

0 comments on commit 3b842e4

Please sign in to comment.