diff --git a/conf/openmetadata.yaml b/conf/openmetadata.yaml index efd66647e31..d1f78018ef8 100644 --- a/conf/openmetadata.yaml +++ b/conf/openmetadata.yaml @@ -243,6 +243,30 @@ database: rewriteBatchedStatements: ${DB_MYSQL_REWRITE_BATCHED_STATEMENTS:-true} # Critical for MySQL batch cachePrepStmts: ${DB_MYSQL_CACHE_PREP_STMTS:-true} prepStmtCacheSize: ${DB_MYSQL_PREP_STMT_CACHE_SIZE:-500} + + # AWS JDBC Driver specific properties for Aurora - these are ignored by other drivers + wrapperPlugins: ${DB_AWS_WRAPPER_PLUGINS:-readWriteSplitting,failover,efm2} + wrapperLoggerLevel: ${DB_AWS_WRAPPER_LOGGER_LEVEL:-INFO} + wrapperDialect: ${DB_AWS_WRAPPER_DIALECT:aurora-pg} + + # Aurora cluster identification + clusterId: ${DB_AWS_CLUSTER_ID:-} + clusterRegion: ${DB_AWS_CLUSTER_REGION:-} + + # Read/Write splitting configuration + readWriteSplitting.readerAny: ${DB_AWS_RWS_READER_ANY:-true} + readWriteSplitting.connectionPoolSize: ${DB_AWS_RWS_CONNECTION_POOL_SIZE:-10} + readWriteSplitting.maxIdleTime: ${DB_AWS_RWS_MAX_IDLE_TIME:-300000} + readWriteSplittingConnectionStrategy: ${DB_AWS_RWS_CONNECTION_STRATEGY:-leastConnections} + + # Failover configuration + failover.enableClusterAwareFailover: ${DB_AWS_FAILOVER_CLUSTER_AWARE:-true} + failover.clusterTopologyRefreshRateMs: ${DB_AWS_FAILOVER_TOPOLOGY_REFRESH_MS:-30000} + failover.readerFailoverTimeoutMs: ${DB_AWS_FAILOVER_READER_TIMEOUT_MS:-30000} + + # Enhanced Failure Monitoring + efm2.enable: ${DB_AWS_EFM_ENABLE:-true} + efm2.monitoringIntervalMs: ${DB_AWS_EFM_MONITORING_INTERVAL_MS:-5000} prepStmtCacheSqlLimit: ${DB_MYSQL_PREP_STMT_CACHE_SQL_LIMIT:-2048} useServerPrepStmts: ${DB_MYSQL_USE_SERVER_PREP_STMTS:-true} useLocalSessionState: ${DB_MYSQL_USE_LOCAL_SESSION_STATE:-true} diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/HikariCPDataSourceFactory.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/HikariCPDataSourceFactory.java index 304b601a54e..a55cd195b71 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/HikariCPDataSourceFactory.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/HikariCPDataSourceFactory.java @@ -238,17 +238,46 @@ public class HikariCPDataSourceFactory extends DataSourceFactory { private void configureAWSJDBCDriver(HikariConfig config) { Properties props = config.getDataSourceProperties(); - // AWS JDBC Driver specific properties for Aurora cluster discovery + // Set default AWS JDBC Driver properties props.put("wrapperPlugins", "readWriteSplitting,failover,efm2"); + props.put("wrapperLoggerLevel", "INFO"); + props.put("wrapperDialect", "aurora-pg"); - // Override properties from configuration if present + // Default read/write splitting configuration + props.put("readWriteSplitting.readerAny", "true"); + props.put("readWriteSplitting.connectionPoolSize", "10"); + props.put("readWriteSplitting.maxIdleTime", "300000"); + props.put("readWriteSplittingConnectionStrategy", "leastConnections"); + + // Default failover configuration + props.put("failover.enableClusterAwareFailover", "true"); + props.put("failover.clusterTopologyRefreshRateMs", "30000"); + props.put("failover.readerFailoverTimeoutMs", "30000"); + + // Default enhanced failure monitoring + props.put("efm2.enable", "true"); + props.put("efm2.monitoringIntervalMs", "5000"); + + // Override with AWS-specific properties from configuration Map properties = getProperties(); if (properties != null) { + // Only copy AWS JDBC driver specific properties for (Map.Entry entry : properties.entrySet()) { String key = entry.getKey(); - props.put(key, entry.getValue()); + if (key.startsWith("wrapper") + || key.startsWith("readWriteSplitting") + || key.startsWith("failover.") + || key.startsWith("efm2.") + || key.equals("clusterId") + || key.equals("clusterRegion")) { + props.put(key, entry.getValue()); + } } } + + // Remove conflicting PostgreSQL properties that prevent read replica usage + props.remove("targetServerType"); + props.remove("loadBalanceHosts"); } private void configureMySQL(HikariConfig config) {