Return-Path: X-Original-To: apmail-hadoop-common-user-archive@www.apache.org Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5CCFC17405 for ; Wed, 8 Oct 2014 05:19:12 +0000 (UTC) Received: (qmail 28721 invoked by uid 500); 8 Oct 2014 05:19:08 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 28591 invoked by uid 500); 8 Oct 2014 05:19:08 -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 28576 invoked by uid 99); 8 Oct 2014 05:19:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Oct 2014 05:19:07 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of vinayakb@gmail.com designates 209.85.192.181 as permitted sender) Received: from [209.85.192.181] (HELO mail-pd0-f181.google.com) (209.85.192.181) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Oct 2014 05:18:40 +0000 Received: by mail-pd0-f181.google.com with SMTP id z10so6174665pdj.26 for ; Tue, 07 Oct 2014 22:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Nr2e0lsPbc2u9GwPcgSkpiSoLTBQx1h6HwkNpi8ROjw=; b=dnRKoCVFF+CCtt07sQXwais5rDc7G/eTtZdr6kRCAxAzhv+H2P2M1oUQgu+L7zSv3o Ybc0//Y6k2IHX09davCH0uEZA5rhabMqthUQ8CkN+VPhBJtVMoA5Z48cPB/U0rjtOf2x JDizhumInpC6HxYSGFGFvnJ8fwjQceF0yZ2uZSOkAPDbQEiepLOUf3a8EPFW1V6LrFBu 6mrJY1+ci7HOv5VbGWcqDhDq6mih2XTPIC8YYYD5vaqZ0qaFytKZG3WaNquFJenZOwD+ QKp23T1T/WnWmnkhblfyCrwl+9kJgM1Ttn/7RyzYuUDA402VzAVgigZ+8oECxmFwUYju iisg== X-Received: by 10.70.65.7 with SMTP id t7mr8310829pds.133.1412745518181; Tue, 07 Oct 2014 22:18:38 -0700 (PDT) Received: from netbook.local (c-76-103-128-174.hsd1.ca.comcast.net. [76.103.128.174]) by mx.google.com with ESMTPSA id fg1sm11236326pdb.91.2014.10.07.22.18.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 22:18:37 -0700 (PDT) Message-ID: <5434C92D.3080201@gmail.com> Date: Tue, 07 Oct 2014 22:18:37 -0700 From: Vinayak Borkar User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: user@hadoop.apache.org Subject: Re: HDFS openforwrite CORRUPT -> HEALTHY References: <5430BEBD.5020101@gmail.com> <543425AE.90307@gmail.com> <54345D14.8010104@ulul.org> In-Reply-To: <54345D14.8010104@ulul.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Ulul, I think I can explain why the sizes differ and the block names vary. There is no client interaction. My client writes data and calls hsync, and then writes more data to the same file. My understanding is that under such circumstances, the file size is not reflected accurately in HDFS until the file is actually closed. So the namenode's view of the file size will be lower than the actual size of the data in the block. If you look at the block closely, you will see that the block number is the same for the two blocks. The part that is different is the version number - this is consistent with HDFS's behavior when hsyncing the output stream and then continuing to write more. It looks like the name node is informed much later about the last block that the datanode actually wrote. My client was not started when the machine came back up. So all changes seen in the FSCK output were owing to HDFS. Vinayak On 10/7/14, 2:37 PM, Ulul wrote: > > Hi Vinayak > > I find strange that the file should have a different size and the block > a different name. > Are you sure your writing client wasn't interfering ? > > Ulul > > Le 07/10/2014 19:41, Vinayak Borkar a �crit : >> Trying again since I did not get a reply. Please let me know if I >> should use a different forum to ask this question. >> >> Thanks, >> Vinayak >> >> >> >> On 10/4/14, 8:45 PM, Vinayak Borkar wrote: >>> Hi, >>> >>> >>> I was experimenting with HDFS to push its boundaries on fault tolerance. >>> Here is what I observed. >>> >>> I am using HDFS from Hadoop 2.2. I started the NameNode and then a >>> single DataNode. I started writing to a DFS file from a Java client >>> periodically calling hsync(). After some time, I powered off the machine >>> that was running this test (not shutdown, just abruptly powered off). >>> >>> When the system came back up, and HDFS processes were up and HDFS was >>> out of safe mode, I ran fsck on the DFS filesystem (with -openforwrite >>> -files -blocks) options and here is the output: >>> >>> >>> /test/test.log 388970 bytes, 1 block(s), OPENFORWRITE: MISSING 1 blocks >>> of total size 388970 B >>> 0. >>> BP-1471648347-10.211.55.100-1412458980748:blk_1073743243_2420{blockUCState=UNDER_CONSTRUCTION, >>> >>> primaryNodeIndex=-1, >>> replicas=[ReplicaUnderConstruction[[DISK]DS-e5bed5ae-1fa9-45ed-8d4c-8006919b4d9c:NORMAL|RWR]]} >>> >>> len=388970 MISSING! >>> >>> Status: CORRUPT >>> Total size: 7214119 B >>> Total dirs: 54 >>> Total files: 232 >>> Total symlinks: 0 >>> Total blocks (validated): 214 (avg. block size 33710 B) >>> ******************************** >>> CORRUPT FILES: 1 >>> MISSING BLOCKS: 1 >>> MISSING SIZE: 388970 B >>> ******************************** >>> Minimally replicated blocks: 213 (99.53271 %) >>> Over-replicated blocks: 0 (0.0 %) >>> Under-replicated blocks: 213 (99.53271 %) >>> Mis-replicated blocks: 0 (0.0 %) >>> Default replication factor: 3 >>> Average block replication: 0.9953271 >>> Corrupt blocks: 0 >>> Missing replicas: 426 (66.35514 %) >>> Number of data-nodes: 1 >>> Number of racks: 1 >>> FSCK ended at Sat Oct 04 23:09:40 EDT 2014 in 47 milliseconds >>> >>> >>> I just let the system sit for some time and reran fsck (after about >>> 15-20 mins) and surprisingly the output was very different. The >>> corruption was magically gone: >>> >>> /test/test.log 1859584 bytes, 1 block(s): Under replicated >>> BP-1471648347-10.211.55.100-1412458980748:blk_1073743243_2421. Target >>> Replicas is 3 but found 1 replica(s). >>> 0. BP-1471648347-10.211.55.100-1412458980748:blk_1073743243_2421 >>> len=1859584 repl=1 >>> >>> Status: HEALTHY >>> Total size: 8684733 B >>> Total dirs: 54 >>> Total files: 232 >>> Total symlinks: 0 >>> Total blocks (validated): 214 (avg. block size 40582 B) >>> Minimally replicated blocks: 214 (100.0 %) >>> Over-replicated blocks: 0 (0.0 %) >>> Under-replicated blocks: 214 (100.0 %) >>> Mis-replicated blocks: 0 (0.0 %) >>> Default replication factor: 3 >>> Average block replication: 1.0 >>> Corrupt blocks: 0 >>> Missing replicas: 428 (66.666664 %) >>> Number of data-nodes: 1 >>> Number of racks: 1 >>> FSCK ended at Sat Oct 04 23:24:23 EDT 2014 in 63 milliseconds >>> >>> >>> The filesystem under path '/' is HEALTHY >>> >>> >>> >>> So my question is this: What just happened? How did the NameNode recover >>> that missing block and why did it take 15 mins or so? Is there some kind >>> of a lease on the file (because of the open nature) that expired after >>> the 15-20 mins? Can someone with knowledge of HDFS internals please shed >>> some light on what could possibly be going on or point me to sections of >>> the code that could answer my questions? Also is there a way to speed >>> this process up? Like say trigger the expiration of the lease (assuming >>> it is a lease). >>> >>> Thanks, >>> Vinayak >> > >