Commit 904dc48e authored by Liz Bennett's avatar Liz Bennett Committed by Konstantine Karantasis
Browse files

Add illegal_argument_exception to errors that are droppable by the ignore mapping error config

parent cb2b4af6
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -376,12 +376,14 @@ public class BulkProcessor<R, B> {
            }
            return bulkRsp;
          }
          if (ignoreMappingErrors && bulkRsp.getErrorInfo().contains("mapper_parsing_exception")) {
            log.info("Encountered mapper_parsing_exception when execute batch {} of {} records."
                    + " Ignoring. {}",
          if (ignoreMappingErrors) {
            if (responseContainsMappingError(bulkRsp)) {
              log.info("Encountered mapper_parsing_exception when executing batch {} of {} records."
                      + " Ignoring. Error was {}",
                  batchId, batch.size(), bulkRsp.getErrorInfo());
              return bulkRsp;
            }
          }
          retriable = bulkRsp.isRetriable();
          throw new ConnectException("Bulk request failed: " + bulkRsp.getErrorInfo());
        } catch (Exception e) {
@@ -402,6 +404,11 @@ public class BulkProcessor<R, B> {
    }
  }

  private boolean responseContainsMappingError(BulkResponse bulkRsp) {
    return bulkRsp.getErrorInfo().contains("mapper_parsing_exception")
        || bulkRsp.getErrorInfo().contains("illegal_argument_exception");
  }

  private synchronized void onBatchCompletion(int batchSize) {
    inFlightRecords -= batchSize;
    assert inFlightRecords >= 0;