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 A8422200CBD for ; Thu, 6 Jul 2017 22:59:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A6C851676D4; Thu, 6 Jul 2017 20:59:59 +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 C4A871676CA for ; Thu, 6 Jul 2017 22:59:58 +0200 (CEST) Received: (qmail 4300 invoked by uid 500); 6 Jul 2017 20:59:57 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 4287 invoked by uid 99); 6 Jul 2017 20:59:57 -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; Thu, 06 Jul 2017 20:59:57 +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 C8E851889E0 for ; Thu, 6 Jul 2017 20:59:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id icSCccCJ1WVz for ; Thu, 6 Jul 2017 20:59:54 +0000 (UTC) Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 490A95F659 for ; Thu, 6 Jul 2017 20:59:53 +0000 (UTC) Received: by mail-qt0-f172.google.com with SMTP id i2so12807792qta.3 for ; Thu, 06 Jul 2017 13:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=pvmWd+12iwZe0nUY92tayFJAblq1DwpdEn3pgOWpOr0=; b=uBzxmeLSlUlF/oAv8a49pSNGvtwFCLw5SkPZ1yOf8uUue1jhg9qphxB+PdhK1r80VQ iKkmas+s/0Oj+UYelLAt92Xl3MLR+5malQbAhNamQnnhPbKBDqanS2CTByuAklw96VSa CoHY+xeW/avb14y2tK/yn/8y86tNvMReqV8tm7F5vEGWsVCimt9D7FBL7RyfQqa22l2D 44zMA7E3/BozcYYahRRyiwVqEJ1mzORJEKUrZW8VvqVYWyutHLpreFpG4QM50MzEzcZI 4LyBH04KerK5L3GMpGJzyBFlOtQ4CvAErdKGMewBAuaoR4NYvVF1gtwPrV31mjx42fXn ngRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=pvmWd+12iwZe0nUY92tayFJAblq1DwpdEn3pgOWpOr0=; b=meMrimB5y+Hysf9AbKRqUQm216YbWEbk1ocJPuk6ACUu8eBDwyxPSOQ6OVtNJFrvk2 LZTyytxf7NhB8yNT5zw5mRgrNEISmhl52YZouCylCV4uruf2tiZ6fkIeHiltEczfEil5 eH9OZbZyaZxwQ61O4+ppyQlT6UuHch2o0FmSKo7qg2pj0+XT0GErCnwDzKhRP9uo0Odx 1VyFAduQaVmrsgXyTuMQEzs5RVmEwyQaESYJ0SzR2APfelHCMR/C/yzhLGF1aNiAPXgz J2ycLWfSFOAfQXtiUKWLpo68B7+wVIf/5IHj0Z8PqMP3Vd+7GeDtbTnYqt4gZdgY6ZsQ dcOQ== X-Gm-Message-State: AKS2vOzrnElk6OspE7WYVUQ7ShIWp9M3TBW0Z6XvUYqQ59YkAV+MTICL /+tg/0LCxp4gd4WtB0QdjiqsYLPGZA== X-Received: by 10.200.56.177 with SMTP id f46mr67436339qtc.234.1499374791827; Thu, 06 Jul 2017 13:59:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.63.93 with HTTP; Thu, 6 Jul 2017 13:59:51 -0700 (PDT) In-Reply-To: References: From: Veerraju Tadimeti Date: Thu, 6 Jul 2017 15:59:51 -0500 Message-ID: Subject: Re: scope of RegionCoprocessorEnvironment sharedData To: user@hbase.apache.org Content-Type: multipart/alternative; boundary="001a1140a99ada291c0553ac6501" archived-at: Thu, 06 Jul 2017 20:59:59 -0000 --001a1140a99ada291c0553ac6501 Content-Type: text/plain; charset="UTF-8" I would like to invoke postScannerNext() based on a scan attribute. When two different scans are invoked simultaneously, one with attribute and one without attribute , how can I invoke postScannerNext() based on the scan attribute. Currently i am doing like this - checking the scan attribute in preScannerOpen(), - if exists , set that attribute in sharedData, - check that variable in postScannerNext() - execute logic only if variable exists in sharedData If first scan operation with attribute is requested, we set that in sharedData in preScannerOpen(), meanwhile if second scan operation without attribute is requested, I think , according to your reply, the postScannerNext() will get invoked for both the operations . is this correct? if Yes, what is the alternative. Thanks in Advance. Thanks, Raju, (972)273-0155. On Thu, Jul 6, 2017 at 1:39 PM, Ted Yu wrote: > If the two different scan operations are for the same region, same instance > of coprocessor is involved. > > Otherwise, different instances of coprocessor are involved. > > On Thu, Jul 6, 2017 at 11:22 AM, Veerraju Tadimeti > wrote: > > > for two different scan operations , will same instance of coprocessor > > executes? > > > > Thanks, > > Raju, > > (972)273-0155. > > > > On Thu, Jul 6, 2017 at 11:53 AM, Ted Yu wrote: > > > > > sharedData is created when coprocessor is loaded (per region). > > > > > > So as long as the coprocessor instance doesn't change, the data you put > > in > > > should be there. > > > > > > On Thu, Jul 6, 2017 at 9:20 AM, Veerraju Tadimeti > > > wrote: > > > > > > > Is sharedData per Operation request ? > > > > > > > > I mean for a scan operation, if we put variables in sharedData in > > > > coprocessor, with a value, will the same variables exists(with the > > same > > > > value) in sharedData in coprocessor for new scan operation ? > > > > > > > > Thanks, > > > > Raju, > > > > (972)273-0155. > > > > > > > > On Thu, Jul 6, 2017 at 10:38 AM, Ted Yu wrote: > > > > > > > > > sharedData is in RegionEnvironment which is created > > > > > by RegionCoprocessorHost. > > > > > RegionCoprocessorHost is per region. > > > > > > > > > > When variable is removed in postScannerClose(), it wouldn't affect > > > > > sharedData > > > > > in another region. > > > > > > > > > > FYI > > > > > > > > > > On Thu, Jul 6, 2017 at 7:14 AM, Veerraju Tadimeti < > tvvraju@gmail.com > > > > > > > > wrote: > > > > > > > > > > > hi, > > > > > > > > > > > > I have few questions regarding scope of > > > *RegionCoprocessorEnvironment* > > > > > > sharedData. > > > > > > > > > > > > > > > > > > > > > > > > - *Is sharedData map is shared accross all instances > > > simultaneously > > > > ?* > > > > > > - I am putting a variable in sharedData in > preScannerOpen() > > > > based > > > > > on > > > > > > scan attribute, > > > > > > - check that variable exists in postScannerNext() then > apply > > > > logic, > > > > > > - remove the variable postScannerClose(). > > > > > > - If data is in multiple regions, when one coprocessor > > removes > > > > > > variable in postScannerClose(), will the variable is NULL > for > > > > > another > > > > > > region coprocessor in postScannerNext() ? > > > > > > > > > > > > > > > > > > - * Is sharedData map is shared across all the client > request > > > > > > operations ?* > > > > > > > > > > > > If a variable is set in sharedData for one client operation(say > > > SCAN), > > > > > will > > > > > > the variable is available for another client operation(new SCAN) > ? > > > > > > > > > > > > > > > > > > - *Will the variables be garbage collected even if we dont > > > > implement > > > > > > (removed variables in sharedData) postScannerClose() method* > > > > > > > > > > > > > > > > > > Please find below the logic that I am using currently > > > > > > *CODE: * > > > > > > > > > > > > public RegionScanner > > > > > > *preScannerOpen*(ObserverContext > > > > > > e, Scan scan, RegionScanner s) throws IOException { > > > > > > byte[] useGetInPostScannerNext = > scan.getAttribute(USE_GET_ > > > > > > OPERATION_IN_POST_SCANNER_NEXT); > > > > > > String useGetInPostScannerNextStr = Bytes.toString( > > > > > > useGetInPostScannerNext); > > > > > > if (Boolean.parseBoolean(useGetInPostScannerNextStr)) { > > > > > > e.getEnvironment().getSharedData().put(USE_GET_ > > > > > > OPERATION_IN_POST_SCANNER_NEXT, useGetInPostScannerNextStr); > > > > > > } > > > > > > return super.preScannerOpen(e, scan, s); > > > > > > } > > > > > > > > > > > > @Override > > > > > > public boolean *postScannerNext*(final > > > > > > ObserverContext > > > > > > e, > > > > > > final InternalScanner s, final List results, > > > final > > > > > int > > > > > > limit, > > > > > > final boolean hasMore) throws IOException { > > > > > > try { > > > > > > > > > > > > if (canUseGetOperation(e)) { > > > > > > > > > > > > //logic goes here > > > > > > } > > > > > > } catch (Exception ex) { > > > > > > logger.error("Exception in postScannerNext ", ex); > > > > > > throw new IOException(ex); > > > > > > } > > > > > > return hasMore; > > > > > > } > > > > > > > > > > > > @Override > > > > > > public void > > > > > > *postScannerClose*(ObserverContext > > > > > > e, InternalScanner s) throws IOException { > > > > > > if (canUseGetOperation(e)) { > > > > > > e.getEnvironment().getSharedData().remove(USE_ > > > > > > GET_OPERATION_IN_POST_SCANNER_NEXT); > > > > > > } > > > > > > super.postScannerClose(e, s); > > > > > > } > > > > > > > > > > > > private boolean *canUseGetOperation*(final > > > > > > ObserverContext > > > > > > e) { > > > > > > String useGetOperationInPostScannerNext = (String) > > > > > > e.getEnvironment().getSharedData().get(USE_GET_ > > > > > OPERATION_IN_POST_SCANNER_ > > > > > > NEXT); > > > > > > return Boolean.parseBoolean( > useGetOperationInPostScannerNe > > > xt); > > > > > > } > > > > > > > > > > > > Thanks, > > > > > > Raju, > > > > > > (972)273-0155 <(972)%20273-0155>. > > > > > > > > > > > > > > > > > > > > > --001a1140a99ada291c0553ac6501--