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 CF82C200B51 for ; Mon, 1 Aug 2016 08:59:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CE13A160A65; Mon, 1 Aug 2016 06:59:01 +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 F1469160A5D for ; Mon, 1 Aug 2016 08:59:00 +0200 (CEST) Received: (qmail 56955 invoked by uid 500); 1 Aug 2016 06:59:00 -0000 Mailing-List: contact blur-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: blur-user@incubator.apache.org Delivered-To: mailing list blur-user@incubator.apache.org Received: (qmail 56938 invoked by uid 99); 1 Aug 2016 06:58:59 -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; Mon, 01 Aug 2016 06:58:59 +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 65D8F1A12BF for ; Mon, 1 Aug 2016 06:58:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.189 X-Spam-Level: ** X-Spam-Status: No, score=2.189 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id x0kvi0T96b4u for ; Mon, 1 Aug 2016 06:58:57 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id D0AAE5F4E9 for ; Mon, 1 Aug 2016 06:58:56 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id w18so180908926oiw.3 for ; Sun, 31 Jul 2016 23:58:56 -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; bh=6glDqWrelEb4tMtEqmpbkec7Nw3eblXeza9HgdyboDE=; b=sJzGcJiQyFJ2x/lueshG54jvo9/lf8myYnv160mhFNmAIRUa3CNGiGIMfCvUx63+Ro WK+LBKz2LXkQmx63LKkT7HmvcVIJwFez1EmEBT6BmUtKk7y/7EaXkbeZ7tsDZV4jMYGA AkOLagjkgZi1pW81kjKJvfgDdR9m0YGqISTdQAAYxrVSn3Y3M6d7YoJ2BlviQwM8i21G wj8gAil/7FcXxetYjgTTL9ApLfNZXdpSezCEqQMKPF+ZAMlMhX+DjQwkEYrB+l4ukkkt 0Sx3YAAJzmZFI+nVtzXTu4FNKrcffc2E8Ius5Zf9/yIwSUfOSM2VeJySiNna2g1zEj+E aFmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=6glDqWrelEb4tMtEqmpbkec7Nw3eblXeza9HgdyboDE=; b=KPoAqOO9Wsxim8OtMiwk+UQwg9fHhw0AGy2oAnKcBio3ANyDSBIL2TQB+pjcnnkUjk 1LKZFNvS6WuY9EMhfIiOm8JxG14Fn2Q7TyZcvh+0MvUkVPsSXv168dzxRZCdP7cqAD+O RW7Nb2MbFDMe3RGdMNfwrVy5LXNBIdGe4NlAG1Yt4okTr1rsT439oZ9c5h0qwJ85cKTT 06gzWXL4E5IHOsVsYuEDeuRi+3rmPYM7UX83g4/vWfrfx3ZLuDMg3FjGKVweDYr862dV ZrCopgIazsPrHgUgixz8DZsD2Ub1oqBYQ8DuASC8fg80qD2YbWzZmyAtkc2TCYufdSD9 WO/Q== X-Gm-Message-State: AEkoouvfjddKFEt8RmOIw7mHlFnvWUenLDEjX8hIU+Qvc+uePm/r4Lb/lu99My/rTSScOx8cNQCJ8xHVB2Hmvg== X-Received: by 10.157.49.122 with SMTP id v55mr33260160otd.97.1470034724403; Sun, 31 Jul 2016 23:58:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.47.218 with HTTP; Sun, 31 Jul 2016 23:58:43 -0700 (PDT) In-Reply-To: References: From: Ravikumar Govindarajan Date: Mon, 1 Aug 2016 12:28:43 +0530 Message-ID: Subject: Re: SlabAllocationCacheValueBufferPool thread-safe? To: "blur-user@incubator.apache.org" Content-Type: multipart/alternative; boundary=001a114114ce8e44310538fd217b archived-at: Mon, 01 Aug 2016 06:59:02 -0000 --001a114114ce8e44310538fd217b Content-Type: text/plain; charset=UTF-8 We did a simple expiry check. Works fine as of now... private CacheValue lookup(boolean quietly) { CacheValue cacheValue = _indexInputCache.get(_key.getBlockId()); if(cacheValue == null || *cacheValue.isExpired()*) { .... } } On Sun, Jul 31, 2016 at 2:14 AM, Aaron McCurry wrote: > Ok I have to look into it. Do you have a patch available? > > On Thu, Jul 28, 2016 at 4:47 AM, Ravikumar Govindarajan < > ravikumar.govindarajan@gmail.com> wrote: > > > One issue we found in CacheIndexInput.java which is causing NPE > > > > private CacheValue lookup(boolean quietly) { > > > > CacheValue cacheValue = _indexInputCache.get(_key.getBlockId()); > > > > ....... > > > > return cacheValue; > > > > //There is no eviction check for the CacheValue returned from > > IndexInputCache, causing NPE > > > > } > > > > Also, lookup method blindly adds to _indexInputCache before returning. > > Instead, it would be better if it is done inside the null-check loop... > > > > On Fri, Jul 22, 2016 at 6:09 PM, Ravikumar Govindarajan < > > ravikumar.govindarajan@gmail.com> wrote: > > > > > Thanks for the feedback Aaron > > > > > > On Thu, Jul 21, 2016 at 6:42 PM, Aaron McCurry > > wrote: > > > > > >> On Thu, Jul 21, 2016 at 1:55 AM, Ravikumar Govindarajan < > > >> ravikumar.govindarajan@gmail.com> wrote: > > >> > > >> > Just now saw BlockLocks code. It is documented to be thread-safe. > > >> Apologize > > >> > for the trouble... > > >> > > > >> > Btw, a small nit. The below method is not returning true. Is that > > >> > intentional? > > >> > > > >> > boolean releaseIfValid(long address) { > > >> > > > >> > if (address >= _address && address < _maxAddress) { > > >> > > > >> > long offset = address - _address; > > >> > > > >> > int index = (int) (offset / _chunkSize); > > >> > > > >> > _locks.clear(index); > > >> > > > >> > } > > >> > > > >> > return false; > > >> > > > >> > } > > >> > > > >> > > >> In my 30 second review I think you are right. It should probably > return > > >> true. However I want to alanyze what happens with the current code > so I > > >> can write a test that proves there is a problem (because there > probably > > >> is) > > >> and fix it. > > >> > > >> > > >> > > > >> > Also, I thought a background thread can attempt merging sparsely > > >> populated > > >> > slabs into one single slab & release free-mem (in 128MB chunks) back > > to > > >> > OS... > > >> > > > >> > > >> I think this is a good idea, I just didn't get to writing it. > > >> > > >> > > >> > > > >> > You think it could be beneficial or it would make it needlessly > > complex? > > >> > > > >> > > >> I think for dedicated servers is might be overkill, but for a mixed > > >> workload environment (think docker containers and the like) it would > be > > >> useful. > > >> > > >> Aaron > > >> > > >> > > >> > > > >> > On Wed, Jul 20, 2016 at 11:38 PM, Aaron McCurry > > > >> > wrote: > > >> > > > >> > > I don't think there is a race condition because the allocation > > occurs > > >> > > atomically in the BlockLocks class. Do see a problem? Let me > know. > > >> > > > > >> > > Aaron > > >> > > > > >> > > On Wed, Jul 20, 2016 at 9:19 AM, Ravikumar Govindarajan < > > >> > > ravikumar.govindarajan@gmail.com> wrote: > > >> > > > > >> > > > I came across the following in > > >> SlabAllocationCacheValueBufferPool.java. > > >> > > Is > > >> > > > the below method thread-safe? > > >> > > > > > >> > > > @Override > > >> > > > > > >> > > > public CacheValue getCacheValue(int cacheBlockSize) { > > >> > > > > > >> > > > validCacheBlockSize(cacheBlockSize); > > >> > > > > > >> > > > int numberOfChunks = getNumberOfChunks(cacheBlockSize); > > >> > > > > > >> > > > ... > > >> > > > > > >> > > > } > > >> > > > > > >> > > > > > >> > > > It does allocation in a tight-loop using BlockLocks, Slab & > > Chunks. > > >> Is > > >> > > > there a race-condition where 2 threads can pick same slab & > chunk? > > >> > > > > > >> > > > > >> > > > >> > > > > > > > > > --001a114114ce8e44310538fd217b--