Repository: lens Updated Branches: refs/heads/master e264e53f3 -> 55b5223e9
LENS-848: Allow JDBC driver to take connection properties in configuration Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/55b5223e Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/55b5223e Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/55b5223e Branch: refs/heads/master Commit: 55b5223e9bfbb4904b46b2843f4410293cb4019b Parents: e264e53 Author: Rajat Khandelwal <[email protected]> Authored: Wed Oct 28 14:10:52 2015 +0530 Committer: Rajat Khandelwal <[email protected]> Committed: Wed Oct 28 14:10:52 2015 +0530 ---------------------------------------------------------------------- .../org/apache/lens/api/util/CommonUtils.java | 58 +++++++ .../apache/lens/api/util/CommonUtilsTest.java | 54 +++++++ .../lens/driver/jdbc/ColumnarSQLRewriter.java | 12 +- .../jdbc/DataSourceConnectionProvider.java | 88 +++++----- .../org/apache/lens/driver/jdbc/JDBCDriver.java | 65 ++++---- .../driver/jdbc/JDBCDriverConfConstants.java | 56 ++++--- .../src/main/resources/jdbcdriver-default.xml | 13 ++ .../jdbc/TestDataSourceConnectionProvider.java | 7 +- .../apache/lens/driver/jdbc/TestJdbcDriver.java | 33 ++-- .../src/test/resources/jdbcdriver-site.xml | 25 +-- src/site/apt/admin/config.apt | 160 +++++++++---------- src/site/apt/admin/jdbcdriver-config.apt | 54 ++++--- 12 files changed, 389 insertions(+), 236 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-api/src/main/java/org/apache/lens/api/util/CommonUtils.java ---------------------------------------------------------------------- diff --git a/lens-api/src/main/java/org/apache/lens/api/util/CommonUtils.java b/lens-api/src/main/java/org/apache/lens/api/util/CommonUtils.java new file mode 100644 index 0000000..38d58c7 --- /dev/null +++ b/lens-api/src/main/java/org/apache/lens/api/util/CommonUtils.java @@ -0,0 +1,58 @@ +/** + * 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. + */ +package org.apache.lens.api.util; + + +import java.util.HashMap; +import java.util.Map; + +public class CommonUtils { + private CommonUtils() { + + } + + /** + * Splits given String str around non-escaped commas. Then parses each of the split element + * as map entries in the format `key=value`. Constructs a map of such entries. + * e.g. "a=b, c=d" parses to map{a:b, c:d} where the symbols are self-explanatory. + * + * @param str The string to parse + * @return parsed map + */ + public static Map<String, String> parseMapFromString(String str) { + Map<String, String> map = new HashMap<>(); + if (str != null) { + for (String kv : str.split("(?<!\\\\),")) { + if (!kv.isEmpty()) { + String[] kvArray = kv.split("="); + String key = ""; + String value = ""; + if (kvArray.length > 0) { + key = kvArray[0].replaceAll("\\\\,", ",").trim(); + } + if (kvArray.length > 1) { + value = kvArray[1].replaceAll("\\\\,", ",").trim(); + } + map.put(key, value); + } + } + } + return map; + } +} http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-api/src/test/java/org/apache/lens/api/util/CommonUtilsTest.java ---------------------------------------------------------------------- diff --git a/lens-api/src/test/java/org/apache/lens/api/util/CommonUtilsTest.java b/lens-api/src/test/java/org/apache/lens/api/util/CommonUtilsTest.java new file mode 100644 index 0000000..2c4b389 --- /dev/null +++ b/lens-api/src/test/java/org/apache/lens/api/util/CommonUtilsTest.java @@ -0,0 +1,54 @@ +/** + * 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. + */ +package org.apache.lens.api.util; + +import static org.apache.lens.api.util.CommonUtils.parseMapFromString; + +import static org.testng.Assert.assertEquals; + +import java.util.HashMap; +import java.util.Map; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +public class CommonUtilsTest { + @DataProvider(name = "parse-data-provider") + public Object[][] provideParseTestData() { + return new Object[][]{ + {"", getMap()}, + {"a=b\n,\n\nc=d", getMap("a", "b", "c", "d")}, + {"a=b\\,b, c=d", getMap("a", "b,b", "c", "d")}, + }; + } + + private Object getMap(String... strings) { + assertEquals(strings.length % 2, 0); + Map<String, String> map = new HashMap<>(); + for (int i = 0; i < strings.length; i += 2) { + map.put(strings[i], strings[i + 1]); + } + return map; + } + + @Test(dataProvider = "parse-data-provider") + public void testParseMapFromString(String str, Map<String, String> expected) throws Exception { + assertEquals(parseMapFromString(str), expected); + } +} http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java index 825a039..5614527 100644 --- a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java +++ b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/ColumnarSQLRewriter.java @@ -22,6 +22,7 @@ import static org.apache.hadoop.hive.ql.parse.HiveParser.*; import java.util.*; +import org.apache.lens.api.util.CommonUtils; import org.apache.lens.cube.metadata.CubeMetastoreClient; import org.apache.lens.cube.parse.CubeSemanticAnalyzer; import org.apache.lens.cube.parse.HQLParser; @@ -176,7 +177,7 @@ public class ColumnarSQLRewriter implements QueryRewriter { /** The from ast. */ @Getter protected ASTNode fromAST; - private HashMap<String, String> regexReplaceMap = new HashMap<>(); + private Map<String, String> regexReplaceMap; /** * Instantiates a new columnar sql rewriter. @@ -186,14 +187,7 @@ public class ColumnarSQLRewriter implements QueryRewriter { @Override public void init(Configuration conf) { - if (conf.get(JDBCDriverConfConstants.REGEX_REPLACEMENT_VALUES) != null) { - for (String kv : conf.get(JDBCDriverConfConstants.REGEX_REPLACEMENT_VALUES).split("(?<!\\\\),")) { - String[] kvArray = kv.split("="); - String key = kvArray[0].replaceAll("\\\\,", ",").trim(); - String value = kvArray[1].replaceAll("\\\\,", ",").trim(); - regexReplaceMap.put(key, value); - } - } + regexReplaceMap = CommonUtils.parseMapFromString(conf.get(JDBCDriverConfConstants.REGEX_REPLACEMENT_VALUES)); } public String getClause() { http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DataSourceConnectionProvider.java ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DataSourceConnectionProvider.java b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DataSourceConnectionProvider.java index b14835a..d13c0bc 100644 --- a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DataSourceConnectionProvider.java +++ b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/DataSourceConnectionProvider.java @@ -18,19 +18,24 @@ */ package org.apache.lens.driver.jdbc; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.*; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.ConnectionPoolProperties.*; + import java.beans.PropertyVetoException; import java.io.IOException; import java.sql.Connection; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; +import java.util.Properties; + +import org.apache.lens.api.util.CommonUtils; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.hadoop.conf.Configuration; import com.mchange.v2.c3p0.ComboPooledDataSource; - import lombok.extern.slf4j.Slf4j; /** @@ -46,7 +51,7 @@ public class DataSourceConnectionProvider implements ConnectionProvider { * Instantiates a new data source connection provider. */ public DataSourceConnectionProvider() { - dataSourceMap = new HashMap<DriverConfig, ComboPooledDataSource>(); + dataSourceMap = new HashMap<>(); } /** @@ -56,9 +61,7 @@ public class DataSourceConnectionProvider implements ConnectionProvider { * @return the driver configfrom conf */ public DriverConfig getDriverConfigfromConf(Configuration conf) { - return new DriverConfig(conf.get(JDBCDriverConfConstants.JDBC_DRIVER_CLASS), - conf.get(JDBCDriverConfConstants.JDBC_DB_URI), conf.get(JDBCDriverConfConstants.JDBC_USER), - conf.get(JDBCDriverConfConstants.JDBC_PASSWORD)); + return new DriverConfig(conf); } /** @@ -78,6 +81,8 @@ public class DataSourceConnectionProvider implements ConnectionProvider { /** The password. */ final String password; + final Properties properties; + /** The has hash code. */ boolean hasHashCode = false; @@ -87,16 +92,34 @@ public class DataSourceConnectionProvider implements ConnectionProvider { /** * Instantiates a new driver config. * - * @param driverClass the driver class - * @param jdbcURI the jdbc uri - * @param user the user - * @param password the password + * @param conf the configuration */ - public DriverConfig(String driverClass, String jdbcURI, String user, String password) { - this.driverClass = driverClass; - this.jdbcURI = jdbcURI; - this.user = user; - this.password = password; + public DriverConfig(Configuration conf) { + this.driverClass = conf.get(JDBC_DRIVER_CLASS); + this.jdbcURI = conf.get(JDBC_DB_URI); + properties = new Properties(); + properties.putAll(CommonUtils.parseMapFromString(conf.get(JDBC_CONNECTION_PROPERTIES))); + if (conf.get(JDBC_USER) != null) { + properties.setProperty("user", conf.get(JDBC_USER)); + } + if (conf.get(JDBC_PASSWORD) != null) { + properties.setProperty("password", conf.get(JDBC_PASSWORD)); + } + this.user = properties.getProperty("user"); + this.password = properties.getProperty("password"); + // Maximum number of connections allowed in the pool + setConnectionPoolProperties(properties, conf); + } + + private void setConnectionPoolProperties(Properties properties, Configuration conf) { + for (JDBCDriverConfConstants.ConnectionPoolProperties property : JDBCDriverConfConstants + .ConnectionPoolProperties.values()) { + if (conf.get(property.getConfigKey()) != null) { + properties.put(property.getPoolProperty(), conf.get(property.getConfigKey())); + } else if (!properties.containsKey(property.getPoolProperty())) { + properties.put(property.getPoolProperty(), Integer.toString(property.getDefaultValue())); + } + } } /* @@ -141,11 +164,12 @@ public class DataSourceConnectionProvider implements ConnectionProvider { */ @Override public String toString() { - StringBuilder builder = new StringBuilder("jdbcDriverClass: ").append(driverClass).append(", uri: ") - .append(jdbcURI).append(", user: ").append(user); - return builder.toString(); + return "jdbcDriverClass: " + driverClass + ", uri: " + jdbcURI + ", user: " + user; } + public String getProperty(String key) { + return properties.getProperty(key); + } } /* @@ -164,27 +188,15 @@ public class DataSourceConnectionProvider implements ConnectionProvider { throw new IllegalArgumentException("Unable to set driver class:" + config.driverClass, e); } cpds.setJdbcUrl(config.jdbcURI); - cpds.setUser(config.user); - cpds.setPassword(config.password); - - // Maximum number of connections allowed in the pool - cpds.setMaxPoolSize(conf.getInt(JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE, - JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE_DEFAULT)); - // Max idle time before a connection is closed - cpds.setMaxIdleTime(conf.getInt(JDBCDriverConfConstants.JDBC_POOL_IDLE_TIME, - JDBCDriverConfConstants.JDBC_POOL_IDLE_TIME_DEFAULT)); - // Max idle time before connection is closed if - // number of connections is > min pool size (default = 3) - cpds.setMaxIdleTimeExcessConnections(conf.getInt(JDBCDriverConfConstants.JDBC_POOL_IDLE_TIME, - JDBCDriverConfConstants.JDBC_POOL_IDLE_TIME_DEFAULT)); - // Maximum number of prepared statements to cache per connection - cpds.setMaxStatementsPerConnection(conf.getInt(JDBCDriverConfConstants.JDBC_MAX_STATEMENTS_PER_CONNECTION, - JDBCDriverConfConstants.JDBC_MAX_STATEMENTS_PER_CONNECTION_DEFAULT)); - - // How many milliseconds should a caller wait when trying to get a connection - // If the timeout expires, SQLException will be thrown - cpds.setCheckoutTimeout(conf.getInt(JDBCDriverConfConstants.JDBC_GET_CONNECTION_TIMEOUT, - JDBCDriverConfConstants.JDBC_GET_CONNECTION_TIMEOUT_DEFAULT)); + cpds.setProperties(config.properties); + + cpds.setMaxPoolSize(Integer.parseInt(config.getProperty(JDBC_POOL_MAX_SIZE.getPoolProperty()))); + cpds.setMaxIdleTime(Integer.parseInt(config.getProperty(JDBC_POOL_IDLE_TIME.getPoolProperty()))); + cpds.setMaxIdleTimeExcessConnections(Integer.parseInt(config.getProperty(JDBC_MAX_IDLE_TIME_EXCESS_CONNECTIONS + .getPoolProperty()))); + cpds.setMaxStatementsPerConnection(Integer.parseInt(config.getProperty(JDBC_MAX_STATEMENTS_PER_CONNECTION + .getPoolProperty()))); + cpds.setCheckoutTimeout(Integer.parseInt(config.getProperty(JDBC_GET_CONNECTION_TIMEOUT.getPoolProperty()))); dataSourceMap.put(config, cpds); log.info("Created new datasource for config: {}", config); } http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriver.java ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriver.java b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriver.java index 777f73a..a8b980f 100644 --- a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriver.java +++ b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriver.java @@ -19,8 +19,10 @@ package org.apache.lens.driver.jdbc; import static java.lang.Integer.parseInt; +import static java.util.Arrays.asList; import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.*; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.ConnectionPoolProperties.*; import static org.apache.lens.server.api.util.LensUtil.getImplementations; import static com.google.common.base.Preconditions.checkState; @@ -45,7 +47,9 @@ import org.apache.lens.server.api.error.LensException; import org.apache.lens.server.api.events.LensEventListener; import org.apache.lens.server.api.metrics.MethodMetricsContext; import org.apache.lens.server.api.metrics.MethodMetricsFactory; -import org.apache.lens.server.api.query.*; +import org.apache.lens.server.api.query.AbstractQueryContext; +import org.apache.lens.server.api.query.PreparedQueryContext; +import org.apache.lens.server.api.query.QueryContext; import org.apache.lens.server.api.query.collect.WaitingQueriesSelectionPolicy; import org.apache.lens.server.api.query.constraint.MaxConcurrentDriverQueriesConstraintFactory; import org.apache.lens.server.api.query.constraint.QueryLaunchingConstraint; @@ -65,7 +69,6 @@ import com.google.common.collect.ImmutableSet; import lombok.Getter; import lombok.NonNull; import lombok.Setter; - import lombok.extern.slf4j.Slf4j; /** @@ -306,7 +309,7 @@ public class JDBCDriver implements LensDriver { logSegregationContext.setLogSegragationAndQueryId(this.queryContext.getQueryHandleString()); - Statement stmt = null; + Statement stmt; Connection conn = null; QueryResult result = new QueryResult(); try { @@ -448,13 +451,13 @@ public class JDBCDriver implements LensDriver { */ protected void init(Configuration conf) throws LensException { - final int maxPoolSize = parseInt(this.conf.get(JDBC_POOL_MAX_SIZE)); + final int maxPoolSize = parseInt(this.conf.get(JDBC_POOL_MAX_SIZE.getConfigKey())); final int maxConcurrentQueries = parseInt(this.conf.get(MaxConcurrentDriverQueriesConstraintFactory.MAX_CONCURRENT_QUERIES_KEY)); checkState(maxPoolSize == maxConcurrentQueries, "maxPoolSize:" + maxPoolSize + " maxConcurrentQueries:" + maxConcurrentQueries); - queryContextMap = new ConcurrentHashMap<QueryHandle, JdbcQueryContext>(); + queryContextMap = new ConcurrentHashMap<>(); asyncQueryPool = Executors.newCachedThreadPool(new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { @@ -684,14 +687,15 @@ public class JDBCDriver implements LensDriver { return JDBC_DRIVER_PFX + "estimate." + jdbcKey.substring(JDBC_DRIVER_PFX.length()); } - // If 'key' is set in conf, return its value. - // Otherwise, return value specified for fallBackKey - private String getKeyOrFallBack(Configuration conf, String key, String fallBackKey) { - String val = conf.get(key); - if (StringUtils.isBlank(val)) { - val = conf.get(fallBackKey); + // If any 'key' in 'keys' is set in conf, return its value. + private static String getKeyOrFallBack(Configuration conf, String... keys) { + for (String key : keys) { + String val = conf.get(key); + if (StringUtils.isNotBlank(val)) { + return val; + } } - return val; + return null; } // Get connection config used by estimate pool. @@ -700,26 +704,19 @@ public class JDBCDriver implements LensDriver { Configuration tmpConf = new Configuration(conf); // Override JDBC settings in estimate conf, if set by user explicitly. Otherwise fall back to default JDBC pool // config - tmpConf.set(JDBC_DB_URI, getKeyOrFallBack(tmpConf, getEstimateKey(JDBC_DB_URI), JDBC_DB_URI)); - tmpConf.set(JDBC_DRIVER_CLASS, getKeyOrFallBack(tmpConf, getEstimateKey(JDBC_DRIVER_CLASS), JDBC_DRIVER_CLASS)); - tmpConf.set(JDBC_USER, getKeyOrFallBack(tmpConf, getEstimateKey(JDBC_USER), JDBC_USER)); - - String password = getKeyOrFallBack(tmpConf, getEstimateKey(JDBC_PASSWORD), JDBC_PASSWORD); + for (String key : asList(JDBC_CONNECTION_PROPERTIES, JDBC_DB_URI, JDBC_DRIVER_CLASS, JDBC_USER, JDBC_PASSWORD, + JDBC_POOL_MAX_SIZE.getConfigKey(), JDBC_POOL_IDLE_TIME.getConfigKey(), + JDBC_MAX_IDLE_TIME_EXCESS_CONNECTIONS.getConfigKey(), + JDBC_MAX_STATEMENTS_PER_CONNECTION.getConfigKey(), JDBC_GET_CONNECTION_TIMEOUT.getConfigKey())) { + String val = getKeyOrFallBack(tmpConf, getEstimateKey(key), key); + if (val != null) { + tmpConf.set(key, val); + } + } /* We need to set password as empty string if it is not provided. Setting null on conf is not allowed */ - if (password == null) { - password = ""; + if (tmpConf.get(JDBC_PASSWORD) == null) { + tmpConf.set(JDBC_PASSWORD, ""); } - tmpConf.set(JDBC_PASSWORD, password); - - tmpConf.set(JDBC_POOL_MAX_SIZE, getKeyOrFallBack(tmpConf, getEstimateKey(JDBC_POOL_MAX_SIZE), - JDBC_POOL_MAX_SIZE)); - tmpConf.set(JDBC_POOL_IDLE_TIME, getKeyOrFallBack(tmpConf, getEstimateKey(JDBC_POOL_IDLE_TIME), - JDBC_POOL_IDLE_TIME)); - tmpConf.set(JDBC_MAX_STATEMENTS_PER_CONNECTION, getKeyOrFallBack(tmpConf, - getEstimateKey(JDBC_MAX_STATEMENTS_PER_CONNECTION), JDBC_MAX_STATEMENTS_PER_CONNECTION)); - tmpConf.set(JDBC_GET_CONNECTION_TIMEOUT, getKeyOrFallBack(tmpConf, - getEstimateKey(JDBC_GET_CONNECTION_TIMEOUT), JDBC_GET_CONNECTION_TIMEOUT)); - estimateConf = tmpConf; } return estimateConf; @@ -739,8 +736,7 @@ public class JDBCDriver implements LensDriver { return connectionProvider; } - private final Map<QueryPrepareHandle, PreparedStatement> preparedQueries = - new HashMap<QueryPrepareHandle, PreparedStatement>(); + private final Map<QueryPrepareHandle, PreparedStatement> preparedQueries = new HashMap<>(); /** * Internally prepare the query @@ -896,8 +892,7 @@ public class JDBCDriver implements LensDriver { JdbcQueryContext queryContext = new JdbcQueryContext(context, logSegregationContext); queryContext.setPrepared(false); queryContext.setRewrittenQuery(rewrittenQuery); - QueryResult result = new QueryCallable(queryContext, logSegregationContext).call(); - return result; + return new QueryCallable(queryContext, logSegregationContext).call(); // LOG.info("Execute " + context.getQueryHandle()); } @@ -1077,7 +1072,7 @@ public class JDBCDriver implements LensDriver { log.warn("Error closing query : {}", query.getHandleId(), e); } } - for (QueryPrepareHandle query : new ArrayList<QueryPrepareHandle>(preparedQueries.keySet())) { + for (QueryPrepareHandle query : preparedQueries.keySet()) { try { try { preparedQueries.get(query).close(); http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriverConfConstants.java ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriverConfConstants.java b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriverConfConstants.java index 70815bb..ac0682d 100644 --- a/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriverConfConstants.java +++ b/lens-driver-jdbc/src/main/java/org/apache/lens/driver/jdbc/JDBCDriverConfConstants.java @@ -18,6 +18,8 @@ */ package org.apache.lens.driver.jdbc; +import lombok.Getter; + /** * The Interface JDBCDriverConfConstants. */ @@ -28,6 +30,9 @@ public final class JDBCDriverConfConstants { /** The Constant JDBC_DRIVER_PFX. */ public static final String JDBC_DRIVER_PFX = "lens.driver.jdbc."; + /** The Constant JDBC_CONNECTION_PROPERTIES. */ + public static final String JDBC_CONNECTION_PROPERTIES = JDBC_DRIVER_PFX + "connection.properties"; + /** The Constant JDBC_CONNECTION_PROVIDER. */ public static final String JDBC_CONNECTION_PROVIDER = JDBC_DRIVER_PFX + "connection.provider"; @@ -47,29 +52,32 @@ public final class JDBCDriverConfConstants { /** The Constant JDBC_PASSWORD. */ public static final String JDBC_PASSWORD = JDBC_DRIVER_PFX + "db.password"; - /** The Constant JDBC_POOL_MAX_SIZE. */ - public static final String JDBC_POOL_MAX_SIZE = JDBC_DRIVER_PFX + "pool.max.size"; - - /** The Constant JDBC_POOL_MAX_SIZE_DEFAULT. */ - public static final int JDBC_POOL_MAX_SIZE_DEFAULT = 15; - - /** The Constant JDBC_POOL_IDLE_TIME. */ - public static final String JDBC_POOL_IDLE_TIME = JDBC_DRIVER_PFX + "pool.idle.time"; - - /** The Constant JDBC_POOL_IDLE_TIME_DEFAULT. */ - public static final int JDBC_POOL_IDLE_TIME_DEFAULT = 600; - - /** The Constant JDBC_MAX_STATEMENTS_PER_CONNECTION. */ - public static final String JDBC_MAX_STATEMENTS_PER_CONNECTION = JDBC_DRIVER_PFX + "pool.max.statements"; - - /** The Constant JDBC_MAX_STATEMENTS_PER_CONNECTION_DEFAULT. */ - public static final int JDBC_MAX_STATEMENTS_PER_CONNECTION_DEFAULT = 20; - - /** The Constant JDBC_GET_CONNECTION_TIMEOUT. */ - public static final String JDBC_GET_CONNECTION_TIMEOUT = JDBC_DRIVER_PFX + "get.connection.timeout"; - - /** The Constant JDBC_GET_CONNECTION_TIMEOUT_DEFAULT. */ - public static final int JDBC_GET_CONNECTION_TIMEOUT_DEFAULT = 10000; + public enum ConnectionPoolProperties { + /** The Constant JDBC_POOL_MAX_SIZE_DEFAULT. */ + JDBC_POOL_MAX_SIZE("maxPoolSize", JDBC_DRIVER_PFX + "pool.max.size", 15), + /** The Constant JDBC_POOL_IDLE_TIME. */ + JDBC_POOL_IDLE_TIME("maxIdleTime", JDBC_DRIVER_PFX + "pool.idle.time", 600), + /** JDBC_MAX_IDLE_TIME_EXCESS_CONNECTIONS */ + JDBC_MAX_IDLE_TIME_EXCESS_CONNECTIONS("maxIdleTimeExcessConnections", JDBC_DRIVER_PFX + + "max.idle.time.excess.connections", 600), + /** The Constant JDBC_MAX_STATEMENTS_PER_CONNECTION. */ + JDBC_MAX_STATEMENTS_PER_CONNECTION("maxStatementsPerConnection", JDBC_DRIVER_PFX + "pool.max.statements", 20), + /** The Constant JDBC_GET_CONNECTION_TIMEOUT. */ + JDBC_GET_CONNECTION_TIMEOUT("checkoutTimeout", JDBC_DRIVER_PFX + "get.connection.timeout", 10000); + + @Getter + private final String poolProperty; + @Getter + private final String configKey; + @Getter + private final int defaultValue; + + ConnectionPoolProperties(String poolProperty, String configKey, int defaultValue) { + this.poolProperty = poolProperty; + this.configKey = configKey; + this.defaultValue = defaultValue; + } + } /** The Constant JDBC_EXPLAIN_KEYWORD_PARAM. */ public static final String JDBC_EXPLAIN_KEYWORD_PARAM = JDBC_DRIVER_PFX + "explain.keyword"; @@ -100,6 +108,6 @@ public final class JDBCDriverConfConstants { + "query.launching.constraint.factories"; public static final String WAITING_QUERIES_SELECTION_POLICY_FACTORIES_KEY = JDBC_DRIVER_PFX - + "waiting.queries.selection.policy.factories"; + + "waiting.queries.selection.policy.factories"; public static final String REGEX_REPLACEMENT_VALUES = JDBC_DRIVER_PFX + "regex.replacement.values"; } http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/main/resources/jdbcdriver-default.xml ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/main/resources/jdbcdriver-default.xml b/lens-driver-jdbc/src/main/resources/jdbcdriver-default.xml index 163ed42..b5b6164 100644 --- a/lens-driver-jdbc/src/main/resources/jdbcdriver-default.xml +++ b/lens-driver-jdbc/src/main/resources/jdbcdriver-default.xml @@ -29,6 +29,12 @@ </property> <property> + <name>lens.driver.jdbc.connection.properties</name> + <value></value> + <description>Connection properties for jdbc connection.</description> + </property> + + <property> <name>lens.driver.jdbc.query.rewriter</name> <value>org.apache.lens.driver.jdbc.ColumnarSQLRewriter</value> <description>Rewriting the HQL to optimized sql queries</description> @@ -90,6 +96,13 @@ </property> <!-- Estimate query connection pool settings --> + + <property> + <name>lens.driver.jdbc.estimate.connection.properties</name> + <value></value> + <description>Connection properties for jdbc estimate connection.</description> + </property> + <property> <name>lens.driver.jdbc.estimate.driver.class</name> <value></value> http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestDataSourceConnectionProvider.java ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestDataSourceConnectionProvider.java b/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestDataSourceConnectionProvider.java index 21e5f50..8c68ad6 100644 --- a/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestDataSourceConnectionProvider.java +++ b/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestDataSourceConnectionProvider.java @@ -18,6 +18,9 @@ */ package org.apache.lens.driver.jdbc; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.ConnectionPoolProperties.JDBC_GET_CONNECTION_TIMEOUT; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.ConnectionPoolProperties.JDBC_POOL_MAX_SIZE; + import static org.testng.Assert.assertEquals; import static org.testng.Assert.fail; @@ -117,10 +120,10 @@ public class TestDataSourceConnectionProvider { conf.set(JDBCDriverConfConstants.JDBC_PASSWORD, ""); // Set a low timeout - conf.setInt(JDBCDriverConfConstants.JDBC_GET_CONNECTION_TIMEOUT, 1000); + conf.setInt(JDBC_GET_CONNECTION_TIMEOUT.getConfigKey(), 1000); final int MAX_CONNECTIONS = 3; - conf.setInt(JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE, MAX_CONNECTIONS); + conf.setInt(JDBC_POOL_MAX_SIZE.getConfigKey(), MAX_CONNECTIONS); final DataSourceConnectionProvider cp = new DataSourceConnectionProvider(); Connection[] connections = new Connection[MAX_CONNECTIONS + 1]; http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java b/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java index 9041709..425bd6f 100644 --- a/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java +++ b/lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java @@ -18,6 +18,9 @@ */ package org.apache.lens.driver.jdbc; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.*; +import static org.apache.lens.driver.jdbc.JDBCDriverConfConstants.ConnectionPoolProperties.*; + import static org.testng.Assert.*; import java.sql.*; @@ -76,12 +79,12 @@ public class TestJdbcDriver { @BeforeTest public void testCreateJdbcDriver() throws Exception { baseConf = new Configuration(); - baseConf.set(JDBCDriverConfConstants.JDBC_DRIVER_CLASS, "org.hsqldb.jdbc.JDBCDriver"); - baseConf.set(JDBCDriverConfConstants.JDBC_DB_URI, "jdbc:hsqldb:mem:jdbcTestDB"); - baseConf.set(JDBCDriverConfConstants.JDBC_USER, "SA"); - baseConf.set(JDBCDriverConfConstants.JDBC_PASSWORD, ""); - baseConf.set(JDBCDriverConfConstants.JDBC_EXPLAIN_KEYWORD_PARAM, "explain plan for "); - baseConf.setClass(JDBCDriverConfConstants.JDBC_QUERY_HOOK_CLASS, MockDriverQueryHook.class, DriverQueryHook.class); + baseConf.set(JDBC_DRIVER_CLASS, "org.hsqldb.jdbc.JDBCDriver"); + baseConf.set(JDBC_DB_URI, "jdbc:hsqldb:mem:jdbcTestDB"); + baseConf.set(JDBC_USER, "SA"); + baseConf.set(JDBC_PASSWORD, ""); + baseConf.set(JDBC_EXPLAIN_KEYWORD_PARAM, "explain plan for "); + baseConf.setClass(JDBC_QUERY_HOOK_CLASS, MockDriverQueryHook.class, DriverQueryHook.class); hConf = new HiveConf(baseConf, this.getClass()); driver = new JDBCDriver(); @@ -258,7 +261,7 @@ public class TestJdbcDriver { // Test connection leak for estimate final int maxEstimateConnections = - driver.getEstimateConnectionConf().getInt(JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE, 50); + driver.getEstimateConnectionConf().getInt(JDBC_POOL_MAX_SIZE.getConfigKey(), 50); for (int i = 0; i < maxEstimateConnections + 10; i++) { try { log.info("Iteration#{}", (i + 1)); @@ -620,7 +623,7 @@ public class TestJdbcDriver { final String query = "SELECT * from invalid_conn_close2"; QueryContext ctx = new QueryContext(query, "SA", new LensConf(), baseConf, drivers); - for (int i = 0; i < JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE_DEFAULT; i++) { + for (int i = 0; i < JDBC_POOL_MAX_SIZE.getDefaultValue(); i++) { executeAsync(ctx); driver.updateStatus(ctx); System.out.println("@@@@ QUERY " + (i + 1)); @@ -661,7 +664,7 @@ public class TestJdbcDriver { final String query = "SELECT * from valid_conn_close"; QueryContext ctx = createQueryContext(query); - for (int i = 0; i < JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE_DEFAULT; i++) { + for (int i = 0; i < ConnectionPoolProperties.JDBC_POOL_MAX_SIZE.getDefaultValue(); i++) { LensResultSet resultSet = driver.execute(ctx); assertNotNull(resultSet); if (resultSet instanceof InMemoryResultSet) { @@ -781,12 +784,11 @@ public class TestJdbcDriver { assertTrue(estimateConf != driver.getConf()); // Validate overridden conf - assertEquals(estimateConf.get(JDBCDriverConfConstants.JDBC_USER), "estimateUser"); - assertEquals(estimateConf.get(JDBCDriverConfConstants.JDBC_POOL_MAX_SIZE), "50"); - assertEquals(estimateConf.get(JDBCDriverConfConstants.JDBC_POOL_IDLE_TIME), "800"); - assertEquals(estimateConf.get(JDBCDriverConfConstants.JDBC_GET_CONNECTION_TIMEOUT), "25000"); - assertEquals(estimateConf.get(JDBCDriverConfConstants.JDBC_MAX_STATEMENTS_PER_CONNECTION), - "15"); + assertEquals(estimateConf.get(JDBC_USER), "estimateUser"); + assertEquals(estimateConf.get(JDBC_POOL_MAX_SIZE.getConfigKey()), "50"); + assertEquals(estimateConf.get(JDBC_POOL_IDLE_TIME.getConfigKey()), "800"); + assertEquals(estimateConf.get(JDBC_GET_CONNECTION_TIMEOUT.getConfigKey()), "25000"); + assertEquals(estimateConf.get(JDBC_MAX_STATEMENTS_PER_CONNECTION.getConfigKey()), "15"); } @Test @@ -837,6 +839,7 @@ public class TestJdbcDriver { assertEquals(estimatePool.getMaxIdleTime(), 800); assertEquals(estimatePool.getCheckoutTimeout(), 25000); assertEquals(estimatePool.getMaxStatementsPerConnection(), 15); + assertEquals(estimatePool.getProperties().get("random_key"), "random_value"); } } http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/lens-driver-jdbc/src/test/resources/jdbcdriver-site.xml ---------------------------------------------------------------------- diff --git a/lens-driver-jdbc/src/test/resources/jdbcdriver-site.xml b/lens-driver-jdbc/src/test/resources/jdbcdriver-site.xml index 5594fbf..1202074 100644 --- a/lens-driver-jdbc/src/test/resources/jdbcdriver-site.xml +++ b/lens-driver-jdbc/src/test/resources/jdbcdriver-site.xml @@ -36,28 +36,35 @@ </property> <property> - <name>lens.driver.jdbc.estimate.pool.max.size</name> - <value>50</value> + <name>lens.driver.jdbc.estimate.connection.properties</name> + <value>random_key=random_value</value> + <description>Connection properties for jdbc connection.</description> + </property> + + + <property> + <name>lens.driver.jdbc.estimate.pool.max.size</name> + <value>50</value> </property> <property> - <name>lens.driver.jdbc.estimate.pool.idle.time</name> - <value>800</value> + <name>lens.driver.jdbc.estimate.pool.idle.time</name> + <value>800</value> </property> <property> - <name>lens.driver.jdbc.estimate.get.connection.timeout</name> - <value>25000</value> + <name>lens.driver.jdbc.estimate.get.connection.timeout</name> + <value>25000</value> </property> <property> - <name>lens.driver.jdbc.estimate.pool.max.statements</name> - <value>15</value> + <name>lens.driver.jdbc.estimate.pool.max.statements</name> + <value>15</value> </property> <property> <name>lens.driver.jdbc.regex.replacement.values</name> - <value>weekofyear=week, to_date=date, format_number=format, date_sub\((.*?)\,\s*([0-9]+\s*)\)=date_sub($1\, interval $2 day), date_add\((.*?)\,\s*([0-9]+\s*)\)=date_add($1\, interval $2 day)</value> + <value>weekofyear=week, to_date=date, format_number=format, date_sub\((.*?)\,\s*([0-9]+\s*)\)=date_sub($1\, interval$2 day), date_add\((.*?)\,\s*([0-9]+\s*)\)=date_add($1\, interval $2 day)</value> <description>Rewriting the HQL to optimized sql queries</description> </property> </configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/src/site/apt/admin/config.apt ---------------------------------------------------------------------- diff --git a/src/site/apt/admin/config.apt b/src/site/apt/admin/config.apt index 76cbff0..88c1489 100644 --- a/src/site/apt/admin/config.apt +++ b/src/site/apt/admin/config.apt @@ -87,164 +87,164 @@ Lens server configuration *--+--+---+--+ |30|lens.server.event.service.thread.pool.size| |The size of thread pool for notifying events. The no value is specified, it uses the available processors as the number.| *--+--+---+--+ -|31|lens.server.index.ws.resource.impl|org.apache.lens.server.IndexResource|Implementation class for Index Resource| +|31|lens.server.hdfs.output.retention|1 day|hdfs output retention period. Default 1 day| *--+--+---+--+ -|32|lens.server.log.ws.resource.impl|org.apache.lens.server.LogResource|Implementation class for Log Resource| +|32|lens.server.index.ws.resource.impl|org.apache.lens.server.IndexResource|Implementation class for Index Resource| *--+--+---+--+ -|33|lens.server.mail.from.address|[email protected]|The from field in the notifier mail to the submitter.| +|33|lens.server.log.ws.resource.impl|org.apache.lens.server.LogResource|Implementation class for Log Resource| *--+--+---+--+ -|34|lens.server.mail.host|mail-host.company.com|SMTP Host for sending mail| +|34|lens.server.mail.from.address|[email protected]|The from field in the notifier mail to the submitter.| *--+--+---+--+ -|35|lens.server.mail.port|25|SMTP Port| +|35|lens.server.mail.host|mail-host.company.com|SMTP Host for sending mail| *--+--+---+--+ -|36|lens.server.mail.smtp.connectiontimeout|15000|Socket connection timeout value in milliseconds. This timeout is implemented by java.net.Socket. Default is 15 seconds.| +|36|lens.server.mail.port|25|SMTP Port| *--+--+---+--+ -|37|lens.server.mail.smtp.timeout|30000|Socket read timeout value in milliseconds. This timeout is implemented by java.net.Socket. Default is 30 seconds.| +|37|lens.server.mail.smtp.connectiontimeout|15000|Socket connection timeout value in milliseconds. This timeout is implemented by java.net.Socket. Default is 15 seconds.| *--+--+---+--+ -|38|lens.server.metastore.service.impl|org.apache.lens.server.metastore.CubeMetastoreServiceImpl|Implementation class for metastore service| +|38|lens.server.mail.smtp.timeout|30000|Socket read timeout value in milliseconds. This timeout is implemented by java.net.Socket. Default is 30 seconds.| *--+--+---+--+ -|39|lens.server.metastore.ws.resource.impl|org.apache.lens.server.metastore.MetastoreResource|Implementation class for Metastore Resource| +|39|lens.server.metastore.service.impl|org.apache.lens.server.metastore.CubeMetastoreServiceImpl|Implementation class for metastore service| *--+--+---+--+ -|40|lens.server.metrics.csv.directory.path|metrics/|Path of the directory in which to report metrics as separate csv files.| +|40|lens.server.metastore.ws.resource.impl|org.apache.lens.server.metastore.MetastoreResource|Implementation class for Metastore Resource| *--+--+---+--+ -|41|lens.server.metrics.ganglia.host| |The ganglia host name| +|41|lens.server.metrics.csv.directory.path|metrics/|Path of the directory in which to report metrics as separate csv files.| *--+--+---+--+ -|42|lens.server.metrics.ganglia.port| |The ganglia port| +|42|lens.server.metrics.ganglia.host| |The ganglia host name| *--+--+---+--+ -|43|lens.server.metrics.graphite.host| |The graphite host name| +|43|lens.server.metrics.ganglia.port| |The ganglia port| *--+--+---+--+ -|44|lens.server.metrics.graphite.port| |The graphite port| +|44|lens.server.metrics.graphite.host| |The graphite host name| *--+--+---+--+ -|45|lens.server.metrics.reporting.period|10|The reporting period for metrics. The value is in seconds| +|45|lens.server.metrics.graphite.port| |The graphite port| *--+--+---+--+ -|46|lens.server.mode|OPEN|The mode in which server should run. Allowed values are OPEN, READ_ONLY, METASTORE_READONLY, METASTORE_NODROP. OPEN mode will allow all requests. READ_ONLY mode will allow all requests on session resouce and only GET requests on all other resources. METASTORE_READONLY will allow GET on metastore and all other requests in other services. METASTORE_NODROP will not allow DELETE on metastore, will allow all other requests.| +|46|lens.server.metrics.reporting.period|10|The reporting period for metrics. The value is in seconds| *--+--+---+--+ -|47|lens.server.multipart.ws.feature.impl|org.glassfish.jersey.media.multipart.MultiPartFeature|Implementation class for query scheduler resource| +|47|lens.server.mode|OPEN|The mode in which server should run. Allowed values are OPEN, READ_ONLY, METASTORE_READONLY, METASTORE_NODROP. OPEN mode will allow all requests. READ_ONLY mode will allow all requests on session resouce and only GET requests on all other resources. METASTORE_READONLY will allow GET on metastore and all other requests in other services. METASTORE_NODROP will not allow DELETE on metastore, will allow all other requests.| *--+--+---+--+ -|48|lens.server.persist.location|file:///tmp/lensserver|The directory in which lens server will persist its state when it is going down. The location be on any Hadoop compatible file system. Server will read from the location when it is restarted and recovery is enabled. So, Server should have both read and write permissions to the location| +|48|lens.server.multipart.ws.feature.impl|org.glassfish.jersey.media.multipart.MultiPartFeature|Implementation class for query scheduler resource| *--+--+---+--+ -|49|lens.server.query.acceptors| |Query Acceptors configured. Query acceptors are consulted first, before anything happens for the given query. They can either return null or return a messaging indicating why the given query shouldn't be accepted. These can be used to filter out queries at the earliest.| +|49|lens.server.persist.location|file:///tmp/lensserver|The directory in which lens server will persist its state when it is going down. The location be on any Hadoop compatible file system. Server will read from the location when it is restarted and recovery is enabled. So, Server should have both read and write permissions to the location| *--+--+---+--+ -|50|lens.server.query.launching.constraint.factories|org.apache.lens.server.query.constraint.TotalQueryCostCeilingConstraintFactory|Factories used to instantiate constraints enforced on queries by lens. Every Factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.constraint.QueryLaunchingConstraint. A query will be launched only if all constraints pass.| +|50|lens.server.query.acceptors| |Query Acceptors configured. Query acceptors are consulted first, before anything happens for the given query. They can either return null or return a messaging indicating why the given query shouldn't be accepted. These can be used to filter out queries at the earliest.| *--+--+---+--+ -|51|lens.server.query.phase1.rewriters| |Query phase 1 rewriters. This is to convert user query to cube query. The resulting cube query will be passed for validation and rewriting to hql query.\ | +|51|lens.server.query.launching.constraint.factories|org.apache.lens.server.query.constraint.TotalQueryCostCeilingConstraintFactory|Factories used to instantiate constraints enforced on queries by lens. Every Factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.constraint.QueryLaunchingConstraint. A query will be launched only if all constraints pass.| +*--+--+---+--+ +|52|lens.server.query.phase1.rewriters| |Query phase 1 rewriters. This is to convert user query to cube query. The resulting cube query will be passed for validation and rewriting to hql query.\ | | | | |Use cases will be to use extra intelligence to convert user query to optimized cube query. \ | | | | |Or define shortcuts for certain frequently used queries :) | *--+--+---+--+ -|52|lens.server.query.service.impl|org.apache.lens.server.query.QueryExecutionServiceImpl|Implementation class for query execution service| -*--+--+---+--+ -|53|lens.server.query.state.logger.enabled|true|Disable or enable the query state logger with this config. The location for the logger can be specified in logback xml for the class org.apache.lens.server.query.QueryExecutionServiceImpl.QueryStatusLogger| +|53|lens.server.query.resultset.retention|1 day|Lens query resultset retention period. Default 1 day| *--+--+---+--+ -|54|lens.server.query.ws.resource.impl|org.apache.lens.server.query.QueryServiceResource|Implementation class for Query Resource| +|54|lens.server.query.service.impl|org.apache.lens.server.query.QueryExecutionServiceImpl|Implementation class for query execution service| *--+--+---+--+ -|55|lens.server.querypurger.sleep.interval|10000|The interval(milliseconds) with which purger to run periodically. Default 10 sec.| +|55|lens.server.query.state.logger.enabled|true|Disable or enable the query state logger with this config. The location for the logger can be specified in logback xml for the class org.apache.lens.server.query.QueryExecutionServiceImpl.QueryStatusLogger| *--+--+---+--+ -|56|lens.server.quota.service.impl|org.apache.lens.server.quota.QuotaServiceImpl|Implementation class for quota service| +|56|lens.server.query.ws.resource.impl|org.apache.lens.server.query.QueryServiceResource|Implementation class for Query Resource| *--+--+---+--+ -|57|lens.server.quota.ws.resource.impl|org.apache.lens.server.quota.QuotaResource|Implementation class for Quota Resource| +|57|lens.server.querypurger.sleep.interval|10000|The interval(milliseconds) with which purger to run periodically. Default 10 sec.| *--+--+---+--+ -|58|lens.server.recover.onrestart|true|If the flag is enabled, all the services will be started from last saved state, if disabled all the services will start afresh| +|58|lens.server.quota.service.impl|org.apache.lens.server.quota.QuotaServiceImpl|Implementation class for quota service| *--+--+---+--+ -|59|lens.server.restart.enabled|true|If flag is enabled, all the services will be persisted to persistent location passed.| +|59|lens.server.quota.ws.resource.impl|org.apache.lens.server.quota.QuotaResource|Implementation class for Quota Resource| *--+--+---+--+ -|60|lens.server.savedquery.jdbc.dialectclass|org.apache.lens.server.query.save.SavedQueryDao$HSQLDialect|Dialect of the target DB, Default is HSQL. Override with the target DB used.| +|60|lens.server.recover.onrestart|true|If the flag is enabled, all the services will be started from last saved state, if disabled all the services will start afresh| *--+--+---+--+ -|61|lens.server.savedquery.list.default.count|20|Key denoting the default fetch value of saved query list api.| +|61|lens.server.restart.enabled|true|If flag is enabled, all the services will be persisted to persistent location passed.| *--+--+---+--+ -|62|lens.server.savedquery.list.default.offset|0|Key denoting the default start value of saved query list api.| +|62|lens.server.resultset.purge.enabled|false|Whether to purge the query results| *--+--+---+--+ -|63|lens.server.savedquery.service.impl|org.apache.lens.server.query.save.SavedQueryServiceImpl|Implementation class for saved query service| +|63|lens.server.resultsetpurger.sleep.interval.secs|3600|Periodicity for Query result purger runs. Default 1 hour.| *--+--+---+--+ -|64|lens.server.savedquery.ws.resource.impl|org.apache.lens.server.query.save.SavedQueryResource|Implementation class for Saved query Resource| +|64|lens.server.savedquery.jdbc.dialectclass|org.apache.lens.server.query.save.SavedQueryDao$HSQLDialect|Dialect of the target DB, Default is HSQL. Override with the target DB used.| *--+--+---+--+ -|65|lens.server.scheduler.service.impl|org.apache.lens.server.scheduler.QuerySchedulerServiceImpl|Implementation class for query scheduler service| +|65|lens.server.savedquery.list.default.count|20|Key denoting the default fetch value of saved query list api.| *--+--+---+--+ -|66|lens.server.scheduler.ws.resource.impl|org.apache.lens.server.scheduler.ScheduleResource|Implementation class for query scheduler resource| +|66|lens.server.savedquery.list.default.offset|0|Key denoting the default start value of saved query list api.| *--+--+---+--+ -|67|lens.server.scheduling.queue.poll.interval.millisec|2000|The interval at which submission thread will poll scheduling queue to fetch the next query for submission. If value is less than equal to 0, then it would mean that thread will continuosly poll without sleeping. The interval has to be given in milliseconds.| +|67|lens.server.savedquery.service.impl|org.apache.lens.server.query.save.SavedQueryServiceImpl|Implementation class for saved query service| *--+--+---+--+ -|68|lens.server.serverMode.ws.filter.impl|org.apache.lens.server.ServerModeFilter|Implementation class for ServerMode Filter| +|68|lens.server.savedquery.ws.resource.impl|org.apache.lens.server.query.save.SavedQueryResource|Implementation class for Saved query Resource| *--+--+---+--+ -|69|lens.server.service.provider.factory|org.apache.lens.server.ServiceProviderFactoryImpl|Service provider factory implementation class. This parameter is used to lookup the factory implementation class name that would provide an instance of ServiceProvider. Users should instantiate the class to obtain its instance. Example -- Class spfClass = conf.getClass("lens.server.service.provider.factory", null, ServiceProviderFactory.class); ServiceProviderFactory spf = spfClass.newInstance(); ServiceProvider serviceProvider = spf.getServiceProvider(); -- This is not supposed to be overridden by users.| +|69|lens.server.scheduler.service.impl|org.apache.lens.server.scheduler.QuerySchedulerServiceImpl|Implementation class for query scheduler service| *--+--+---+--+ -|70|lens.server.servicenames|session,query,metastore,scheduler,quota|These services would be started in the specified order when lens-server starts up| +|70|lens.server.scheduler.ws.resource.impl|org.apache.lens.server.scheduler.ScheduleResource|Implementation class for query scheduler resource| *--+--+---+--+ -|71|lens.server.session.expiry.service.interval.secs|3600|Interval at which lens session expiry service runs| +|71|lens.server.scheduling.queue.poll.interval.millisec|2000|The interval at which submission thread will poll scheduling queue to fetch the next query for submission. If value is less than equal to 0, then it would mean that thread will continuosly poll without sleeping. The interval has to be given in milliseconds.| *--+--+---+--+ -|72|lens.server.session.service.impl|org.apache.lens.server.session.HiveSessionService|Implementation class for session service| +|72|lens.server.serverMode.ws.filter.impl|org.apache.lens.server.ServerModeFilter|Implementation class for ServerMode Filter| *--+--+---+--+ -|73|lens.server.session.timeout.seconds|86400|Lens session timeout in seconds.If there is no activity on the session for this period then the session will be closed.Default timeout is one day.| +|73|lens.server.service.provider.factory|org.apache.lens.server.ServiceProviderFactoryImpl|Service provider factory implementation class. This parameter is used to lookup the factory implementation class name that would provide an instance of ServiceProvider. Users should instantiate the class to obtain its instance. Example -- Class spfClass = conf.getClass("lens.server.service.provider.factory", null, ServiceProviderFactory.class); ServiceProviderFactory spf = spfClass.newInstance(); ServiceProvider serviceProvider = spf.getServiceProvider(); -- This is not supposed to be overridden by users.| *--+--+---+--+ -|74|lens.server.session.ws.resource.impl|org.apache.lens.server.session.SessionResource|Implementation class for Session Resource| +|74|lens.server.servicenames|session,query,metastore,scheduler,quota|These services would be started in the specified order when lens-server starts up| *--+--+---+--+ -|75|lens.server.snapshot.interval|300000|Snapshot interval time in miliseconds for saving lens server state.| +|75|lens.server.session.expiry.service.interval.secs|3600|Interval at which lens session expiry service runs| *--+--+---+--+ -|76|lens.server.state.persist.out.stream.buffer.size|1048576|Output Stream Buffer Size used in writing lens server state to file system. Size is in bytes.| +|76|lens.server.session.service.impl|org.apache.lens.server.session.HiveSessionService|Implementation class for session service| *--+--+---+--+ -|77|lens.server.statistics.db|lensstats|Database to which statistics tables are created and partitions are added.| +|77|lens.server.session.timeout.seconds|86400|Lens session timeout in seconds.If there is no activity on the session for this period then the session will be closed.Default timeout is one day.| *--+--+---+--+ -|78|lens.server.statistics.log.rollover.interval|3600000|Default rate which log statistics store scans for rollups in milliseconds.| +|78|lens.server.session.ws.resource.impl|org.apache.lens.server.session.SessionResource|Implementation class for Session Resource| *--+--+---+--+ -|79|lens.server.statistics.store.class|org.apache.lens.server.stats.store.log.LogStatisticsStore|Default implementation of class used to persist Lens Statistics.| +|79|lens.server.snapshot.interval|300000|Snapshot interval time in miliseconds for saving lens server state.| *--+--+---+--+ -|80|lens.server.statistics.warehouse.dir|file:///tmp/lens/statistics/warehouse|Default top level location where stats are moved by the log statistics store.| +|80|lens.server.state.persist.out.stream.buffer.size|1048576|Output Stream Buffer Size used in writing lens server state to file system. Size is in bytes.| *--+--+---+--+ -|81|lens.server.total.query.cost.ceiling.per.user|-1.0|A query submitted by user will be launched only if total query cost of all current launched queries of user is less than or equal to total query cost ceiling defined by this property. This configuration value is only useful when TotalQueryCostCeilingConstraint is enabled by using org.apache.lens.server.query.constraint.TotalQueryCostCeilingConstraintFactory as one of the factories in lens.server.query.constraint.factories property. Default is -1.0 which means that there is no limit on the total query cost of launched queries submitted by a user.| +|81|lens.server.statistics.db|lensstats|Database to which statistics tables are created and partitions are added.| *--+--+---+--+ -|82|lens.server.ui.base.uri|http://0.0.0.0:19999/|The base url for the Lens UI Server| +|82|lens.server.statistics.log.rollover.interval|3600000|Default rate which log statistics store scans for rollups in milliseconds.| *--+--+---+--+ -|83|lens.server.ui.enable|true|Bringing up the ui server is optional. By default it brings up UI server.| +|83|lens.server.statistics.store.class|org.apache.lens.server.stats.store.log.LogStatisticsStore|Default implementation of class used to persist Lens Statistics.| *--+--+---+--+ -|84|lens.server.ui.enable.caching|true|Set this to false to disable static file caching in the UI server| +|84|lens.server.statistics.warehouse.dir|file:///tmp/lens/statistics/warehouse|Default top level location where stats are moved by the log statistics store.| *--+--+---+--+ -|85|lens.server.ui.static.dir|webapp/lens-server/static|The base directory to server UI static files from| +|85|lens.server.total.query.cost.ceiling.per.user|-1.0|A query submitted by user will be launched only if total query cost of all current launched queries of user is less than or equal to total query cost ceiling defined by this property. This configuration value is only useful when TotalQueryCostCeilingConstraint is enabled by using org.apache.lens.server.query.constraint.TotalQueryCostCeilingConstraintFactory as one of the factories in lens.server.query.constraint.factories property. Default is -1.0 which means that there is no limit on the total query cost of launched queries submitted by a user.| *--+--+---+--+ -|86|lens.server.user.resolver.custom.class|full.package.name.Classname|Required for CUSTOM user resolver. In case the provided implementations are not sufficient for user config resolver, a custom classname can be provided. Class should extend org.apache.lens.server.user.UserConfigLoader| +|86|lens.server.ui.base.uri|http://0.0.0.0:19999/|The base url for the Lens UI Server| *--+--+---+--+ -|87|lens.server.user.resolver.db.keys|lens.session.cluster.user,mapred.job.queue.name|Required for DATABASE and LDAP_BACKED_DATABASE user resolvers. For database based user config loaders, the conf keys that will be loaded from database.| +|87|lens.server.ui.enable|true|Bringing up the ui server is optional. By default it brings up UI server.| *--+--+---+--+ -|88|lens.server.user.resolver.db.query|select clusteruser,queue from user_config_table where username=?|Required for DATABASE and LDAP_BACKED_DATABASE user resolvers. For database based user config loader, this query will be run with single argument = logged in user and the result columns will be assigned to lens.server.user.resolver.db.keys in order. For ldap backed database resolver, the argument to this query will be the intermediate values obtained from ldap.| +|88|lens.server.ui.enable.caching|true|Set this to false to disable static file caching in the UI server| *--+--+---+--+ -|89|lens.server.user.resolver.fixed.value| |Required for FIXED user resolver. when lens.server.user.resolver.type=FIXED, This will be the value cluster user will resolve to.| +|89|lens.server.ui.static.dir|webapp/lens-server/static|The base directory to server UI static files from| *--+--+---+--+ -|90|lens.server.user.resolver.ldap.bind.dn| |Required for LDAP_BACKED_DATABASE user resolvers. ldap dn for admin binding example: CN=company-it-admin,ou=service-account,ou=company-service-account,dc=dc1,dc=com...| +|90|lens.server.user.resolver.custom.class|full.package.name.Classname|Required for CUSTOM user resolver. In case the provided implementations are not sufficient for user config resolver, a custom classname can be provided. Class should extend org.apache.lens.server.user.UserConfigLoader| *--+--+---+--+ -|91|lens.server.user.resolver.ldap.bind.password| |Required for LDAP_BACKED_DATABASE user resolvers. ldap password for admin binding above| +|91|lens.server.user.resolver.db.keys|lens.session.cluster.user,mapred.job.queue.name|Required for DATABASE and LDAP_BACKED_DATABASE user resolvers. For database based user config loaders, the conf keys that will be loaded from database.| *--+--+---+--+ -|92|lens.server.user.resolver.ldap.fields|department|Required for LDAP_BACKED_DATABASE user resolvers. list of fields to be obtained from ldap. These will be cached by the intermediate db.| +|92|lens.server.user.resolver.db.query|select clusteruser,queue from user_config_table where username=?|Required for DATABASE and LDAP_BACKED_DATABASE user resolvers. For database based user config loader, this query will be run with single argument = logged in user and the result columns will be assigned to lens.server.user.resolver.db.keys in order. For ldap backed database resolver, the argument to this query will be the intermediate values obtained from ldap.| *--+--+---+--+ -|93|lens.server.user.resolver.ldap.intermediate.db.delete.sql|delete from user_department where username=?|Required for LDAP_BACKED_DATABASE user resolvers. query to delete intermediate values from database backing ldap as cache. one argument: logged in user.| +|93|lens.server.user.resolver.fixed.value| |Required for FIXED user resolver. when lens.server.user.resolver.type=FIXED, This will be the value cluster user will resolve to.| *--+--+---+--+ -|94|lens.server.user.resolver.ldap.intermediate.db.insert.sql|insert into user_department (username, department, expiry) values (?, ?, ?)|Required for LDAP_BACKED_DATABASE user resolvers. query to insert intermediate values from database backing ldap as cache. arguments: first logged in user, then all intermediate values, then current time + expiration time| +|94|lens.server.user.resolver.ldap.bind.dn| |Required for LDAP_BACKED_DATABASE user resolvers. ldap dn for admin binding example: CN=company-it-admin,ou=service-account,ou=company-service-account,dc=dc1,dc=com...| *--+--+---+--+ -|95|lens.server.user.resolver.ldap.intermediate.db.query|select department from user_department where username=? and expiry>?|Required for LDAP_BACKED_DATABASE user resolvers. query to obtain intermediate values from database backing ldap as cache. two arguments: logged in user and current time.| +|95|lens.server.user.resolver.ldap.bind.password| |Required for LDAP_BACKED_DATABASE user resolvers. ldap password for admin binding above| *--+--+---+--+ -|96|lens.server.user.resolver.ldap.search.base| |Required for LDAP_BACKED_DATABASE user resolvers. for searching intermediate values for a user, the search keys. example: cn=users,dc=dc1,dc=dc2...| +|96|lens.server.user.resolver.ldap.fields|department|Required for LDAP_BACKED_DATABASE user resolvers. list of fields to be obtained from ldap. These will be cached by the intermediate db.| *--+--+---+--+ -|97|lens.server.user.resolver.ldap.search.filter|(&(objectClass=user)(sAMAccountName=%s))|Required for LDAP_BACKED_DATABASE user resolvers. filter pattern for ldap search| +|97|lens.server.user.resolver.ldap.intermediate.db.delete.sql|delete from user_department where username=?|Required for LDAP_BACKED_DATABASE user resolvers. query to delete intermediate values from database backing ldap as cache. one argument: logged in user.| *--+--+---+--+ -|98|lens.server.user.resolver.ldap.url| |Required for LDAP_BACKED_DATABASE user resolvers. ldap url to connect to.| +|98|lens.server.user.resolver.ldap.intermediate.db.insert.sql|insert into user_department (username, department, expiry) values (?, ?, ?)|Required for LDAP_BACKED_DATABASE user resolvers. query to insert intermediate values from database backing ldap as cache. arguments: first logged in user, then all intermediate values, then current time + expiration time| *--+--+---+--+ -|99|lens.server.user.resolver.propertybased.filename|/path/to/propertyfile|Required for PROPERTYBASED user resolver. when lens.server.user.resolver.type is PROPERTYBASED, then this file will be read and parsed to determine cluster user. Each line should contain username followed by DOT followed by property full name followed by equal-to sign and followed by value. example schema of the file is: user1.lens.server.cluster.user=clusteruser1 user1.mapred.job.queue.name=queue1 *.lens.server.cluster.user=defaultclusteruser *.mapred.job.queue.name=default| +|99|lens.server.user.resolver.ldap.intermediate.db.query|select department from user_department where username=? and expiry>?|Required for LDAP_BACKED_DATABASE user resolvers. query to obtain intermediate values from database backing ldap as cache. two arguments: logged in user and current time.| *--+--+---+--+ -|100|lens.server.user.resolver.type|FIXED|Type of user config resolver. allowed values are FIXED, PROPERTYBASED, DATABASE, LDAP_BACKED_DATABASE, CUSTOM.| +|100|lens.server.user.resolver.ldap.search.base| |Required for LDAP_BACKED_DATABASE user resolvers. for searching intermediate values for a user, the search keys. example: cn=users,dc=dc1,dc=dc2...| *--+--+---+--+ -|101|lens.server.waiting.queries.selection.policy.factories|org.apache.lens.server.query.collect.UserSpecificWaitingQueriesSelectionPolicyFactory|Factories used to instantiate waiting queries selection policies. Every factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.collect.WaitingQueriesSelectionPolicy.| +|101|lens.server.user.resolver.ldap.search.filter|(&(objectClass=user)(sAMAccountName=%s))|Required for LDAP_BACKED_DATABASE user resolvers. filter pattern for ldap search| *--+--+---+--+ -|102|lens.server.ws.featurenames|multipart|These JAX-RS Feature(s) would be started in the specified order when lens-server starts up| +|102|lens.server.user.resolver.ldap.url| |Required for LDAP_BACKED_DATABASE user resolvers. ldap url to connect to.| *--+--+---+--+ -|103|lens.server.ws.filternames|authentication,consistentState,serverMode|These JAX-RS filters would be started in the specified order when lens-server starts up| +|103|lens.server.user.resolver.propertybased.filename|/path/to/propertyfile|Required for PROPERTYBASED user resolver. when lens.server.user.resolver.type is PROPERTYBASED, then this file will be read and parsed to determine cluster user. Each line should contain username followed by DOT followed by property full name followed by equal-to sign and followed by value. example schema of the file is: user1.lens.server.cluster.user=clusteruser1 user1.mapred.job.queue.name=queue1 *.lens.server.cluster.user=defaultclusteruser *.mapred.job.queue.name=default| *--+--+---+--+ -|104|lens.server.ws.listenernames|appevent|These listeners would be called in the specified order when lens-server starts up| +|104|lens.server.user.resolver.type|FIXED|Type of user config resolver. allowed values are FIXED, PROPERTYBASED, DATABASE, LDAP_BACKED_DATABASE, CUSTOM.| *--+--+---+--+ -|105|lens.server.ws.resourcenames|session,metastore,query,quota,scheduler,index,log|These JAX-RS resources would be started in the specified order when lens-server starts up| +|105|lens.server.waiting.queries.selection.policy.factories|org.apache.lens.server.query.collect.UserSpecificWaitingQueriesSelectionPolicyFactory|Factories used to instantiate waiting queries selection policies. Every factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.collect.WaitingQueriesSelectionPolicy.| *--+--+---+--+ -|106|lens.server.resultset.purge.enabled|false|Whether the query results will be purged| +|106|lens.server.ws.featurenames|multipart|These JAX-RS Feature(s) would be started in the specified order when lens-server starts up| *--+--+---+--+ -|107|lens.server.resultsetpurger.sleep.interval.secs|3600|Interval at which query result purger runs| +|107|lens.server.ws.filternames|authentication,consistentState,serverMode|These JAX-RS filters would be started in the specified order when lens-server starts up| *--+--+---+--+ -|108|lens.server.query.resultset.retention|1 day|Lens query resultset retention period in days| +|108|lens.server.ws.listenernames|appevent|These listeners would be called in the specified order when lens-server starts up| *--+--+---+--+ -|109|lens.server.hdfs.output.retention|1 day|Hdfs output retention period| +|109|lens.server.ws.resourcenames|session,metastore,query,quota,scheduler,index,log|These JAX-RS resources would be started in the specified order when lens-server starts up| *--+--+---+--+ The configuration parameters and their default values http://git-wip-us.apache.org/repos/asf/lens/blob/55b5223e/src/site/apt/admin/jdbcdriver-config.apt ---------------------------------------------------------------------- diff --git a/src/site/apt/admin/jdbcdriver-config.apt b/src/site/apt/admin/jdbcdriver-config.apt index 7b42309..8a2666f 100644 --- a/src/site/apt/admin/jdbcdriver-config.apt +++ b/src/site/apt/admin/jdbcdriver-config.apt @@ -34,52 +34,58 @@ Jdbc driver configuration *--+--+---+--+ |5|lens.cube.query.time.range.writer.class|org.apache.lens.cube.parse.BetweenTimeRangeWriter|The timerange writer class which specifies how the resolved partitions in timeranges should be written in final query. Available writers are org.apache.lens.cube.parse.ORTimeRangeWriter and org.apache.lens.cube.parse.BetweenTimeRangeWriter| *--+--+---+--+ -|6|lens.driver.jdbc.connection.provider| |A contract for obtaining JDBC connections| +|6|lens.driver.jdbc.connection.properties| |Connection properties for jdbc connection.| *--+--+---+--+ -|7|lens.driver.jdbc.db.password| |The database user's password| +|7|lens.driver.jdbc.connection.provider| |A contract for obtaining JDBC connections| *--+--+---+--+ -|8|lens.driver.jdbc.db.uri| |JDBC connection URL in the format jdbc:dbms://host:port/dbname| +|8|lens.driver.jdbc.db.password| |The database user's password| *--+--+---+--+ -|9|lens.driver.jdbc.db.user| |The database user on whose behalf the connection is being made| +|9|lens.driver.jdbc.db.uri| |JDBC connection URL in the format jdbc:dbms://host:port/dbname| *--+--+---+--+ -|10|lens.driver.jdbc.driver.class|com.mysql.jdbc.Driver|Type of JDBC driver used to connect backend database| +|10|lens.driver.jdbc.db.user| |The database user on whose behalf the connection is being made| *--+--+---+--+ -|11|lens.driver.jdbc.enable.resultset.streaming.retrieval|false|Flag to enable row by row retrieval of result set from the database server. This is used to enable streaming result sets for MySQL. This is set to false by default.| +|11|lens.driver.jdbc.driver.class|com.mysql.jdbc.Driver|Type of JDBC driver used to connect backend database| *--+--+---+--+ -|12|lens.driver.jdbc.estimate.db.password| |The database user's password, for estimate queries. If this property is unspecified, value for lens.driver.jdbc.db.password would be used. Override this property to tune estimate connection pool| +|12|lens.driver.jdbc.enable.resultset.streaming.retrieval|false|Flag to enable row by row retrieval of result set from the database server. This is used to enable streaming result sets for MySQL. This is set to false by default.| *--+--+---+--+ -|13|lens.driver.jdbc.estimate.db.uri| |JDBC connection URL in the format jdbc:dbms://host:port/dbname for estimate queries. If this property is unspecified, value for lens.driver.jdbc.db.uri will be used.| +|13|lens.driver.jdbc.estimate.connection.properties| |Connection properties for jdbc estimate connection.| *--+--+---+--+ -|14|lens.driver.jdbc.estimate.db.user| |The database user on whose behalf the connection is being made, for estimate queries. If this property is unspecified, value for lens.driver.jdbc.db.user would be used. Override this property to tune estimate connection pool| +|14|lens.driver.jdbc.estimate.db.password| |The database user's password, for estimate queries. If this property is unspecified, value for lens.driver.jdbc.db.password would be used. Override this property to tune estimate connection pool| *--+--+---+--+ -|15|lens.driver.jdbc.estimate.driver.class| |Type of JDBC driver used to connect backend database for estimate queries. If This property is not specified, value for lens.driver.jdbc.driver.class will be used. Override this property to tune estimate connection pool| +|15|lens.driver.jdbc.estimate.db.uri| |JDBC connection URL in the format jdbc:dbms://host:port/dbname for estimate queries. If this property is unspecified, value for lens.driver.jdbc.db.uri will be used.| *--+--+---+--+ -|16|lens.driver.jdbc.estimate.get.connection.timeout| |Response timeout in milliseconds of any JDBC call invoking data transmission over a connection socket , for estimate queries. If this property is not specified, value for lens.driver.jdbc.get.connection.timeout would be used. Override this property to tune estimate connection pool.| +|16|lens.driver.jdbc.estimate.db.user| |The database user on whose behalf the connection is being made, for estimate queries. If this property is unspecified, value for lens.driver.jdbc.db.user would be used. Override this property to tune estimate connection pool| *--+--+---+--+ -|17|lens.driver.jdbc.estimate.pool.idle.time| |Maximum idle time in sec before a connection is closed, for estimate queries. If this property is not specified, value for lens.driver.jdbc.pool.idle.time would be used. Override this property to tune estimate connection pool.| +|17|lens.driver.jdbc.estimate.driver.class| |Type of JDBC driver used to connect backend database for estimate queries. If This property is not specified, value for lens.driver.jdbc.driver.class will be used. Override this property to tune estimate connection pool| *--+--+---+--+ -|18|lens.driver.jdbc.estimate.pool.max.size| |Maximum number of concurrent connections allowed in pool, for estimate queries. If this property is unspecified, value for lens.driver.jdbc.pool.max.size would be used. Override this property to tune estimate connection pool| +|18|lens.driver.jdbc.estimate.get.connection.timeout| |Response timeout in milliseconds of any JDBC call invoking data transmission over a connection socket , for estimate queries. If this property is not specified, value for lens.driver.jdbc.get.connection.timeout would be used. Override this property to tune estimate connection pool.| *--+--+---+--+ -|19|lens.driver.jdbc.estimate.pool.max.statements| |Maximum number of prepared statements to cache per connection, for estimate queries. If this property is not specified, value for lens.driver.jdbc.pool.max.statements would be used.| +|19|lens.driver.jdbc.estimate.pool.idle.time| |Maximum idle time in sec before a connection is closed, for estimate queries. If this property is not specified, value for lens.driver.jdbc.pool.idle.time would be used. Override this property to tune estimate connection pool.| *--+--+---+--+ -|20|lens.driver.jdbc.explain.keyword|Explain|Explain keyword used to get the query plan of underlying database| +|20|lens.driver.jdbc.estimate.pool.max.size| |Maximum number of concurrent connections allowed in pool, for estimate queries. If this property is unspecified, value for lens.driver.jdbc.pool.max.size would be used. Override this property to tune estimate connection pool| *--+--+---+--+ -|21|lens.driver.jdbc.fetch.size|1000|Fetch size for JDBC result set| +|21|lens.driver.jdbc.estimate.pool.max.statements| |Maximum number of prepared statements to cache per connection, for estimate queries. If this property is not specified, value for lens.driver.jdbc.pool.max.statements would be used.| *--+--+---+--+ -|22|lens.driver.jdbc.get.connection.timeout|10000|Response timeout in milliseconds of any JDBC call invoking data transmission over a connection socket| +|22|lens.driver.jdbc.explain.keyword|Explain|Explain keyword used to get the query plan of underlying database| *--+--+---+--+ -|23|lens.driver.jdbc.pool.idle.time|600|Maximum idle time in sec before a connection is closed| +|23|lens.driver.jdbc.fetch.size|1000|Fetch size for JDBC result set| *--+--+---+--+ -|24|lens.driver.jdbc.pool.max.size|15|Maximum number of concurrent connections allowed in pool| +|24|lens.driver.jdbc.get.connection.timeout|10000|Response timeout in milliseconds of any JDBC call invoking data transmission over a connection socket| *--+--+---+--+ -|25|lens.driver.jdbc.pool.max.statements|20|Maximum number of prepared statements to cache per connection| +|25|lens.driver.jdbc.pool.idle.time|600|Maximum idle time in sec before a connection is closed| *--+--+---+--+ -|26|lens.driver.jdbc.query.launching.constraint.factories|org.apache.lens.server.api.query.constraint.MaxConcurrentDriverQueriesConstraintFactory|Factories used to instantiate constraints enforced on queries by driver. A query will be launched only if all constraints pass. Every Factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.constraint.QueryLaunchingConstraint.| +|26|lens.driver.jdbc.pool.max.size|15|Maximum number of concurrent connections allowed in pool| *--+--+---+--+ -|27|lens.driver.jdbc.query.rewriter|org.apache.lens.driver.jdbc.ColumnarSQLRewriter|Rewriting the HQL to optimized sql queries| +|27|lens.driver.jdbc.pool.max.statements|20|Maximum number of prepared statements to cache per connection| *--+--+---+--+ -|28|lens.driver.jdbc.validate.through.prepare|true|Flag to enable query syntactic and semantic validation using prepared statement.| +|28|lens.driver.jdbc.query.launching.constraint.factories|org.apache.lens.server.api.query.constraint.MaxConcurrentDriverQueriesConstraintFactory|Factories used to instantiate constraints enforced on queries by driver. A query will be launched only if all constraints pass. Every Factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.constraint.QueryLaunchingConstraint.| *--+--+---+--+ -|29|lens.driver.jdbc.waiting.queries.selection.policy.factories|org.apache.lens.server.api.query.collect.DriverSpecificWaitingQueriesSelectionPolicyFactory|Factories used to instantiate driver specific waiting queries selection policies. Every factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.collect.WaitingQueriesSelectionPolicy.| +|29|lens.driver.jdbc.query.rewriter|org.apache.lens.driver.jdbc.ColumnarSQLRewriter|Rewriting the HQL to optimized sql queries| +*--+--+---+--+ +|30|lens.driver.jdbc.regex.replacement.values|to_date=date, format_number=format, date_sub\((.*?)\,\s*([0-9]+\s*)\)=date_sub($1\, interval $2 day), date_add\((.*?)\,\s*([0-9]+\s*)\)=date_add($1\, interval $2 day)|Rewriting the HQL to optimized sql queries| +*--+--+---+--+ +|31|lens.driver.jdbc.validate.through.prepare|true|Flag to enable query syntactic and semantic validation using prepared statement.| +*--+--+---+--+ +|32|lens.driver.jdbc.waiting.queries.selection.policy.factories|org.apache.lens.server.api.query.collect.DriverSpecificWaitingQueriesSelectionPolicyFactory|Factories used to instantiate driver specific waiting queries selection policies. Every factory should be an implementation of org.apache.lens.server.api.common.ConfigBasedObjectCreationFactory and create an implementation of org.apache.lens.server.api.query.collect.WaitingQueriesSelectionPolicy.| *--+--+---+--+ The configuration parameters and their default values
