Return-Path: X-Original-To: apmail-trafodion-commits-archive@www.apache.org Delivered-To: apmail-trafodion-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 54295188BA for ; Tue, 2 Feb 2016 16:58:15 +0000 (UTC) Received: (qmail 97600 invoked by uid 500); 2 Feb 2016 16:57:41 -0000 Delivered-To: apmail-trafodion-commits-archive@trafodion.apache.org Received: (qmail 97574 invoked by uid 500); 2 Feb 2016 16:57:41 -0000 Mailing-List: contact commits-help@trafodion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@trafodion.apache.org Delivered-To: mailing list commits@trafodion.apache.org Received: (qmail 97565 invoked by uid 99); 2 Feb 2016 16:57:41 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 16:57:41 +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 3B23918051D for ; Tue, 2 Feb 2016 16:57:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.227 X-Spam-Level: * X-Spam-Status: No, score=1.227 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.553] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id JhdQzXVKotdQ for ; Tue, 2 Feb 2016 16:57:39 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 2886E31AE4 for ; Tue, 2 Feb 2016 16:57:36 +0000 (UTC) Received: (qmail 96266 invoked by uid 99); 2 Feb 2016 16:57:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2016 16:57:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2E059E0C09; Tue, 2 Feb 2016 16:57:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dbirdsall@apache.org To: commits@trafodion.incubator.apache.org Date: Tue, 02 Feb 2016 16:57:39 -0000 Message-Id: <98e34ebaf01f409bbf049b4695471bec@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [05/25] incubator-trafodion git commit: jira1729 jira1729 Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/11f9686b Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/11f9686b Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/11f9686b Branch: refs/heads/master Commit: 11f9686b5df87f70b79edac5621da0610c7e70b8 Parents: fc9651f Author: mashengchen Authored: Mon Jan 11 02:49:44 2016 +0000 Committer: mashengchen Committed: Mon Jan 11 02:49:44 2016 +0000 ---------------------------------------------------------------------- core/sqf/sql/scripts/trafcoprocess.properties | 1 + .../org/trafodion/sql/CoprocessorUtils.java | 55 ++++++++++++++++++++ .../java/org/trafodion/sql/HBaseClient.java | 10 +++- 3 files changed, 64 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/11f9686b/core/sqf/sql/scripts/trafcoprocess.properties ---------------------------------------------------------------------- diff --git a/core/sqf/sql/scripts/trafcoprocess.properties b/core/sqf/sql/scripts/trafcoprocess.properties new file mode 100644 index 0000000..0bc56f5 --- /dev/null +++ b/core/sqf/sql/scripts/trafcoprocess.properties @@ -0,0 +1 @@ +coprocessors=org.apache.hadoop.hbase.coprocessor.transactional.TrxRegionObserver,org.apache.hadoop.hbase.coprocessor.transactional.TrxRegionEndpoint,org.apache.hadoop.hbase.coprocessor.transactional.SsccRegionEndpoint,org.apache.hadoop.hbase.coprocessor.AggregateImplementation http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/11f9686b/core/sql/src/main/java/org/trafodion/sql/CoprocessorUtils.java ---------------------------------------------------------------------- diff --git a/core/sql/src/main/java/org/trafodion/sql/CoprocessorUtils.java b/core/sql/src/main/java/org/trafodion/sql/CoprocessorUtils.java new file mode 100644 index 0000000..e9535c4 --- /dev/null +++ b/core/sql/src/main/java/org/trafodion/sql/CoprocessorUtils.java @@ -0,0 +1,55 @@ +package org.trafodion.sql; + +import java.io.IOException; +import java.net.URL; + +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.log4j.Logger; + +public class CoprocessorUtils { + private static Logger logger = Logger.getLogger(HBaseClient.class.getName()); + private static String[] coprocessors = null; + + static { + init(); + } + + private static void init() { + Configuration config = null; + try { + String path = System.getenv("MY_SQROOT") + "/etc/trafcoprocess.properties"; + config = new PropertiesConfiguration(path); + } catch (Exception e) { + logger.info("error when finding trafcoprocess.properties"); + e.printStackTrace(); + } + + if (config != null) { + coprocessors = config.getStringArray("coprocessors"); + } + } + + public static void addCoprocessor(String currentAllClassName, HTableDescriptor desc) throws IOException { + if (coprocessors == null) { + return; + } + for (String coprocess : coprocessors) { + if (!currentAllClassName.contains(coprocess)) { + desc.addCoprocessor(coprocess); + } + } + } + + public static void main(String[] args) { + System.out.println("================CoprocessorUtils.main======================"); + //init(); + if (coprocessors == null) { + return; + } + for (String coprocess : coprocessors) { + System.out.println(coprocess); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/11f9686b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java ---------------------------------------------------------------------- diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java index 98ac1b1..66de284 100644 --- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java +++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java @@ -235,6 +235,10 @@ public class HBaseClient { if (logger.isDebugEnabled()) logger.debug("HBaseClient.create(" + tblName + ") called, and MVCC is " + isMVCC + "."); cleanupCache(tblName); HTableDescriptor desc = new HTableDescriptor(tblName); + CoprocessorUtils.addCoprocessor(config.get("hbase.coprocessor.region.classes"), desc); + for (String str : desc.getCoprocessors()) { + logger.debug(tblName + "has coprocessor : " + str); + } for (int i = 0; i < colFamNameList.length ; i++) { String colFam = (String)colFamNameList[i]; HColumnDescriptor colDesc = new HColumnDescriptor(colFam); @@ -486,7 +490,10 @@ public class HBaseClient { String trueStr = "TRUE"; cleanupCache(tblName); HTableDescriptor desc = new HTableDescriptor(tblName); - + CoprocessorUtils.addCoprocessor(config.get("hbase.coprocessor.region.classes"), desc); + for (String str : desc.getCoprocessors()) { + logger.debug(tblName + "has coprocessor : " + str); + } int defaultVersionsValue = 0; if (isMVCC) defaultVersionsValue = DtmConst.MVCC_MAX_VERSION; @@ -518,7 +525,6 @@ public class HBaseClient { metaColDesc.setInMemory(true); desc.addFamily(metaColDesc); HBaseAdmin admin = new HBaseAdmin(config); - try { if (beginEndKeys != null && beginEndKeys.length > 0) {