Return-Path: X-Original-To: apmail-hadoop-hdfs-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C597111BE8 for ; Fri, 18 Jul 2014 01:48:35 +0000 (UTC) Received: (qmail 97070 invoked by uid 500); 18 Jul 2014 01:48:31 -0000 Delivered-To: apmail-hadoop-hdfs-user-archive@hadoop.apache.org Received: (qmail 96939 invoked by uid 500); 18 Jul 2014 01:48:31 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 96921 invoked by uid 99); 18 Jul 2014 01:48:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2014 01:48:31 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of wuzesheng86@gmail.com designates 209.85.223.176 as permitted sender) Received: from [209.85.223.176] (HELO mail-ie0-f176.google.com) (209.85.223.176) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2014 01:48:25 +0000 Received: by mail-ie0-f176.google.com with SMTP id tr6so4000681ieb.35 for ; Thu, 17 Jul 2014 18:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=bFtNczM4hzc3jo/XiFzDUO/NpxJo0rG519LusCkVaPs=; b=mJ5jYSXvpGXqsJsn48K13YKMCtAJcomT+VeRdxwlzNSvo0E2/E4mlMFviwSDTmcQlK mRNlxOvsFlM4T2e9crCbqac17ma25MEQavAa9F1gBDue7MuOQjw88/6Br6lX6XUVE6UA 3MMUOEcy7ynPLQGoLKCfRIbNWzo891qypXcBKO1Ib02HWu4pQhnF858iE0SFyGUMAqDh GVrRZVWsTNxTZ4BfvX5mP0DNwSC01+QwwwmvvywycZKjJ387chU4+CC7lRTCjAneQjh4 nnVJdUlNW3OMDFtUHHXB/kPXPaJs+xknGhNcys0NOvg7/Nzk3eZs9COG+ALthwMOgfYY a7yA== X-Received: by 10.50.110.103 with SMTP id hz7mr3485491igb.10.1405648085232; Thu, 17 Jul 2014 18:48:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.232.37 with HTTP; Thu, 17 Jul 2014 18:47:45 -0700 (PDT) In-Reply-To: References: From: Zesheng Wu Date: Fri, 18 Jul 2014 09:47:45 +0800 Message-ID: Subject: Re: Replace a block with a new one To: user@hadoop.apache.org Content-Type: multipart/alternative; boundary=089e01183756ccc17f04fe6df240 X-Virus-Checked: Checked by ClamAV on apache.org --089e01183756ccc17f04fe6df240 Content-Type: text/plain; charset=UTF-8 How about write a new block with new checksum file, and replace the old block file and checksum file both? 2014-07-17 19:34 GMT+08:00 Wellington Chevreuil < wellington.chevreuil@gmail.com>: > Hi, > > there's no way to do that, as HDFS does not provide file updates features. > You'll need to write a new file with the changes. > > Notice that even if you manage to find the physical block replica files on > the disk, corresponding to the part of the file you want to change, you > can't simply update it manually, as this would give a different checksum, > making HDFS mark such blocks as corrupt. > > Regards, > Wellington. > > > > On 17 Jul 2014, at 10:50, Zesheng Wu wrote: > > > Hi guys, > > > > I recently encounter a scenario which needs to replace an exist block > with a newly written block > > The most straightforward way to finish may be like this: > > Suppose the original file is A, and we write a new file B which is > composed by the new data blocks, then we merge A and B to C which is the > file we wanted > > The obvious shortcoming of this method is wasting of network bandwidth > > > > I'm wondering whether there is a way to replace the old block by the new > block directly. > > Any thoughts? > > > > -- > > Best Wishes! > > > > Yours, Zesheng > > -- Best Wishes! Yours, Zesheng --089e01183756ccc17f04fe6df240 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
How about write a new block with new checksum file, and re= place the old block file and checksum file both?


2014-07-17 19:34 GMT+08:00 Welling= ton Chevreuil <wellington.chevreuil@gmail.com>:=
Hi,

there's no way to do that, as HDFS does not provide file updates featur= es. You'll need to write a new file with the changes.

Notice that even if you manage to find the physical block replica files on = the disk, corresponding to the part of the file you want to change, you can= 't simply update it manually, as this would give a different checksum, = making HDFS mark such blocks as corrupt.

Regards,
Wellington.



On 17 Jul 2014, at 10:50, Zesheng Wu <wuzesheng86@gmail.com> wrote:

> Hi guys,
>
> I recently encounter a scenario which needs to replace an exist block = with a newly written block
> The most straightforward way to finish may be like this:
> Suppose the original file is A, and we write a new file B which is com= posed by the new data blocks, then we merge A and B to C which is the file = we wanted
> The obvious shortcoming of this method is wasting of network bandwidth=
>
> I'm wondering whether there is a way to replace the old block by t= he new block directly.
> Any thoughts?
>
> --
> Best Wishes!
>
> Yours, Zesheng




--
= Best Wishes!

Yours, Zesheng
--089e01183756ccc17f04fe6df240--