aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java36
1 files changed, 5 insertions, 31 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java
index 218da47bd84..a43ba7a4fcd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java
@@ -20,7 +20,6 @@
package org.sonar.server.es;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
@@ -42,7 +41,6 @@ import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
import org.sonar.server.util.ProgressLogger;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@@ -103,8 +101,6 @@ public class BulkIndexer implements Startable {
return this;
}
-
-
@Override
public void start() {
Preconditions.checkState(bulkRequest == null, ALREADY_STARTED_MESSAGE);
@@ -212,35 +208,13 @@ public class BulkIndexer implements Startable {
semaphore.release();
counter.addAndGet(response.getItems().length);
- List<ActionRequest> retries = Lists.newArrayList();
for (BulkItemResponse item : response.getItems()) {
if (item.isFailed()) {
- ActionRequest retry = req.request().requests().get(item.getItemId());
- retries.add(retry);
- }
- }
-
- if (!retries.isEmpty()) {
- LOGGER.warn(String.format("%d index requests failed. Trying again.", retries.size()));
- BulkRequestBuilder retryBulk = client.prepareBulk();
- for (ActionRequest retry : retries) {
- retryBulk.request().add(retry);
- }
- BulkResponse retryBulkResponse = retryBulk.get();
- if (retryBulkResponse.hasFailures()) {
- LOGGER.error("New attempt to index documents failed");
- for (int index = 0; index < retryBulkResponse.getItems().length; index++) {
- BulkItemResponse item = retryBulkResponse.getItems()[index];
- if (item.isFailed()) {
- StringBuilder sb = new StringBuilder();
- String msg = sb.append("\n[").append(index)
- .append("]: index [").append(item.getIndex()).append("], type [").append(item.getType()).append("], id [").append(item.getId())
- .append("], message [").append(item.getFailureMessage()).append("]").toString();
- LOGGER.error(msg);
- }
- }
- } else {
- LOGGER.info("New index attempt succeeded");
+ StringBuilder sb = new StringBuilder();
+ String msg = sb
+ .append("index [").append(item.getIndex()).append("], type [").append(item.getType()).append("], id [").append(item.getId())
+ .append("], message [").append(item.getFailureMessage()).append("]").toString();
+ LOGGER.error(msg);
}
}
}