From common-issues-return-157368-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Fri Sep 7 00:59: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 30ACB180668 for ; Fri, 7 Sep 2018 00:59:05 +0200 (CEST) Received: (qmail 76421 invoked by uid 500); 6 Sep 2018 22:59:03 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 76282 invoked by uid 99); 6 Sep 2018 22:59:03 -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, 06 Sep 2018 22:59:03 +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 6E6841A1B2D for ; Thu, 6 Sep 2018 22:59:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-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-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id lP5aSKZMRAvn for ; Thu, 6 Sep 2018 22:59:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 37B5D5F4A9 for ; Thu, 6 Sep 2018 22:59: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 73FF4E02EB for ; Thu, 6 Sep 2018 22:59: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 326312183D for ; Thu, 6 Sep 2018 22:59:00 +0000 (UTC) Date: Thu, 6 Sep 2018 22:59:00 +0000 (UTC) From: "Aaron Fabbri (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HADOOP-15621) s3guard: implement time-based (TTL) expiry for DynamoDB Metadata Store 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/HADOOP-15621?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 606497#comment-16606497 ]=20 Aaron Fabbri commented on HADOOP-15621: --------------------------------------- Thanks for the v1 patch. You've done some nice work here, and I'm glad to s= ee someone new mastering this part of the codebase. Looks pretty good overa= ll. I think we should consider a couple of changes, now you've explored the det= ails of the implementation.=C2=A0 Let me know if you agree / disagree. # Don't do the "online" prune / delete here. We can do that in a later jir= a if we want. We have the prune CLI ("offline") and the fs.s3a.s3guard.cli.= prune.age config today.=C2=A0 I think that is good enough for now, and want= us to be able to performance test this without that extra variable. # =C2=A0It seems simpler to do TTL filtering in the FS instead of each met= adata store. Pros: - All Metadtata Stores behave the same. - Less code duplication (filtering logic implemented once in FS). - S3A would need logic to implement parts of TTL anyways (to deal with getFileStatus() not being authoritative if last updated timestamp in PathMetadata is older than TTL).=C2=A0 This could be done later as a bette= r solution to=C2=A0HADOOP-14468. - Clearer MetadataStore API semantics (MS behavior not dependent on extern= al Configuration API) - Fewer config knobs. fs.s3a.metadatastore.authoritative.ttl: How long an = entry in the MS is considered as authoritative before it will be refreshed. - Easier to test. - Future-proof for metadata caching. A FS can choose cache policy on a per= -file basis, e.g. from coherency hints at open() or create() time. The FS contro= ls it. Cons: - Would need some convenience wrappers around MetadataStore API in S3A. - Would require changes to MetadataStore API (include last_updated field i= n PathMetadata, DirListingMetadata) - Would require changes to LocalMetataStore (though could be quite easy--j= ust store the lastUpdated field on PathMetadata and DirListingMetadata. Loc= al MS can still have its own separate TTL value which is used limit memory = usage.. just keep the two separate). Other thoughts: Cool test cases, thanks.=C2=A0 We should also probably add an integration = test that uses FS and S3guard all together. E.g.: {noformat} set auth mode =3D true configure s3a auth ttl =3D x seconds s3afs.mkdir(test/) s3afs.touch(test/file) s3afs.listStatus(test) // this should write full dir into MS with auth=3Dt= rue assert is_authoritative(s3afs.getMetadataStore().listChildren(test)) // A *fast forward time, via sleep() or s3afs.test_time_offset +=3D 2x* or a fs.= getTime() mock?* assert ! is_authoritative(s3afs.getMetadataStore().listChildren(test)) // = B {noformat} Also maybe even do this next: {noformat} s3afs.listStatus(test) // this should again write full dir into MS with au= th=3Dtrue assert is_authoritative(s3afs.getMetadataStore().listChildren(test)) // C {noformat} =C2=A0 So, we the "refresh MS on TTL expiry" behavior. A cache refresh. We have s= hown that TTL expiry clears the auth bit and makes listStatus() re-load a n= ew, fresh, listing back into the MS with auth=3Dtrue and a new TTL time. Does that make sense? Other thoughts: {noformat} public DDBPathMetadata(FileStatus fileStatus, Tristate isEmptyDir, + this.lastUpdated =3D getInitialLastUpdated(); {noformat} Wondering if we can do this lazily. Or, just init to 0, and make FS set it = (in the putWithTTL() wrapper you'd add, e.g in S3Guard.java)? Getting syste= m time is cheaper than it used to be (vsyscalls), but still nice to avoid u= ntil necessary. {noformat} + void checkIsEmptyDirectory(ItemCollection items) { {noformat} Maybe call this setIsEmptyDirectory instead of check? {noformat} + return Time.monotonicNow(); {noformat} Reminder to make sure we are being consistent throughout S3A.. using the sa= me clock source. Not sure we need monotonic here but we should probably fol= low what the rest of the code uses. S3AFileStatus, for example, uses System= .currentTimeMillis(). {noformat} + if(entry =3D=3D null) { {noformat} spacing nit Overall impressive v1 patch. Thank you for being flexible and working with = my code reviews. > s3guard: implement time-based (TTL) expiry for DynamoDB Metadata Store > ---------------------------------------------------------------------- > > Key: HADOOP-15621 > URL: https://issues.apache.org/jira/browse/HADOOP-15621 > Project: Hadoop Common > Issue Type: Sub-task > Components: fs/s3 > Affects Versions: 3.0.0-beta1 > Reporter: Aaron Fabbri > Assignee: Gabor Bota > Priority: Minor > Attachments: HADOOP-15621.001.patch > > > Similar to HADOOP-13649, I think we should add a TTL (time to live) featu= re to the Dynamo metadata store (MS) for S3Guard. > Think of this as the "online algorithm" version of the CLI prune() functi= on, which is the "offline algorithm". > Why:=20 > 1. Self healing (soft state): since we do not implement transactions arou= nd modification of the two systems (s3 and metadata store), certain failure= s can lead to inconsistency between S3 and the metadata store (MS) state. = Having a time to live (TTL) on each entry in S3Guard means that any inconsi= stencies will be time bound. Thus "wait and restart your job" becomes a va= lid, if ugly, way to get around any issues with FS client failure leaving t= hings in a bad state. > 2. We could make manual invocation of `hadoop s3guard prune ...` unnecess= ary, depending on the implementation. > 3. Makes it possible to fix the problem that dynamo MS prune() doesn't pr= une directories due to the lack of true modification time. > How: > I think we need a new column in the dynamo table "entry last written time= ". This is updated each time the entry is written to dynamo. > After that we can either > 1. Have the client simply ignore / elide any entries that are older than = the configured TTL. > 2. Have the client delete entries older than the TTL. > The issue with #2 is it will increase latency if done inline in the conte= xt of an FS operation. We could mitigate this some by using an async helper= thread, or probabilistically doing it "some times" to amortize the expense= of deleting stale entries (allowing some batching as well). > Caveats: > - Clock synchronization as usual is a concern. Many clusters already keep= clocks close enough via NTP. We should at least document the requirement a= long with the configuration knob that enables the feature. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-issues-help@hadoop.apache.org