Skip to content

add isolation level to Oracle Plugin: PLUGIN-1178#258

Merged
itsankit-google merged 1 commit intodata-integrations:developfrom
jster1357:develop
May 6, 2022
Merged

add isolation level to Oracle Plugin: PLUGIN-1178#258
itsankit-google merged 1 commit intodata-integrations:developfrom
jster1357:develop

Conversation

@jster1357
Copy link
Copy Markdown
Contributor

Oracle specific changes. I'm going to work on the broader set of databases.

https://cdap.atlassian.net/browse/PLUGIN-1178

@jster1357
Copy link
Copy Markdown
Contributor Author

I wanted to get an opinion on if we even needed an isolation level setting for a source plugin. Furthermore, would it make sense for an action plugin. It certainly makes sense for a sink plugin but I'm on the fence on Action and wether we need it for source.

@Description("The transaction isolation level for the database session.")
@Nullable
@Macro
public String transactionIsolationLevel;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move this property to OracleConnectorConfig instead of independently in sink and source.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, we'd better add more descriptions here suggesting what transaction level to set for corresponding role. As I recall, you can not set arbitrary isolation level for sysdba or sysopr role, that's why we have https://github.com/data-integrations/database-plugins/blob/develop/oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConnectorConfig.java#L109

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also since isolation level is a common connection property , if we are only focusing on Oracle now, let's add a TODO to move it to AbstractDBSpecificConnectorConfig/AbstractDBConnectorConfig in the future

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanzhougoogle I kept the isolation level changes just to the Oracle Plugin. I'm currently working on the broader change across the other DB's and I'm using AbstractDBSpecificConnectorConfig/AbstractDBConnectorConfig for those

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seanzhougoogle I can confirm on the sysdba user failing w/ serialized isolation levels. I recieve ORA-08178: illegal SERIALIZABLE clause specified for user INTERNAL

We should document this in the docs (plugin) that any selection w/ an internal user like sysdba or sysop will result in the isolation level being changed to read_committed.

Copy link
Copy Markdown
Contributor

@itsankit-google itsankit-google May 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jster1357 Could you please check if its possible to not display transaction_serializable in UI if sysdba or sysop is selected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@itsankit-google got it. I'm looking into using a filter to hide the transaction leves when sysop or sysdba is selected

Copy link
Copy Markdown
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any specific reason to leave out TRANSACTION_READ_UNCOMMITTED & TRANSACTION_REPEATABLE_READ? In generic DB plugin, we do allow configuring them as well.

@jster1357
Copy link
Copy Markdown
Contributor Author

I only exposed those specific isolation levels because Oracle doesn't support the other 2 levels. I had it originally but had errors when using REPEATED and UNCOMMITTED levels. I thought this approach would help save the user from themselves so to speak.

@jster1357
Copy link
Copy Markdown
Contributor Author

jster1357 commented May 5, 2022

I made the change from having the transaction level code at the source/sink level to the ConnectorConfig Class. Things work with the exception of when the roles are set for SYSDBA or SYSOP. I can run fine using the Normal role and I can get the isolation level to change just fine. When I have a SYSDBA role selected, I always get ORA-08178: illegal SERIALIZABLE clause specified for user INTERNAL even though I have logic to remap the isolation level when I see that role being used. It always grabs the serialized...I must be missing something simple here. I tired overriding the getTransactionIsolationLevel method but it's still not picking up the changes.

I also made the change to hide the isolation field when a user selects the SYSDBA or SYSOPS radio button.

Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConnectorConfig.java Outdated
Comment thread oracle-plugin/widgets/Oracle-batchsink.json Outdated
Comment thread oracle-plugin/widgets/Oracle-batchsource.json Outdated
Comment thread oracle-plugin/widgets/Oracle-connector.json Outdated
Copy link
Copy Markdown
Contributor

@itsankit-google itsankit-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSink.java
Comment thread oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java
@itsankit-google
Copy link
Copy Markdown
Contributor

I made the change from having the transaction level code at the source/sink level to the ConnectorConfig Class. Things work with the exception of when the roles are set for SYSDBA or SYSOP. I can run fine using the Normal role and I can get the isolation level to change just fine. When I have a SYSDBA role selected, I always get ORA-08178: illegal SERIALIZABLE clause specified for user INTERNAL even though I have logic to remap the isolation level when I see that role being used. It always grabs the serialized...I must be missing something simple here. I tired overriding the getTransactionIsolationLevel method but it's still not picking up the changes.

I also made the change to hide the isolation field when a user selects the SYSDBA or SYSOPS radio button.

I think it was because of removal of getTransactionIsolationLevel() overridden methods from OracleSourceConfig and OracleSinkConfig which made it always return null and setting the default TRANSACTION_SERIALIZABLE isolation level.

@jster1357
Copy link
Copy Markdown
Contributor Author

I've made the changes and everything looks good on my end. I've tested the following situations:

  • Normal Role with null isolation level, job runs with SERIALIZABLE
  • Normal Role with SERIALIZABLE Level, job runs with SERIALIZABLE
  • Normal Role with READ_COMMITTED level, job runs with READ_COMMITTED
  • SYSDBA Role, UI Hides isolation level selection, job runs with READ_COMMITTED
  • import pipeline with SYSDBA role and SERIALIZABLE level, job runs with READ_COMMITTED

I don't think we need to expose the isolation level w/ a predefined connector...that should be done on a table by table basis.

@itsankit-google
Copy link
Copy Markdown
Contributor

I don't think we need to expose the isolation level w/ a predefined connector...that should be done on a table by table basis.

Predefined connections also act like a source for sampling the tables through wrangler.
@seanzhougoogle WDYT?

]
}
],
"Filters" : [],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of empty, we need to add a similar filter for isolation levels as in source and sink.

Copy link
Copy Markdown
Contributor Author

@jster1357 jster1357 May 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the filter but I don't see the ISOLATION LEVEL showing up. I didn't even see it prior to adding the filter, which was why I originally left it off.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah looks like there is some issue in the UI not rendering it correctly? Is it only with select widget? Did you try changing the widget type?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to verify your changes, looks like it is a UI bug when there are 2 connectors, one in system scope and other in user scope, UI only renders system scope one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tired the radio button but it didn't render. I thought the filter capitalization error would fix it but no dice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a JIRA for UI team - https://cdap.atlassian.net/browse/PLUGIN-1248

Comment thread oracle-plugin/widgets/Oracle-connector.json Outdated
@itsankit-google
Copy link
Copy Markdown
Contributor

itsankit-google commented May 6, 2022

LGTM, one minor comment. Thanks Justin :)

@itsankit-google
Copy link
Copy Markdown
Contributor

itsankit-google commented May 6, 2022

I don't think we need to expose the isolation level w/ a predefined connector...that should be done on a table by table basis.

Predefined connections also act like a source for sampling the tables through wrangler. @seanzhougoogle WDYT?

Discussed offline with @seanzhougoogle, will need to live with this limitation because it is a connection property.

@itsankit-google itsankit-google merged commit 0ef95e0 into data-integrations:develop May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants