Skip to content

Commit

Permalink
use efm2 plugin by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiyvamz committed Jan 16, 2024
1 parent 7367f51 commit 44caf79
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ Properties useAuroraHostListAndReadWriteSplittingPluginWithReaderLoadBalancing()

Properties useTelemetry() {
final Properties properties = new Properties();
properties.setProperty("wrapperPlugins", "dataCache,auroraHostList,efm");
properties.setProperty("wrapperPlugins", "dataCache,auroraHostList,efm2");
properties.setProperty("enableTelemetry", "true");
properties.setProperty("telemetryMetricsBackend", "none");
properties.setProperty("telemetryTracesBackend", "none");
Expand All @@ -395,7 +395,7 @@ Properties useTelemetry() {

Properties disabledTelemetry() {
final Properties properties = new Properties();
properties.setProperty("wrapperPlugins", "dataCache,auroraHostList,efm");
properties.setProperty("wrapperPlugins", "dataCache,auroraHostList,efm2");
properties.setProperty("enableTelemetry", "false");
return properties;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/using-the-jdbc-driver/UsingTheJdbcDriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ Plugins are loaded and managed through the Connection Plugin Manager and may be

| Parameter | Value | Required | Description | Default Value |
|-----------------------------------|-----------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| `wrapperPlugins` | `String` | No | Comma separated list of connection plugin codes. <br><br>Example: `failover,efm` | `auroraConnectionTracker,failover,efm` |
| `wrapperPlugins` | `String` | No | Comma separated list of connection plugin codes. <br><br>Example: `failover,efm2` | `auroraConnectionTracker,failover,efm` |
| `autoSortWrapperPluginOrder` | `Boolean` | No | Allows the AWS JDBC Driver to sort connection plugins to prevent plugin misconfiguration. Allows a user to provide a custom plugin order if needed. | `true` |
| `wrapperProfileName` | `String` | No | Driver configuration profile name. Instead of listing plugin codes with `wrapperPlugins`, the driver profile can be set with this parameter. <br><br> Example: See [below](#configuration-profiles). | `null` |

To use a built-in plugin, specify its relevant plugin code for the `wrapperPlugins`.
The default value for `wrapperPlugins` is `auroraConnectionTracker,failover,efm`. These 3 plugins are enabled by default. To read more about these plugins, see the [List of Available Plugins](#list-of-available-plugins) section.
The default value for `wrapperPlugins` is `auroraConnectionTracker,failover,efm2`. These 3 plugins are enabled by default. To read more about these plugins, see the [List of Available Plugins](#list-of-available-plugins) section.
To override the default plugins, simply provide a new value for `wrapperPlugins`.
For instance, to use the [IAM Authentication Connection Plugin](./using-plugins/UsingTheIamAuthenticationPlugin.md) and the [Failover Connection Plugin](./using-plugins/UsingTheFailoverPlugin.md):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static void main(String[] args) throws SQLException {
Properties targetDataSourceProps = new Properties();

// Enable the IAM authentication plugin along with failover and host monitoring plugins.
targetDataSourceProps.setProperty("wrapperPlugins", "iam,failover,efm");
targetDataSourceProps.setProperty("wrapperPlugins", "iam,failover,efm2");

ds.addDataSourceProperty("targetDataSourceProperties", targetDataSourceProps);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void main(String[] args) throws SQLException {
final Properties properties = new Properties();
properties.setProperty("user", USERNAME);
properties.setProperty("password", PASSWORD);
PropertyDefinition.PLUGINS.set(properties, "driverMetaData,failover,efm");
PropertyDefinition.PLUGINS.set(properties, "driverMetaData,failover,efm2");

// DriverMetaDataConnectionPlugin Settings
// Override the return value of DatabaseMetaData#getDriverName to "PostgreSQL JDBC Driver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class PgConnectionSample {
// + "?user=username"
// + "&password=password"
// + "&loginTimeout=100"
// + "&wrapperPlugins=failover,efm"
// + "&wrapperPlugins=failover,efm2"
// + "&wrapperLogUnclosedConnections=true";
private static final String USERNAME = "username";
private static final String PASSWORD = "password";
Expand All @@ -49,7 +49,7 @@ public static void main(String[] args) throws SQLException {
properties.setProperty("loginTimeout", "100");

// Configuring connection properties for the JDBC Wrapper.
properties.setProperty("wrapperPlugins", "failover,efm");
properties.setProperty("wrapperPlugins", "failover,efm2");
properties.setProperty("wrapperLogUnclosedConnections", "true");

try (Connection conn = DriverManager.getConnection(CONNECTION_STRING, properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public static void main(String[] args) throws SQLException {

final Properties props = new Properties();

// Enable readWriteSplitting, failover, and efm plugins and set properties
props.setProperty(PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm");
// Enable readWriteSplitting, failover, and efm2 plugins and set properties
props.setProperty(PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm2");
props.setProperty(PropertyDefinition.USER.name, USERNAME);
props.setProperty(PropertyDefinition.PASSWORD.name, PASSWORD);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public static void main(String[] args) throws SQLException {

final Properties props = new Properties();

// Enable readWriteSplitting, failover, and efm plugins and set properties
props.setProperty(PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm");
// Enable readWriteSplitting, failover, and efm2 plugins and set properties
props.setProperty(PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm2");
props.setProperty(PropertyDefinition.USER.name, USERNAME);
props.setProperty(PropertyDefinition.PASSWORD.name, PASSWORD);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static DataSource getSimpleMySQLDataSource() {

Properties targetDataSourceProps = new Properties();
targetDataSourceProps.setProperty(
PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm");
PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm2");

ds.setUser(USERNAME);
ds.setPassword(PASSWORD);
Expand Down Expand Up @@ -118,7 +118,7 @@ private static DataSource getHikariCPDataSource() {

Properties targetDataSourceProps = new Properties();
targetDataSourceProps.setProperty(PropertyDefinition.PLUGINS.name,
"readWriteSplitting,failover,efm");
"readWriteSplitting,failover,efm2");

ds.addDataSourceProperty("targetDataSourceProperties", targetDataSourceProps);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static DataSource getSimplePostgresDataSource() {

Properties targetDataSourceProps = new Properties();
targetDataSourceProps.setProperty(
PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm");
PropertyDefinition.PLUGINS.name, "readWriteSplitting,failover,efm2");

ds.setUser(USERNAME);
ds.setPassword(PASSWORD);
Expand Down Expand Up @@ -117,7 +117,7 @@ private static DataSource getHikariCPDataSource() {

Properties targetDataSourceProps = new Properties();
targetDataSourceProps.setProperty(PropertyDefinition.PLUGINS.name,
"readWriteSplitting,failover,efm");
"readWriteSplitting,failover,efm2");

ds.addDataSourceProperty("targetDataSourceProperties", targetDataSourceProps);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void main(String[] args) throws SQLException {

// Properties
final Properties properties = new Properties();
properties.setProperty(PropertyDefinition.PLUGINS.name, "dataCache, efm, failover");
properties.setProperty(PropertyDefinition.PLUGINS.name, "dataCache,efm2,failover");
properties.setProperty(PropertyDefinition.USER.name, USERNAME);
properties.setProperty(PropertyDefinition.PASSWORD.name, PASSWORD);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void main(String[] args) throws SQLException {

// Properties
final Properties properties = new Properties();
properties.setProperty(PropertyDefinition.PLUGINS.name, "dataCache, efm, failover");
properties.setProperty(PropertyDefinition.PLUGINS.name, "dataCache,efm2,failover");
properties.setProperty(PropertyDefinition.USER.name, USERNAME);
properties.setProperty(PropertyDefinition.PASSWORD.name, PASSWORD);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void main(String[] args) throws SQLException {
// targetDataSourceProps.setProperty("ssl", "true");

// Enable the failover and host monitoring connection plugins.
targetDataSourceProps.setProperty("wrapperPlugins", "failover,efm");
targetDataSourceProps.setProperty("wrapperPlugins", "failover,efm2");

ds.addDataSourceProperty("targetDataSourceProperties", targetDataSourceProps);

Expand Down
4 changes: 2 additions & 2 deletions examples/SpringBootHikariExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spring:
driver-class-name: software.amazon.jdbc.Driver
hikari:
data-source-properties:
wrapperPlugins: failover,efm
wrapperPlugins: failover,efm2
wrapperDialect: aurora-pg
exception-override-class-name: software.amazon.jdbc.util.HikariCPSQLException
```
Expand All @@ -95,7 +95,7 @@ spring:
driver-class-name: software.amazon.jdbc.Driver
hikari:
data-source-properties:
wrapperPlugins: failover,efm
wrapperPlugins: failover,efm2
wrapperDialect: aurora-pg
exception-override-class-name: software.amazon.jdbc.util.HikariCPSQLException
max-lifetime: 840000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring:
driver-class-name: software.amazon.jdbc.Driver
hikari:
data-source-properties:
wrapperPlugins: failover,efm
wrapperPlugins: failover,efm2
wrapperDialect: aurora-pg
max-lifetime: 840000
minimum-idle: 20
Expand Down
2 changes: 1 addition & 1 deletion examples/SpringHibernateExample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Configure Spring to use the AWS Advanced JDBC Driver as the default datasource.
driver-class-name: software.amazon.jdbc.Driver
hikari:
data-source-properties:
wrapperPlugins: iam,failover,efm
wrapperPlugins: iam,failover,efm2
iamRegion: us-east-2
iamExpiration: 1320
exception-override-class-name: software.amazon.jdbc.util.HikariCPSQLException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spring:
driver-class-name: software.amazon.jdbc.Driver
hikari:
data-source-properties:
wrapperPlugins: iam,failover,efm
wrapperPlugins: iam,failover,efm2
iamRegion: us-east-2
iamExpiration: 1320
exception-override-class-name: software.amazon.jdbc.util.HikariCPSQLException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class ConnectionPluginChainBuilder {
}
};

protected static final String DEFAULT_PLUGINS = "auroraConnectionTracker,failover,efm";
protected static final String DEFAULT_PLUGINS = "auroraConnectionTracker,failover,efm2";

/*
Internal class used for plugin factory sorting. It holds a reference to a plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import software.amazon.jdbc.plugin.AuroraConnectionTrackerPluginFactory;
import software.amazon.jdbc.plugin.AuroraHostListConnectionPluginFactory;
import software.amazon.jdbc.plugin.AuroraInitialConnectionStrategyPluginFactory;
import software.amazon.jdbc.plugin.efm.HostMonitoringConnectionPlugin;
import software.amazon.jdbc.plugin.efm.HostMonitoringConnectionPluginFactory;
import software.amazon.jdbc.plugin.efm2.HostMonitoringConnectionPlugin;
import software.amazon.jdbc.plugin.efm2.HostMonitoringConnectionPluginFactory;
import software.amazon.jdbc.plugin.failover.FailoverConnectionPluginFactory;
import software.amazon.jdbc.plugin.readwritesplitting.ReadWriteSplittingPluginFactory;
import software.amazon.jdbc.plugin.staledns.AuroraStaleDnsPluginFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected static Properties getProps() {

protected static Properties getPropsWithFailover() {
final Properties props = getDefaultPropsNoPlugins();
PropertyDefinition.PLUGINS.set(props, "readWriteSplitting,failover,efm");
PropertyDefinition.PLUGINS.set(props, "readWriteSplitting,failover,efm2");
return props;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected static Properties getProps() {

protected static Properties getPropsWithFailover() {
final Properties props = getDefaultPropsNoPlugins();
PropertyDefinition.PLUGINS.set(props, "readWriteSplitting,failover,efm");
PropertyDefinition.PLUGINS.set(props, "readWriteSplitting,failover,efm2");
return props;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import software.amazon.jdbc.plugin.ExecutionTimeConnectionPlugin;
import software.amazon.jdbc.plugin.IamAuthConnectionPlugin;
import software.amazon.jdbc.plugin.dev.DeveloperConnectionPlugin;
import software.amazon.jdbc.plugin.efm.HostMonitoringConnectionPlugin;
import software.amazon.jdbc.plugin.efm2.HostMonitoringConnectionPlugin;
import software.amazon.jdbc.plugin.failover.FailoverConnectionPlugin;
import software.amazon.jdbc.util.telemetry.TelemetryContext;
import software.amazon.jdbc.util.telemetry.TelemetryFactory;
Expand Down Expand Up @@ -69,7 +69,7 @@ void beforeEach() {
public void testSortPlugins() throws SQLException {
ConnectionPluginChainBuilder builder = new ConnectionPluginChainBuilder();
Properties props = new Properties();
props.put(PropertyDefinition.PLUGINS.name, "iam,efm,failover");
props.put(PropertyDefinition.PLUGINS.name, "iam,efm2,failover");

List<ConnectionPlugin> result = builder.getPlugins(
mockPluginService,
Expand All @@ -91,7 +91,7 @@ public void testSortPlugins() throws SQLException {
public void testPreservePluginOrder() throws SQLException {
ConnectionPluginChainBuilder builder = new ConnectionPluginChainBuilder();
Properties props = new Properties();
props.put(PropertyDefinition.PLUGINS.name, "iam,efm,failover");
props.put(PropertyDefinition.PLUGINS.name, "iam,efm2,failover");
props.put(PropertyDefinition.AUTO_SORT_PLUGIN_ORDER.name, "false");

List<ConnectionPlugin> result = builder.getPlugins(
Expand All @@ -114,7 +114,7 @@ public void testPreservePluginOrder() throws SQLException {
public void testSortPluginsWithStickToPrior() throws SQLException {
ConnectionPluginChainBuilder builder = new ConnectionPluginChainBuilder();
Properties props = new Properties();
props.put(PropertyDefinition.PLUGINS.name, "dev,iam,executionTime,connectTime,efm,failover");
props.put(PropertyDefinition.PLUGINS.name, "dev,iam,executionTime,connectTime,efm2,failover");

List<ConnectionPlugin> result = builder.getPlugins(
mockPluginService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import software.amazon.jdbc.plugin.AuroraConnectionTrackerPlugin;
import software.amazon.jdbc.plugin.DefaultConnectionPlugin;
import software.amazon.jdbc.plugin.LogQueryConnectionPlugin;
import software.amazon.jdbc.plugin.efm.HostMonitoringConnectionPlugin;
import software.amazon.jdbc.plugin.efm2.HostMonitoringConnectionPlugin;
import software.amazon.jdbc.plugin.failover.FailoverConnectionPlugin;
import software.amazon.jdbc.profile.ConfigurationProfile;
import software.amazon.jdbc.profile.ConfigurationProfileBuilder;
Expand Down

0 comments on commit 44caf79

Please sign in to comment.