Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 48E48200C0E for ; Wed, 1 Feb 2017 07:56:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 47923160B43; Wed, 1 Feb 2017 06:56:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 67ADC160B44 for ; Wed, 1 Feb 2017 07:55:59 +0100 (CET) Received: (qmail 22025 invoked by uid 500); 1 Feb 2017 06:55:58 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 21977 invoked by uid 99); 1 Feb 2017 06:55:58 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2017 06:55:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 25C1E185DBB for ; Wed, 1 Feb 2017 06:55:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.199 X-Spam-Level: X-Spam-Status: No, score=-1.199 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id oKQZdPa59c8Z for ; Wed, 1 Feb 2017 06:55:56 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id C22B65FDC5 for ; Wed, 1 Feb 2017 06:55:55 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5C0C3E0312 for ; Wed, 1 Feb 2017 06:55:53 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id DF7CE2529E for ; Wed, 1 Feb 2017 06:55:51 +0000 (UTC) Date: Wed, 1 Feb 2017 06:55:51 +0000 (UTC) From: "Tzu-Li (Gordon) Tai (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (FLINK-5122) Elasticsearch Sink loses documents when cluster has high load MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 01 Feb 2017 06:56:00 -0000 [ https://issues.apache.org/jira/browse/FLINK-5122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15848072#comment-15848072 ] Tzu-Li (Gordon) Tai edited comment on FLINK-5122 at 2/1/17 6:55 AM: -------------------------------------------------------------------- I would like to handle this issue together with FLINK-5353 with a different approach: let the user provide a {{FailedActionRequestHandler}} that implements how to deal with an action request that failed, ex. drop it or re-add it to the {{BulkProcessor}}. The reason for this is that there is actually quite a variety of different reasons an action request can fail, and for different cases, can be treated to be "temporary" differently. For example, in FLINK-5353, malformed documents can somewhat be "temporary" if the erroneous field is reprocessed. Instead of handling these case by case, I propose to let user implement logic for them. The handler will look something like this: {code} public interface FailedActionRequestHandler { boolean onFailure(ActionRequest originalRequest, Throwable failure, RequestIndexer indexer); } {code} The ElasticsearchSink will still try to retry a bulk request (with backoff) for obvious temporary errors like {{EsRejectedExecutionException}}, and will only call {{onFailure}} after the retries. There the user can decide whether they want to re-add it to be requested through the {{RequestIndexer}} or just drop it. The method should return {{true}} / {{false}} depending on whether they'd like to fail the sink because of that failure. What do you think? was (Author: tzulitai): I would like to handle this issue together with FLINK-5353 with a different approach: let the user provide a {{FailedActionRequestHandler}} that implements how to deal with an action request that failed, ex. drop it or re-add it to the {{BulkProcessor}}. The reason for this is that there is actually quite a variety of different reasons an action request can fail, and for different cases, can be treated to be "temporary" differently. For example, in FLINK-5353, malformed documents can somewhat be "temporary" if the erroneous field is reprocessed. Instead of handling these case by case, I propose to let user implement logic for them. The handler will look something like this: {code} public interface FailedActionRequestHandler { boolean onFailure(ActionRequest originalRequest, Throwable failure, RequestIndexer indexer); } {/code} The ElasticsearchSink will still try to retry a bulk request (with backoff) for obvious temporary errors like {{EsRejectedExecutionException}}, and will only call {{onFailure}} after the retries. There the user can decide whether they want to re-add it to be requested through the {{RequestIndexer}} or just drop it. The method should return {{true}} / {{false}} depending on whether they'd like to fail the sink because of that failure. What do you think? > Elasticsearch Sink loses documents when cluster has high load > ------------------------------------------------------------- > > Key: FLINK-5122 > URL: https://issues.apache.org/jira/browse/FLINK-5122 > Project: Flink > Issue Type: Bug > Components: Streaming Connectors > Affects Versions: 1.2.0 > Reporter: static-max > Assignee: static-max > > My cluster had high load and documents got not indexed. This violates the "at least once" semantics in the ES connector. > I gave pressure on my cluster to test Flink, causing new indices to be created and balanced. On those errors the bulk should be tried again instead of being discarded. > Primary shard not active because ES decided to rebalance the index: > 2016-11-15 15:35:16,123 ERROR org.apache.flink.streaming.connectors.elasticsearch2.ElasticsearchSink - Failed to index document in Elasticsearch: UnavailableShardsException[[index-name][3] primary shard is not active Timeout: [1m], request: [BulkShardRequest to [index-name] containing [20] requests]] > Bulk queue on node full (I set queue to a low value to reproduce error): > 22:37:57,702 ERROR org.apache.flink.streaming.connectors.elasticsearch2.ElasticsearchSink - Failed to index document in Elasticsearch: RemoteTransportException[[node1][192.168.1.240:9300][indices:data/write/bulk[s][p]]]; nested: EsRejectedExecutionException[rejected execution of org.elasticsearch.transport.TransportService$4@727e677c on EsThreadPoolExecutor[bulk, queue capacity = 1, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@51322d37[Running, pool size = 2, active threads = 2, queued tasks = 1, completed tasks = 2939]]]; > I can try to propose a PR for this. -- This message was sent by Atlassian JIRA (v6.3.15#6346)