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 1ED43200D56 for ; Tue, 12 Dec 2017 08:11:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1D42F160C0F; Tue, 12 Dec 2017 07:11:06 +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 64289160BE7 for ; Tue, 12 Dec 2017 08:11:05 +0100 (CET) Received: (qmail 92085 invoked by uid 500); 12 Dec 2017 07:11: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 92073 invoked by uid 99); 12 Dec 2017 07:11:04 -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; Tue, 12 Dec 2017 07:11: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 72EC0180162 for ; Tue, 12 Dec 2017 07:11:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, 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 6piC7P15-D43 for ; Tue, 12 Dec 2017 07:11:02 +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 2DA3F5F489 for ; Tue, 12 Dec 2017 07:11: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 11696E0F6E for ; Tue, 12 Dec 2017 07:11: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 2CA6E212FE for ; Tue, 12 Dec 2017 07:11:00 +0000 (UTC) Date: Tue, 12 Dec 2017 07:11:00 +0000 (UTC) From: "Wang XL (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HDFS-12862) CacheDirective may invalidata,when NN restart or make a transition to Active. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 12 Dec 2017 07:11:06 -0000 [ https://issues.apache.org/jira/browse/HDFS-12862?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Wang XL updated HDFS-12862: --------------------------- Labels: patch (was: ) Fix Version/s: 2.7.1 Target Version/s: 2.7.1 Status: Patch Available (was: Open) > CacheDirective may invalidata,when NN restart or make a transition to Act= ive. > -------------------------------------------------------------------------= ---- > > Key: HDFS-12862 > URL: https://issues.apache.org/jira/browse/HDFS-12862 > Project: Hadoop HDFS > Issue Type: Bug > Components: caching, hdfs > Affects Versions: 2.7.1 > Environment:=20 > Reporter: Wang XL > Labels: patch > Fix For: 2.7.1 > > Attachments: HDFS-12862-branch-2.7.1.001.patch > > > The logic in FSNDNCacheOp#modifyCacheDirective is not correct. when modi= fy cacheDirective,the expiration in directive may be a relative expiryTime,= and EditLog will serial a relative expiry time. > {code:java} > // Some comments here > static void modifyCacheDirective( > FSNamesystem fsn, CacheManager cacheManager, CacheDirectiveInfo dir= ective, > EnumSet flags, boolean logRetryCache) throws IOException= { > final FSPermissionChecker pc =3D getFsPermissionChecker(fsn); > cacheManager.modifyDirective(directive, pc, flags); > fsn.getEditLog().logModifyCacheDirectiveInfo(directive, logRetryCache= ); > } > {code} > But when SBN replay the log ,it will invoke FSImageSerialization#readCach= eDirectiveInfo as a absolute expiryTime.It will result in the inconsistenc= y . > {code:java} > public static CacheDirectiveInfo readCacheDirectiveInfo(DataInput in) > throws IOException { > CacheDirectiveInfo.Builder builder =3D > new CacheDirectiveInfo.Builder(); > builder.setId(readLong(in)); > int flags =3D in.readInt(); > if ((flags & 0x1) !=3D 0) { > builder.setPath(new Path(readString(in))); > } > if ((flags & 0x2) !=3D 0) { > builder.setReplication(readShort(in)); > } > if ((flags & 0x4) !=3D 0) { > builder.setPool(readString(in)); > } > if ((flags & 0x8) !=3D 0) { > builder.setExpiration( > CacheDirectiveInfo.Expiration.newAbsolute(readLong(in))); > } > if ((flags & ~0xF) !=3D 0) { > throw new IOException("unknown flags set in " + > "ModifyCacheDirectiveInfoOp: " + flags); > } > return builder.build(); > } > {code} > In other words=EF=BC=8C fsn.getEditLog().logModifyCacheDirectiveInfo(dire= ctive, logRetryCache) may serial a relative expiry time,But builder.setEx= piration(CacheDirectiveInfo.Expiration.newAbsolute(readLong(in))) read it= as a absolute expiryTime. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org