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 243AF200D34 for ; Fri, 29 Sep 2017 03:45:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 22BE61609EE; Fri, 29 Sep 2017 01:45:08 +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 5C1E81609ED for ; Fri, 29 Sep 2017 03:45:07 +0200 (CEST) Received: (qmail 79880 invoked by uid 500); 29 Sep 2017 01:45:06 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 79841 invoked by uid 99); 29 Sep 2017 01:45:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Sep 2017 01:45:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id A410BD3BE5 for ; Fri, 29 Sep 2017 01:45:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id CiQo0D6OTumK for ; Fri, 29 Sep 2017 01:45:04 +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 95E6C6127C for ; Fri, 29 Sep 2017 01:45:03 +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 2990CE0E36 for ; Fri, 29 Sep 2017 01:45:03 +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 77F70242CB for ; Fri, 29 Sep 2017 01:45:01 +0000 (UTC) Date: Fri, 29 Sep 2017 01:45:01 +0000 (UTC) From: "Appy (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (HBASE-18898) Provide way for the core flow to know whether CP implemented each of the hooks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 29 Sep 2017 01:45:08 -0000 [ https://issues.apache.org/jira/browse/HBASE-18898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16185234#comment-16185234 ] Appy edited comment on HBASE-18898 at 9/29/17 1:44 AM: ------------------------------------------------------- The only way i can think of to do this is: Say we want to do this for MasterObserver - In MasterCPHost, do reflection over MasterObserver, get all its methods and make a map. - As CPs are loaded, check all the methods in their observer - If and only if ** The method signature matches one from MasterObserver ** The method is non-default Mark that we have a CP overriding that method - In the hook wrappers we have in MasterCPHost, (and this is the ugly part) do a reflection to check if any CP is using that hook. was (Author: appy): The only way i can think of to do this is: Say we want to do this for MasterObserver - In MasterCPHost, do reflection over MasterObserver, get all its methods and make a map. - As CPs are loaded, check all the methods in their observer - If and only if - The method signature matches one from MasterObserver - The method is non-default Mark that we have a CP overriding that method - In the hook wrappers we have in MasterCPHost, (and this is the ugly part) do a reflection to check if any CP is using that hook. > Provide way for the core flow to know whether CP implemented each of the hooks > ------------------------------------------------------------------------------ > > Key: HBASE-18898 > URL: https://issues.apache.org/jira/browse/HBASE-18898 > Project: HBase > Issue Type: Improvement > Components: Coprocessors, Performance > Reporter: Anoop Sam John > Assignee: Anoop Sam John > Priority: Critical > > This came as a discussion topic at the tale of HBASE-17732 > Can we have a way in the code (before trying to call the hook) to know whether the user has implemented one particular hook or not? eg: On write related hooks only prePut() might be what the user CP implemented. All others are just dummy impl from the interface. Can we have a way for the core code to know this and avoid the call to other dummy hooks fully? Some times we do some processing for just calling CP hooks (Say we have to make a POJO out of PB object for calling) and if the user CP not impl this hook, we can avoid this extra work fully. The pain of this will be more when we have to later deprecate one hook and add new. So the dummy impl in new hook has to call the old one and that might be doing some extra work normally. > If the CP f/w itself is having a way to tell this, the core code can make use. What am expecting is some thing like in PB way where we can call > CPObject.hasPreXXXX(), then CPObject. preXXXX ().. Should not like asking users to impl this extra ugly thing. When the CP instance is loaded in the RS/HM, that object will be having this info also. -- This message was sent by Atlassian JIRA (v6.4.14#64029)