From hdfs-issues-return-238953-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Thu Oct 18 19:45:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3DB3A180679 for ; Thu, 18 Oct 2018 19:45:05 +0200 (CEST) Received: (qmail 40266 invoked by uid 500); 18 Oct 2018 17:45:04 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 40202 invoked by uid 99); 18 Oct 2018 17:45:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2018 17:45:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id DA2ED1A239E for ; Thu, 18 Oct 2018 17:45:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 76xhEgV1JhJc for ; Thu, 18 Oct 2018 17:45:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id B96725FBB9 for ; Thu, 18 Oct 2018 17:45:02 +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 8F4E6E263F for ; Thu, 18 Oct 2018 17:45:01 +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 BA9062528A for ; Thu, 18 Oct 2018 17:45:00 +0000 (UTC) Date: Thu, 18 Oct 2018 17:45:00 +0000 (UTC) From: "BELUGA BEHR (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-13994) DataNode BlockSender waitForMinLength MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HDFS-13994?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] BELUGA BEHR updated HDFS-13994: ------------------------------- Attachment: HDFS-13994.4.patch > DataNode BlockSender waitForMinLength > ------------------------------------- > > Key: HDFS-13994 > URL: https://issues.apache.org/jira/browse/HDFS-13994 > Project: Hadoop HDFS > Issue Type: Improvement > Components: datanode > Affects Versions: 3.2.0 > Reporter: BELUGA BEHR > Assignee: BELUGA BEHR > Priority: Minor > Attachments: HDFS-13994.1.patch, HDFS-13994.2.patch, HDFS-13994.3= .patch, HDFS-13994.4.patch > > > {code:java|title=3DBlockSender.java} > private static void waitForMinLength(ReplicaInPipeline rbw, long len) > throws IOException { > // Wait for 3 seconds for rbw replica to reach the minimum length > for (int i =3D 0; i < 30 && rbw.getBytesOnDisk() < len; i++) { > try { > Thread.sleep(100); > } catch (InterruptedException ie) { > throw new IOException(ie); > } > } > long bytesOnDisk =3D rbw.getBytesOnDisk(); > if (bytesOnDisk < len) { > throw new IOException( > String.format("Need %d bytes, but only %d bytes available", len= , > bytesOnDisk)); > } > } > =C2=A0{code} > It is not very efficient to poll for status in this way. Instead, use {{= notifyAll}} within the {{ReplicaInPipeline}} to notify the caller when the = replica has reached a certain size. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org