Skip to content

Commit

Permalink
Log reindex bulk request completion (#75935)
Browse files Browse the repository at this point in the history
Today we log at `DEBUG` when we receive a scroll response and send the
bulk request but do not log the completion of the bulk request or the
start of the next scroll request. This makes it impossible to tell from
the logs how long these things are taking.

This commit adds the missing logging.
DaveCTurner committed Aug 2, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f3161a2 commit 6b830ea
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -354,8 +354,9 @@ void prepareBulkRequest(long thisBatchStartTimeNS, ScrollConsumableHitsResponse
* Send a bulk request, handling retries.
*/
void sendBulkRequest(BulkRequest request, Runnable onSuccess) {
final int requestSize = request.requests().size();
if (logger.isDebugEnabled()) {
logger.debug("[{}]: sending [{}] entry, [{}] bulk request", task.getId(), request.requests().size(),
logger.debug("[{}]: sending [{}] entry, [{}] bulk request", task.getId(), requestSize,
new ByteSizeValue(request.estimatedSizeInBytes()));
}
if (task.isCancelled()) {
@@ -366,6 +367,7 @@ void sendBulkRequest(BulkRequest request, Runnable onSuccess) {
bulkRetry.withBackoff(bulkClient::bulk, request, new ActionListener<BulkResponse>() {
@Override
public void onResponse(BulkResponse response) {
logger.debug("[{}]: completed [{}] entry bulk request", task.getId(), requestSize);
onBulkResponse(response, onSuccess);
}

Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ private void startNextScroll(TimeValue extraKeepAlive, RejectAwareActionListener
}

private void onResponse(Response response) {
logger.debug("scroll returned [{}] documents with a scroll id of [{}]", response.getHits().size(), response.getScrollId());
logger.trace("scroll returned [{}] documents with a scroll id of [{}]", response.getHits().size(), response.getScrollId());
setScroll(response.getScrollId());
onResponse.accept(new AsyncResponse() {
private AtomicBoolean alreadyDone = new AtomicBoolean();

0 comments on commit 6b830ea

Please sign in to comment.