You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2016/10/27 02:31:00 UTC
[6/9] incubator-trafodion git commit: [TRAFODION-2306] Trafodion
customization using its own configuration file
[TRAFODION-2306] Trafodion customization using its own configuration file
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/78a5f20a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/78a5f20a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/78a5f20a
Branch: refs/heads/master
Commit: 78a5f20a15aed2702bf1df3f94e6d25fb718de37
Parents: 33a2acf
Author: selvaganesang <se...@esgyn.com>
Authored: Tue Oct 25 01:06:50 2016 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Tue Oct 25 01:06:50 2016 +0000
----------------------------------------------------------------------
core/sqf/sql/scripts/sqgen | 8 ++---
core/sqf/sql/scripts/traf-site.xml | 38 --------------------
core/sqf/sql/scripts/trafodion-site.xml | 38 ++++++++++++++++++++
.../java/org/trafodion/sql/HBaseClient.java | 8 ++---
.../org/trafodion/sql/TrafConfiguration.java | 19 +++++++---
5 files changed, 61 insertions(+), 50 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/78a5f20a/core/sqf/sql/scripts/sqgen
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/sqgen b/core/sqf/sql/scripts/sqgen
index 52d0c01..a761f08 100755
--- a/core/sqf/sql/scripts/sqgen
+++ b/core/sqf/sql/scripts/sqgen
@@ -187,14 +187,14 @@ fi
./gensqstatem2lenv > $SQETC_DIR/sqstatem2l.env
-if [ -f $SQETC_DIR/traf-site.xml ]; then
- echo "Trafodion customization file $SQETC_DIR/traf-site.xml exists."
+if [ -f $SQETC_DIR/trafodion-site.xml ]; then
+ echo "Trafodion customization file $SQETC_DIR/trafodion-site.xml exists."
echo "The file will not be copied."
echo
else
- echo "Copying Trafodion customization file: $SQETC_DIR/traf-site.xml"
+ echo "Copying Trafodion customization file: $SQETC_DIR/trafodion-site.xml"
echo
- cp ./traf-site.xml $SQETC_DIR
+ cp ./trafodion-site.xml $SQETC_DIR
lv_retcode=$?
if [[ $lv_retcode != 0 ]]; then
echo "Error $lv_retcode while copying Exiting..."
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/78a5f20a/core/sqf/sql/scripts/traf-site.xml
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/traf-site.xml b/core/sqf/sql/scripts/traf-site.xml
deleted file mode 100644
index fc04716..0000000
--- a/core/sqf/sql/scripts/traf-site.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
- <!--
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<!-- Put Trafodion site-specific property overrides in this file. -->
-
-<configuration>
- <property>
- <name>hbase.coprocessor.region.classes</name>
- <value>
- org.apache.hadoop.hbase.coprocessor.transactional.TrxRegionObserver,
- org.apache.hadoop.hbase.coprocessor.transactional.TrxRegionEndpoint,
- org.apache.hadoop.hbase.coprocessor.AggregateImplementation
- </value>
- </property>
- <property>
- <name>hbase.client.scanner.timeout.period</name>
- <value>3600000</value>
- </property>
-</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/78a5f20a/core/sqf/sql/scripts/trafodion-site.xml
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/trafodion-site.xml b/core/sqf/sql/scripts/trafodion-site.xml
new file mode 100644
index 0000000..fc04716
--- /dev/null
+++ b/core/sqf/sql/scripts/trafodion-site.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+ <!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<!-- Put Trafodion site-specific property overrides in this file. -->
+
+<configuration>
+ <property>
+ <name>hbase.coprocessor.region.classes</name>
+ <value>
+ org.apache.hadoop.hbase.coprocessor.transactional.TrxRegionObserver,
+ org.apache.hadoop.hbase.coprocessor.transactional.TrxRegionEndpoint,
+ org.apache.hadoop.hbase.coprocessor.AggregateImplementation
+ </value>
+ </property>
+ <property>
+ <name>hbase.client.scanner.timeout.period</name>
+ <value>3600000</value>
+ </property>
+</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/78a5f20a/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 4d34c8c..c007f74 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
@@ -177,11 +177,11 @@ public class HBaseClient {
}
private void addCoprocessor(HTableDescriptor desc) throws IOException {
- String coprocessorClasses = config.get("hbase.coprocessor.region.classes");
- if (coprocessorClasses != null) {
- String[] coprocessors = coprocessorClasses.split(",");
- for (int i = 0; i < coprocessors.length ; i++)
+ String[] coprocessors = config.getStrings("hbase.coprocessor.region.classes");
+ if (coprocessors != null) {
+ for (int i = 0; i < coprocessors.length ; i++) {
desc.addCoprocessor(coprocessors[i].trim());
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/78a5f20a/core/sql/src/main/java/org/trafodion/sql/TrafConfiguration.java
----------------------------------------------------------------------
diff --git a/core/sql/src/main/java/org/trafodion/sql/TrafConfiguration.java b/core/sql/src/main/java/org/trafodion/sql/TrafConfiguration.java
index 4f3e842..0d7e44a 100644
--- a/core/sql/src/main/java/org/trafodion/sql/TrafConfiguration.java
+++ b/core/sql/src/main/java/org/trafodion/sql/TrafConfiguration.java
@@ -21,7 +21,8 @@ import org.apache.log4j.Logger;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.fs.Path;
-
+import java.util.Iterator;
+import java.util.Map;
/**
* Adds Trafodion configuration files to a Configuration
@@ -31,9 +32,19 @@ public class TrafConfiguration extends HBaseConfiguration {
static Logger logger = Logger.getLogger(TrafConfiguration.class.getName());
public static Configuration addTrafResources(Configuration conf) {
- String trafSiteXml = new String(System.getenv("MY_SQROOT") + "/etc/traf-site.xml");
+ Configuration lv_conf = new Configuration();
+ String trafSiteXml = new String(System.getenv("MY_SQROOT") + "/etc/trafodion-site.xml");
Path fileRes = new Path(trafSiteXml);
- conf.addResource(fileRes);
+ lv_conf.addResource(fileRes);
+ Iterator<Map.Entry<String,String>> iter = lv_conf.iterator();
+ String key;
+ while (iter.hasNext()) {
+ Map.Entry<String,String> entry = iter.next();
+ key = entry.getKey();
+ if (key.startsWith("trafodion."))
+ key = key.substring(10); // 10 - length of trafodion.
+ conf.set(key, entry.getValue());
+ }
return conf;
}
@@ -48,7 +59,7 @@ public class TrafConfiguration extends HBaseConfiguration {
/**
* @param that Configuration to clone.
- * @return a Configuration created with the traf-site.xml files plus
+ * @return a Configuration created with the trafodion-site.xml files plus
* the given configuration.
*/
public static Configuration create(final Configuration that) {