diff --git a/client/conf/db.properties.in b/client/conf/db.properties.in index dd8f19cbbde..02628c8171c 100644 --- a/client/conf/db.properties.in +++ b/client/conf/db.properties.in @@ -30,9 +30,13 @@ db.cloud.port=3306 db.cloud.name=cloud # CloudStack database tuning parameters +db.cloud.connectionPoolLib=hikaricp db.cloud.maxActive=250 db.cloud.maxIdle=30 db.cloud.maxWait=600000 +db.cloud.minIdleConnections=5 +db.cloud.connectionTimeout=30000 +db.cloud.keepAliveTime=600000 db.cloud.validationQuery=/* ping */ SELECT 1 db.cloud.testOnBorrow=true db.cloud.testWhileIdle=true @@ -62,9 +66,13 @@ db.usage.port=3306 db.usage.name=cloud_usage # usage database tuning parameters +db.usage.connectionPoolLib=hikaricp db.usage.maxActive=100 db.usage.maxIdle=30 db.usage.maxWait=600000 +db.usage.minIdleConnections=5 +db.usage.connectionTimeout=30000 +db.usage.keepAliveTime=600000 db.usage.url.params=serverTimezone=UTC # Simulator database settings @@ -74,9 +82,13 @@ db.simulator.host=@DBHOST@ db.simulator.driver=@DBDRIVER@ db.simulator.port=3306 db.simulator.name=simulator +db.simulator.connectionPoolLib=hikaricp db.simulator.maxActive=250 db.simulator.maxIdle=30 db.simulator.maxWait=600000 +db.simulator.minIdleConnections=5 +db.simulator.connectionTimeout=30000 +db.simulator.keepAliveTime=600000 db.simulator.autoReconnect=true diff --git a/framework/db/pom.xml b/framework/db/pom.xml index cb285a2a36d..362083a1acb 100644 --- a/framework/db/pom.xml +++ b/framework/db/pom.xml @@ -36,6 +36,10 @@ org.eclipse.persistence javax.persistence + + org.apache.commons + commons-dbcp2 + com.zaxxer HikariCP diff --git a/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java b/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java index 5409ea6e70a..d1db6770cd7 100644 --- a/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java +++ b/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java @@ -33,14 +33,23 @@ import java.util.concurrent.atomic.AtomicLong; import javax.sql.DataSource; -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; +import org.apache.commons.dbcp2.ConnectionFactory; +import org.apache.commons.dbcp2.DriverManagerConnectionFactory; +import org.apache.commons.dbcp2.PoolableConnection; +import org.apache.commons.dbcp2.PoolableConnectionFactory; +import org.apache.commons.dbcp2.PoolingDataSource; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.pool2.ObjectPool; +import org.apache.commons.pool2.impl.GenericObjectPool; +import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.apache.log4j.Logger; import com.cloud.utils.Pair; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.mgmt.JmxUtil; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; /** * Transaction abstracts away the Connection object in JDBC. It allows the @@ -88,6 +97,8 @@ public class TransactionLegacy implements Closeable { } } + private static final String CONNECTION_POOL_LIB_DBCP = "dbcp"; + private final LinkedList _stack; private long _id; @@ -1013,6 +1024,21 @@ public class TransactionLegacy implements Closeable { } } + private static T parseNumber(String value, Class type) { + if (value == null) { + return null; + } + try { + if (type.equals(Long.class)) { + return type.cast(Long.parseLong(value)); + } else { + return type.cast(Integer.parseInt(value)); + } + } catch (NumberFormatException ignored) { + return null; + } + } + @SuppressWarnings({"rawtypes", "unchecked"}) public static void initDataSource(Properties dbProps) { try { @@ -1023,9 +1049,12 @@ public class TransactionLegacy implements Closeable { s_logger.info("Is Data Base High Availiability enabled? Ans : " + s_dbHAEnabled); String loadBalanceStrategy = dbProps.getProperty("db.ha.loadBalanceStrategy"); // FIXME: If params are missing...default them???? - final int cloudMaxActive = Integer.parseInt(dbProps.getProperty("db.cloud.maxActive")); - final int cloudMaxIdle = Integer.parseInt(dbProps.getProperty("db.cloud.maxIdle")); - final long cloudMaxWait = Long.parseLong(dbProps.getProperty("db.cloud.maxWait")); + final Integer cloudMaxActive = parseNumber(dbProps.getProperty("db.cloud.maxActive"), Integer.class); + final Integer cloudMaxIdle = parseNumber(dbProps.getProperty("db.cloud.maxIdle"), Integer.class); + final Long cloudMaxWait = parseNumber(dbProps.getProperty("db.cloud.maxWait"), Long.class); + final Integer cloudMinIdleConnections = parseNumber(dbProps.getProperty("db.cloud.minIdleConnections"), Integer.class); + final Long cloudConnectionTimeout = parseNumber(dbProps.getProperty("db.cloud.connectionTimeout"), Long.class); + final Long cloudKeepAliveTimeout = parseNumber(dbProps.getProperty("db.cloud.keepAliveTime"), Long.class); final String cloudUsername = dbProps.getProperty("db.cloud.username"); final String cloudPassword = dbProps.getProperty("db.cloud.password"); final String cloudHost = dbProps.getProperty("db.cloud.host"); @@ -1080,14 +1109,19 @@ public class TransactionLegacy implements Closeable { DriverLoader.loadDriver(cloudDriver); // Default Data Source for CloudStack - s_ds = createDataSource(cloudConnectionUri, cloudUsername, cloudPassword, cloudMaxActive, cloudMaxIdle, cloudMaxWait, - cloudTimeBtwEvictionRunsMillis, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle, cloudTestOnBorrow, - cloudValidationQuery, isolationLevel, "cloud"); + s_ds = createDataSource(dbProps.getProperty("db.cloud.connectionPoolLib"), cloudConnectionUri, + cloudUsername, cloudPassword, cloudMaxActive, cloudMaxIdle, cloudMaxWait, + cloudTimeBtwEvictionRunsMillis, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle, + cloudTestOnBorrow, cloudValidationQuery, cloudMinIdleConnections, cloudConnectionTimeout, + cloudKeepAliveTimeout, isolationLevel, "cloud"); // Configure the usage db - final int usageMaxActive = Integer.parseInt(dbProps.getProperty("db.usage.maxActive")); - final int usageMaxIdle = Integer.parseInt(dbProps.getProperty("db.usage.maxIdle")); - final long usageMaxWait = Long.parseLong(dbProps.getProperty("db.usage.maxWait")); + final Integer usageMaxActive = parseNumber(dbProps.getProperty("db.usage.maxActive"), Integer.class); + final Integer usageMaxIdle = parseNumber(dbProps.getProperty("db.usage.maxIdle"), Integer.class); + final Long usageMaxWait = parseNumber(dbProps.getProperty("db.usage.maxWait"), Long.class); + final Integer usageMinIdleConnections = parseNumber(dbProps.getProperty("db.usage.minIdleConnections"), Integer.class); + final Long usageConnectionTimeout = parseNumber(dbProps.getProperty("db.usage.connectionTimeout"), Long.class); + final Long usageKeepAliveTimeout = parseNumber(dbProps.getProperty("db.usage.keepAliveTime"), Long.class); final String usageUsername = dbProps.getProperty("db.usage.username"); final String usagePassword = dbProps.getProperty("db.usage.password"); final String usageHost = dbProps.getProperty("db.usage.host"); @@ -1103,15 +1137,19 @@ public class TransactionLegacy implements Closeable { DriverLoader.loadDriver(usageDriver); // Data Source for usage server - s_usageDS = createDataSource(usageConnectionUri, usageUsername, usagePassword, - usageMaxActive, usageMaxIdle, usageMaxWait, null, null, null, null, - null, isolationLevel, "usage"); + s_usageDS = createDataSource(dbProps.getProperty("db.usage.connectionPoolLib"), usageConnectionUri, + usageUsername, usagePassword, usageMaxActive, usageMaxIdle, usageMaxWait, null, + null, null, null, null, + usageMinIdleConnections, usageConnectionTimeout, usageKeepAliveTimeout, isolationLevel, "usage"); try { // Configure the simulator db - final int simulatorMaxActive = Integer.parseInt(dbProps.getProperty("db.simulator.maxActive")); - final int simulatorMaxIdle = Integer.parseInt(dbProps.getProperty("db.simulator.maxIdle")); - final long simulatorMaxWait = Long.parseLong(dbProps.getProperty("db.simulator.maxWait")); + final Integer simulatorMaxActive = parseNumber(dbProps.getProperty("db.simulator.maxActive"), Integer.class); + final Integer simulatorMaxIdle = parseNumber(dbProps.getProperty("db.simulator.maxIdle"), Integer.class); + final Long simulatorMaxWait = parseNumber(dbProps.getProperty("db.simulator.maxWait"), Long.class); + final Integer simulatorMinIdleConnections = parseNumber(dbProps.getProperty("db.simulator.minIdleConnections"), Integer.class); + final Long simulatorConnectionTimeout = parseNumber(dbProps.getProperty("db.simulator.connectionTimeout"), Long.class); + final Long simulatorKeepAliveTimeout = parseNumber(dbProps.getProperty("db.simulator.keepAliveTime"), Long.class); final String simulatorUsername = dbProps.getProperty("db.simulator.username"); final String simulatorPassword = dbProps.getProperty("db.simulator.password"); final String simulatorHost = dbProps.getProperty("db.simulator.host"); @@ -1124,15 +1162,18 @@ public class TransactionLegacy implements Closeable { simulatorAutoReconnect; DriverLoader.loadDriver(simulatorDriver); - s_simulatorDS = createDataSource(simulatorConnectionUri, simulatorUsername, simulatorPassword, - simulatorMaxActive, simulatorMaxIdle, simulatorMaxWait, null, null, null, null, cloudValidationQuery, isolationLevel, "simulator"); + s_simulatorDS = createDataSource(dbProps.getProperty("db.simulator.connectionPoolLib"), + simulatorConnectionUri, simulatorUsername, simulatorPassword, simulatorMaxActive, + simulatorMaxIdle, simulatorMaxWait, null, null, null, null, + cloudValidationQuery, simulatorMinIdleConnections, simulatorConnectionTimeout, + simulatorKeepAliveTimeout, isolationLevel, "simulator"); } catch (Exception e) { s_logger.debug("Simulator DB properties are not available. Not initializing simulator DS"); } } catch (final Exception e) { - s_ds = getDefaultDataSource("cloud"); - s_usageDS = getDefaultDataSource("cloud_usage"); - s_simulatorDS = getDefaultDataSource("simulator"); + s_ds = getDefaultDataSource(dbProps.getProperty("db.cloud.connectionPoolLib"), "cloud"); + s_usageDS = getDefaultDataSource(dbProps.getProperty("db.usage.connectionPoolLib"), "cloud_usage"); + s_simulatorDS = getDefaultDataSource(dbProps.getProperty("db.simulator.connectionPoolLib"), "simulator"); s_logger.warn( "Unable to load db configuration, using defaults with 5 connections. Falling back on assumed datasource on localhost:3306 using username:password=cloud:cloud. Please check your configuration", e); @@ -1142,45 +1183,38 @@ public class TransactionLegacy implements Closeable { /** * Creates a data source */ - private static DataSource createDataSource(String uri, String username, String password, + private static DataSource createDataSource(String connectionPoolLib, String uri, String username, String password, + Integer maxActive, Integer maxIdle, Long maxWait, Long timeBtwnEvictionRuns, Long minEvictableIdleTime, + Boolean testWhileIdle, Boolean testOnBorrow, String validationQuery, Integer minIdleConnections, + Long connectionTimeout, Long keepAliveTime, Integer isolationLevel, String dsName) { + s_logger.debug(String.format("Creating datasource for database: %s with connection pool lib: %s", dsName, + connectionPoolLib)); + if (CONNECTION_POOL_LIB_DBCP.equals(connectionPoolLib)) { + return createDbcpDataSource(uri, username, password, maxActive, maxIdle, maxWait, timeBtwnEvictionRuns, + minEvictableIdleTime, testWhileIdle, testOnBorrow, validationQuery, isolationLevel); + } + return createHikaricpDataSource(uri, username, password, maxActive, maxIdle, maxWait, minIdleConnections, + connectionTimeout, keepAliveTime, isolationLevel, dsName); + } + + private static DataSource createHikaricpDataSource(String uri, String username, String password, Integer maxActive, Integer maxIdle, Long maxWait, - Long timeBtwnEvictionRuns, Long minEvictableIdleTime, - Boolean testWhileIdle, Boolean testOnBorrow, - String validationQuery, Integer isolationLevel, - String dsName) { + Integer minIdleConnections, Long connectionTimeout, Long keepAliveTime, + Integer isolationLevel, String dsName) { HikariConfig config = new HikariConfig(); config.setJdbcUrl(uri); config.setUsername(username); config.setPassword(password); - //int numOfCores = Runtime.getRuntime().availableProcessors(); - //config.setMaximumPoolSize(numOfCores * 4 + 16); - if (maxActive != null) { - config.setMaximumPoolSize(maxActive); - } else { - config.setMaximumPoolSize(250); // 250 connections - } - - if (maxIdle != null) { - config.setIdleTimeout(maxIdle * 1000); - } else { - config.setIdleTimeout(30000); // 30 seconds - } - if (maxWait != null) { - config.setMaxLifetime(maxWait); - } else { - config.setMaxLifetime(600000); // 10 minutes - } - - config.setPoolName("hikaricp-pool-" + dsName); + config.setPoolName(dsName); // Connection pool properties - config.setMinimumIdle(5); // Minimum number of idle connections in the pool - config.setConnectionTimeout(30000); // 30 seconds in milliseconds - config.setKeepaliveTime(600000); // Keepalive time in milliseconds (10 minutes) - config.setIdleTimeout(300000); // 5 minutes - //config.setMinimumIdle(maxIdle); - //config.setConnectionTestQuery("/* ping */ SELECT 1"); // Connection test query + config.setMaximumPoolSize(ObjectUtils.defaultIfNull(maxActive, 250)); + config.setIdleTimeout(ObjectUtils.defaultIfNull(maxIdle, 30) * 1000); + config.setMaxLifetime(ObjectUtils.defaultIfNull(maxWait, 600000L)); + config.setMinimumIdle(ObjectUtils.defaultIfNull(minIdleConnections, 5)); + config.setConnectionTimeout(ObjectUtils.defaultIfNull(connectionTimeout, 30000L)); + config.setKeepaliveTime(ObjectUtils.defaultIfNull(keepAliveTime, 600000L)); String isolationLevelString = "TRANSACTION_READ_COMMITTED"; if (isolationLevel == Connection.TRANSACTION_SERIALIZABLE) { @@ -1198,19 +1232,62 @@ public class TransactionLegacy implements Closeable { config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); // Additional config for MySQL config.addDataSourceProperty("useServerPrepStmts", "true"); - /* config.addDataSourceProperty("useLocalSessionState", "true"); config.addDataSourceProperty("rewriteBatchedStatements", "true"); config.addDataSourceProperty("cacheResultSetMetadata", "true"); config.addDataSourceProperty("cacheServerConfiguration", "true"); config.addDataSourceProperty("elideSetAutoCommits", "true"); config.addDataSourceProperty("maintainTimeStats", "false"); - */ HikariDataSource dataSource = new HikariDataSource(config); return dataSource; + } + + private static DataSource createDbcpDataSource(String uri, String username, String password, + Integer maxActive, Integer maxIdle, Long maxWait, + Long timeBtwnEvictionRuns, Long minEvictableIdleTime, + Boolean testWhileIdle, Boolean testOnBorrow, + String validationQuery, Integer isolationLevel) { + ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(uri, username, password); + PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null); + GenericObjectPoolConfig config = createPoolConfig(maxActive, maxIdle, maxWait, timeBtwnEvictionRuns, minEvictableIdleTime, testWhileIdle, testOnBorrow); + ObjectPool connectionPool = new GenericObjectPool<>(poolableConnectionFactory, config); + poolableConnectionFactory.setPool(connectionPool); + if (validationQuery != null) { + poolableConnectionFactory.setValidationQuery(validationQuery); + } + if (isolationLevel != null) { + poolableConnectionFactory.setDefaultTransactionIsolation(isolationLevel); + } + return new PoolingDataSource<>(connectionPool); } + /** + * Return a GenericObjectPoolConfig configuration usable on connection pool creation + */ + private static GenericObjectPoolConfig createPoolConfig(Integer maxActive, Integer maxIdle, Long maxWait, + Long timeBtwnEvictionRuns, Long minEvictableIdleTime, + Boolean testWhileIdle, Boolean testOnBorrow) { + GenericObjectPoolConfig config = new GenericObjectPoolConfig(); + config.setMaxTotal(maxActive); + config.setMaxIdle(maxIdle); + config.setMaxWaitMillis(maxWait); + + if (timeBtwnEvictionRuns != null) { + config.setTimeBetweenEvictionRunsMillis(timeBtwnEvictionRuns); + } + if (minEvictableIdleTime != null) { + config.setMinEvictableIdleTimeMillis(minEvictableIdleTime); + } + if (testWhileIdle != null) { + config.setTestWhileIdle(testWhileIdle); + } + if (testOnBorrow != null) { + config.setTestOnBorrow(testOnBorrow); + } + return config; + } + @SuppressWarnings({"unchecked", "rawtypes"}) private static DataSource getDefaultDataSource(final String database) { HikariConfig config = new HikariConfig(); @@ -1232,6 +1309,44 @@ public class TransactionLegacy implements Closeable { return new HikariDataSource(config); } + private static DataSource getDefaultDataSource(final String connectionPoolLib, final String database) { + s_logger.debug(String.format("Creating default datasource for database: %s with connection pool lib: %s", + database, connectionPoolLib)); + if (CONNECTION_POOL_LIB_DBCP.equalsIgnoreCase(connectionPoolLib)) { + return getDefaultDbcpDataSource(database); + } + return getDefaultHikaricpDataSource(database); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private static DataSource getDefaultHikaricpDataSource(final String database) { + HikariConfig config = new HikariConfig(); + config.setJdbcUrl("jdbc:mysql://localhost:3306/" + database + "?" + CONNECTION_PARAMS); + config.setUsername("cloud"); + config.setPassword("cloud"); + config.setPoolName(database); + config.setDriverClassName("com.mysql.cj.jdbc.Driver"); + config.setMaximumPoolSize(250); + config.setConnectionTimeout(1000); + config.setIdleTimeout(1000); + config.setKeepaliveTime(1000); + config.setMaxLifetime(1000); + config.setTransactionIsolation("TRANSACTION_READ_COMMITTED"); + config.setInitializationFailTimeout(-1L); + config.addDataSourceProperty("cachePrepStmts", "true"); + config.addDataSourceProperty("prepStmtCacheSize", "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + return new HikariDataSource(config); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private static DataSource getDefaultDbcpDataSource(final String database) { + final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://localhost:3306/" + database + "?" + CONNECTION_PARAMS, "cloud", "cloud"); + final PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory, null); + final GenericObjectPool connectionPool = new GenericObjectPool(poolableConnectionFactory); + return new PoolingDataSource(connectionPool); + } + private static String getDBHAParams(String dbName, Properties dbProps) { StringBuilder sb = new StringBuilder(); sb.append("failOverReadOnly=" + dbProps.getProperty("db." + dbName + ".failOverReadOnly")); diff --git a/plugins/network-elements/tungsten/pom.xml b/plugins/network-elements/tungsten/pom.xml index a23c2930c95..9bf67cbcf85 100644 --- a/plugins/network-elements/tungsten/pom.xml +++ b/plugins/network-elements/tungsten/pom.xml @@ -48,5 +48,10 @@ mysql-connector-java test + + mysql + mysql-connector-java + test + diff --git a/pom.xml b/pom.xml index 1be1947330b..70b69d9263d 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,7 @@ 1.6 1.10 1.3.3 + 2.9.0 5.1.0 0.5 2.6 @@ -361,6 +362,17 @@ commons-daemon ${cs.daemon.version} + + org.apache.commons + commons-dbcp2 + ${cs.dbcp.version} + + + org.apache.commons + commons-pool2 + + + com.zaxxer HikariCP diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue index f78b4cc0db4..c2f5ac3c3d6 100644 --- a/ui/src/components/view/ListView.vue +++ b/ui/src/components/view/ListView.vue @@ -617,11 +617,7 @@ export default { }).then(json => { this.editableValueKey = null this.$store.dispatch('RefreshFeatures') - var message = `${this.$t('message.setting.updated')} ${record.name}` - if (record.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('message.setting.updated')} ${record.name}`, record) if (json.updateconfigurationresponse && json.updateconfigurationresponse.configuration && !json.updateconfigurationresponse.configuration.isdynamic && @@ -642,11 +638,7 @@ export default { api('resetConfiguration', { name: item.name }).then(() => { - var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}` - if (item.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}`, item) }).catch(error => { console.error(error) this.$message.error(this.$t('message.error.reset.config')) diff --git a/ui/src/components/view/SettingsTab.vue b/ui/src/components/view/SettingsTab.vue index f0812c3a8ad..be74e7b32dd 100644 --- a/ui/src/components/view/SettingsTab.vue +++ b/ui/src/components/view/SettingsTab.vue @@ -175,10 +175,7 @@ export default { value: this.editableValue }).then(() => { var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.update.to')} ${this.editableValue}` - if (item.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.handleSuccessMessage(item.name, this.$route.meta.name, message) + this.handleSuccessMessage(item, this.$route.meta.name, message) }).catch(error => { console.error(error) this.$message.error(this.$t('message.error.save.setting')) @@ -208,10 +205,7 @@ export default { name: item.name }).then(() => { var message = `${this.$t('label.setting')} ${item.name} ${this.$t('label.reset.config.value')}` - if (item.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.handleSuccessMessage(item.name, this.$route.meta.name, message) + this.handleSuccessMessage(item, this.$route.meta.name, message) }).catch(error => { console.error(error) this.$message.error(this.$t('message.error.reset.config')) @@ -226,12 +220,16 @@ export default { }) }) }, - handleSuccessMessage (name, scope, message) { - var obj = this.warningMessages[name] + handleSuccessMessage (config, scope, message) { + var obj = this.warningMessages[config.name] if (obj && obj.scope === scope) { - this.$warning({ title: message, content: obj.warning }) + var content = obj.warning + if (config.isdynamic) { + content = `this.$t('message.setting.update.delay').\n ${content}` + } + this.$warning({ title: message, content: content }) } else { - this.$message.success(message) + this.$messageConfigSuccess(message, config) } } } diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js index 7ab18e8c688..45684e5f52b 100644 --- a/ui/src/utils/plugins.js +++ b/ui/src/utils/plugins.js @@ -288,6 +288,13 @@ export const notifierPlugin = { close: (key) => notification.close(key), destroy: () => notification.destroy() } + + app.config.globalProperties.$messageConfigSuccess = function (msg, configrecord) { + if (configrecord.isdynamic) { + msg += `. ${this.$t('message.setting.update.delay')}` + } + message.success(msg) + } } } diff --git a/ui/src/views/setting/ConfigurationValue.vue b/ui/src/views/setting/ConfigurationValue.vue index a4683a37567..824f2ba9b86 100644 --- a/ui/src/views/setting/ConfigurationValue.vue +++ b/ui/src/views/setting/ConfigurationValue.vue @@ -250,11 +250,7 @@ export default { this.actualValue = this.editableValue this.$emit('change-config', { value: newValue }) this.$store.dispatch('RefreshFeatures') - var message = `${this.$t('message.setting.updated')} ${configrecord.name}` - if (configrecord.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('message.setting.updated')} ${configrecord.name}`, configrecord) if (json.updateconfigurationresponse && json.updateconfigurationresponse.configuration && !json.updateconfigurationresponse.configuration.isdynamic && @@ -291,11 +287,7 @@ export default { } this.$emit('change-config', { value: newValue }) this.$store.dispatch('RefreshFeatures') - var message = `${this.$t('label.setting')} ${configrecord.name} ${this.$t('label.reset.config.value')}` - if (configrecord.isdynamic) { - message += `. ${this.$t('message.setting.update.delay')}` - } - this.$message.success(message) + this.$messageConfigSuccess(`${this.$t('label.setting')} ${configrecord.name} ${this.$t('label.reset.config.value')}`, configrecord) if (json.resetconfigurationresponse && json.resetconfigurationresponse.configuration && !json.resetconfigurationresponse.configuration.isdynamic && diff --git a/usage/conf/db.properties.in b/usage/conf/db.properties.in index 35a40def7b1..c597bb9fad3 100644 --- a/usage/conf/db.properties.in +++ b/usage/conf/db.properties.in @@ -24,7 +24,11 @@ db.usage.port=3306 db.usage.name=cloud_usage # usage database tuning parameters +db.usage.connectionPoolLib=hikaricp db.usage.maxActive=100 db.usage.maxIdle=30 db.usage.maxWait=10000 +db.usage.minIdleConnections=5 +db.usage.connectionTimeout=30000 +db.usage.keepAliveTime=600000 db.usage.autoReconnect=true