-
Notifications
You must be signed in to change notification settings - Fork 0
Added TRANSACTION_ISOLATION_LEVEL in AbstractDBSpecificConnectorConfig #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 13 commits
d75a03e
5da84da
144de23
3416985
8946d5e
8b01c44
085e047
4f77a05
178bfb5
4af4f5e
d6628b5
d7a8032
1cf173d
9874ebf
ed2c392
4b27a1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ | |
| import io.cdap.plugin.db.TransactionIsolationLevel; | ||
| import io.cdap.plugin.db.connector.AbstractDBConnectorConfig; | ||
| import io.cdap.plugin.db.source.AbstractDBSource; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Collections; | ||
|
|
@@ -49,6 +51,7 @@ public abstract class AbstractDBSpecificSourceConfig extends PluginConfig implem | |
| public static final String DATABASE = "database"; | ||
| public static final String FETCH_SIZE = "fetchSize"; | ||
| public static final String DEFAULT_FETCH_SIZE = "1000"; | ||
| public static final Logger LOG = LoggerFactory.getLogger(AbstractDBSpecificSourceConfig.class); | ||
|
|
||
| @Name(Constants.Reference.REFERENCE_NAME) | ||
| @Description(Constants.Reference.REFERENCE_NAME_DESCRIPTION) | ||
|
|
@@ -205,6 +208,7 @@ public Schema getSchema() { | |
| } | ||
|
|
||
| public String getTransactionIsolationLevel() { | ||
| LOG.debug("Hi Krish Inside AbstractDBSpecificSourceConfig getTransactionIsolationLevel "); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this logger one testing is complete. |
||
| return null; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ | |
| import io.cdap.plugin.common.KeyValueListParser; | ||
| import io.cdap.plugin.common.db.DBConnectorProperties; | ||
| import io.cdap.plugin.db.ConnectionConfig; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
|
|
@@ -37,6 +39,8 @@ | |
| */ | ||
| public abstract class AbstractDBConnectorConfig extends PluginConfig implements DBConnectorProperties { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(AbstractDBConnectorConfig.class); | ||
|
|
||
| @Name(ConnectionConfig.JDBC_PLUGIN_NAME) | ||
| @Description("Name of the JDBC driver to use. This is the value of the 'jdbcPluginName' key defined in the JSON " + | ||
| "file for the JDBC plugin.") | ||
|
|
@@ -113,6 +117,7 @@ protected static Properties getConnectionArgumentsProperties(@Nullable String co | |
| } | ||
|
|
||
| public Map<String, String> getAdditionalArguments() { | ||
| LOG.debug("inside get Additional argument of AbstractDBConnectorConfig"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove after testing |
||
| return Collections.emptyMap(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,12 @@ | |
| import io.cdap.cdap.api.annotation.Macro; | ||
| import io.cdap.cdap.api.annotation.Name; | ||
| import io.cdap.plugin.db.ConnectionConfig; | ||
| import io.cdap.plugin.db.TransactionIsolationLevel; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
| import javax.annotation.Nullable; | ||
|
|
||
|
|
@@ -30,9 +34,11 @@ | |
| */ | ||
| public abstract class AbstractDBSpecificConnectorConfig extends AbstractDBConnectorConfig { | ||
|
|
||
| private static final Logger LOG = LoggerFactory.getLogger(AbstractDBSpecificConnectorConfig.class); | ||
| @Name(ConnectionConfig.HOST) | ||
| @Description("Database host") | ||
| @Macro | ||
|
|
||
| @Nullable | ||
| protected String host; | ||
|
|
||
|
|
@@ -42,6 +48,12 @@ public abstract class AbstractDBSpecificConnectorConfig extends AbstractDBConnec | |
| @Nullable | ||
| protected Integer port; | ||
|
|
||
| @Name(ConnectionConfig.TRANSACTION_ISOLATION_LEVEL) | ||
| @Description("The transaction isolation level for the database session.") | ||
| @Macro | ||
| @Nullable | ||
| protected String transactionIsolationLevel; | ||
|
|
||
| public String getHost() { | ||
| return host; | ||
| } | ||
|
|
@@ -55,4 +67,23 @@ public int getPort() { | |
| public boolean canConnect() { | ||
| return super.canConnect() && !containsMacro(ConnectionConfig.HOST) && !containsMacro(ConnectionConfig.PORT); | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, String> getAdditionalArguments() { | ||
| Map<String, String> additonalArguments = new HashMap<>(); | ||
| LOG.debug("inside get AdditionalArguemnts of AbstractDBSpecificConnectorConfig"); | ||
| if (getTransactionIsolationLevel() != null) { | ||
| additonalArguments.put(TransactionIsolationLevel.CONF_KEY, getTransactionIsolationLevel()); | ||
| } | ||
| return additonalArguments; | ||
| } | ||
|
|
||
| public String getTransactionIsolationLevel() { | ||
| LOG.debug("Hi Krish, INSIDE AbstractDBSpecificConnectorCOnfig getTransactionIsolationLevel"); | ||
| if (transactionIsolationLevel == null) { | ||
| return null; | ||
| } | ||
| return TransactionIsolationLevel.Level.valueOf(transactionIsolationLevel).name(); | ||
| } | ||
|
Comment on lines
+68
to
+86
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we set the |
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable
ROLE?