From hdfs-issues-return-239707-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed Oct 24 12:03:04 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 3FC11180638 for ; Wed, 24 Oct 2018 12:03:04 +0200 (CEST) Received: (qmail 52866 invoked by uid 500); 24 Oct 2018 10:03:03 -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 52854 invoked by uid 99); 24 Oct 2018 10:03:03 -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, 24 Oct 2018 10:03:03 +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 C4920180D74 for ; Wed, 24 Oct 2018 10:03:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, 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 (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id G2SG0I9QruEY for ; Wed, 24 Oct 2018 10:03:01 +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 3A1095F43C for ; Wed, 24 Oct 2018 10:03:01 +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 BE82BE0E5D for ; Wed, 24 Oct 2018 10:03:00 +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 8625E2668F for ; Wed, 24 Oct 2018 10:03:00 +0000 (UTC) Date: Wed, 24 Oct 2018 10:03:00 +0000 (UTC) From: "Sebastien Barnoud (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HDFS-11402) HDFS Snapshots should capture point-in-time copies of OPEN files 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-11402?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1666= 2047#comment-16662047 ]=20 Sebastien Barnoud commented on HDFS-11402: ------------------------------------------ What if=C2=A0dfs.namenode.snapshot.capture.openfiles is false? We still hav= e the previous behavior and lose data with distcp in snapshot diff mode. Is there a way, to exclude open files from the snapshot when=C2=A0dfs.namen= ode.snapshot.capture.openfiles is false? > HDFS Snapshots should capture point-in-time copies of OPEN files > ---------------------------------------------------------------- > > Key: HDFS-11402 > URL: https://issues.apache.org/jira/browse/HDFS-11402 > Project: Hadoop HDFS > Issue Type: Improvement > Components: hdfs > Affects Versions: 2.6.0 > Reporter: Manoj Govindassamy > Assignee: Manoj Govindassamy > Priority: Major > Fix For: 2.9.0, 3.0.0-alpha4 > > Attachments: HDFS-11402-branch-2.01.patch, HDFS-11402.01.patch, H= DFS-11402.02.patch, HDFS-11402.03.patch, HDFS-11402.04.patch, HDFS-11402.05= .patch, HDFS-11402.06.patch, HDFS-11402.07.patch, HDFS-11402.08.patch > > > *Problem:* > 1. When there are files being written and when HDFS Snapshots are taken i= n parallel, Snapshots do capture all these files, but these being written f= iles in Snapshots do not have the point-in-time file length captured. That = is, these open files are not frozen in HDFS Snapshots. These open files gro= w/shrink in length, just like the original file, even after the snapshot ti= me. > 2. At the time of File close or any other meta data modification operatio= n on these files, HDFS reconciles the file length and records the modificat= ion in the last taken Snapshot. All the previously taken Snapshots continue= to have those open Files with no modification recorded. So, all those prev= ious snapshots end up using the final modification record in the last snaps= hot. Thus after the file close, file lengths in all those snapshots will en= d up same. > Assume File1 is opened for write and a total of 1MB written to it. While = the writes are happening, snapshots are taken in parallel. > {noformat} > |---Time---T1-----------T2-------------T3----------------T4------> > |-----------------------Snap1----------Snap2-------------Snap3---> > |---File1.open---write---------write-----------close-------------> > {noformat} > Then at time, > T2: > Snap1.File1.length =3D 0 > T3: > Snap1.File1.length =3D 0 > Snap2.File1.length =3D 0 > > T4: > Snap1.File1.length =3D 1MB > Snap2.File1.length =3D 1MB > Snap3.File1.length =3D 1MB > *Proposal* > 1. At the time of taking Snapshot, {{SnapshotManager#createSnapshot}} can= optionally request {{DirectorySnapshottableFeature#addSnapshot}} to freeze= open files.=20 > 2. {{DirectorySnapshottableFeature#addSnapshot}} can consult with {{Lease= Manager}} and get a list INodesInPath for all open files under the snapshot= dir.=20 > 3. {{DirectorySnapshottableFeature#addSnapshot}} after the Snapshot creat= ion, Diff creation and updating modification time, can invoke {{INodeFile#r= ecordModification}} for each of the open files. This way, the Snapshot just= taken will have a {{FileDiff}} with {{fileSize}} captured for each of the = open files.=20 > 4. Above model follows the current Snapshot and Diff protocols and doesn'= t introduce any any disk formats. So, I don't think we will be needing any = new FSImage Loader/Saver changes for Snapshots. > 5. One of the design goals of HDFS Snapshot was ability to take any numbe= r of snapshots in O(1) time. LeaseManager though has all the open files wit= h leases in-memory map, an iteration is still needed to prune the needed op= en files and then run recordModification on each of them. So, it will not b= e a strict O(1) with the above proposal. But, its going be a marginal incre= ase only as the new order will be of O(open_files_under_snap_dir). In order= to avoid HDFS Snapshots change in behavior for open files and avoid change= in time complexity, this improvement can be made under a new config {{"dfs= .namenode.snapshot.freeze.openfiles"}} which by default can be {{false}}. -- 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