Skip to content
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

Source MSSQL: add option to disable Snapshot mode and initial backup #12759

Merged
merged 11 commits into from
May 25, 2022

Conversation

sivankumar86
Copy link
Contributor

@sivankumar86 sivankumar86 commented May 11, 2022

What

Describe what the change is solving
Added option to disable initial snapshot and enabling snapshot mode as we use read_committed replica which is not required to enable snapshot isolation

#12592

How

There is a option in debezium connector to disable snapshot isolation mode.

 // below option would not lock the table 
  
props.setProperty("snapshot.isolation.mode", "read_committed");

//below. option would not take initial snapshot and only capture changes 

props.setProperty("snapshot.mode", "schema_only");

Recommended reading order

  1. x.java
  2. y.python

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.

Pre-merge Checklist

Expand the relevant checklist and delete the others.

New Connector

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/SUMMARY.md
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@CLAassistant
Copy link

CLAassistant commented May 11, 2022

CLA assistant check
All committers have signed the CLA.

@sivankumar86
Copy link
Contributor Author

CLA assistant check Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

Sivakumar Ramaswamy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

i did digital sign but, it is not working

snapshot isolation setting is hardcode and I modified as user option
@github-actions github-actions bot added the area/documentation Improvements or additions to documentation label May 11, 2022
@alafanechere alafanechere changed the title added option to disable Snapshot mode and initial backup in mssql connector Source MSSQL: add option to disable Snapshot mode and initial backup May 16, 2022
@alafanechere
Copy link
Contributor

@sivankumar86 thank you for this contribution! To fix the CLA signature I think you need to make sure that your git config email is the same as your using for GitHub. You committed with your Gmail address, is it the same email as your github account email?

@alafanechere
Copy link
Contributor

alafanechere commented May 16, 2022

/test connector=connectors/source-mssql

🕑 connectors/source-mssql https://github.com/airbytehq/airbyte/actions/runs/2334701729
❌ connectors/source-mssql https://github.com/airbytehq/airbyte/actions/runs/2334701729
🐛 https://gradle.com/s/fw7xbuz6nv3xk

🕑 connectors/source-mssql https://github.com/airbytehq/airbyte/actions/runs/2334701729
✅ connectors/source-mssql https://github.com/airbytehq/airbyte/actions/runs/2334701729
No Python unittests run

@alafanechere alafanechere self-assigned this May 16, 2022
@sivankumar86
Copy link
Contributor Author

sivankumar86 commented May 16, 2022

@sivankumar86 thank you for this contribution! To fix the CLA signature I think you need to make sure that your git config email is the same as your using for GitHub. You committed with your Gmail address, is it the same email as your github account email?

Thanks for reply. I added email address which was being used to commit and it got resolved.

@alafanechere
Copy link
Contributor

I'd love a review from the connector team on this. @sivankumar86 I'm wondering to what extent this change can be propagated to other CDC compatible source databases. Is anything specific to MSSQL in your modifications?

Copy link
Contributor

@tuliren tuliren left a comment

Choose a reason for hiding this comment

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

@sivankumar86, thank you for the contribution!

The overall design looks good. However, since multiple configurations have been introduced to the CDC method, the replication_method needs to be changed to an object. In addition, I think some unit tests and a new test case in the acceptance test are necessary.

I will create a PR based on your PR, and make all the changes mentioned in the review. When all those are done, I will merge your PR and then my patch.

@subodh1810
Copy link
Contributor

Should this change be across Postgres and Mysql connectors as well for consistency?

@tuliren
Copy link
Contributor

tuliren commented May 18, 2022

Should this change be across Postgres and Mysql connectors as well for consistency?

Yes.

if(cdcMethod.hasNonNull("is_snapshotDisabled") &&
cdcMethod.get("is_snapshotDisabled").asBoolean()) {
props.setProperty("snapshot.isolation.mode", "read_committed");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: preferred formatting:
'} else {'

@tuliren
Copy link
Contributor

tuliren commented May 19, 2022

Should this change be across Postgres and Mysql connectors as well for consistency?

I looked into this more closely. Different databases actually have different CDC settings. Since this is not a planned sprint project, I will not apply this change to Postgres or MySQL this time. Will create a ticket to track it in the future.

sivankumar86 and others added 2 commits May 22, 2022 13:51
@sivankumar86 sivankumar86 requested a review from tuliren May 22, 2022 03:54
@sivankumar86
Copy link
Contributor Author

@tuliren Thank you for providing review/feedback. I have changed the code and it is specific to mssql server hence, it may not suitable for other connector. could you take a look on new changes ?

@alafanechere
Copy link
Contributor

I handover the assignment to @grishick as the DB connector team is currently working on this.

@tuliren tuliren assigned tuliren and unassigned grishick May 23, 2022
@tuliren
Copy link
Contributor

tuliren commented May 23, 2022

@alafanechere, @grishick, I am already working on this. Please let me push this to the finishing line. Switching the assignee at this moment will slow it down.

@sivankumar86, thank you very much. You can leave the PR as is. I am working on a PR on top of this to add a few more optimizations. Once this is one, I will merge this PR.

@sivankumar86
Copy link
Contributor Author

@alafanechere, @grishick, I am already working on this. Please let me push this to the finishing line. Switching the assignee at this moment will slow it down.

@sivankumar86, thank you very much. You can leave the PR as is. I am working on a PR on top of this to add a few more optimizations. Once this is one, I will merge this PR.

@tuliren thank you for taking ownership. Could you please provide me your PR link so that I can subscribe and also, it would be great if you can push to main asap .

@tuliren
Copy link
Contributor

tuliren commented May 25, 2022

@sivankumar86, the PR is here: #13168

@tuliren
Copy link
Contributor

tuliren commented May 26, 2022

I ran into some issue when trying to publish a new version for the MSSQL connector. Still working on it in #13176.

jscottpolevault pushed a commit to jscottpolevault/airbyte that referenced this pull request Jun 1, 2022
…pshot isolation level (airbytehq#12759)

* MSSQL CDC feature to capture only changes option added

* MSSQL CDC feature to capture only changes option added

* added option to disable snapshot 

snapshot isolation setting is hardcode and I modified as user option

* recommitting

* docker version change

docker version change

* resolve conflict

* review 1 added

* review 1 added

* removed extra space

removed extra space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants