Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Add use_secondary config flag #145

Merged
merged 8 commits into from
Jan 21, 2022
Merged

Conversation

judahrand
Copy link
Contributor

@judahrand judahrand commented Jan 11, 2022

Problem

Proposed changes

Alternate implementation of #131. I'm not sure how to go about testing this without setting up quite a lot of additional infrastructure. Do you think this needs additional testing?

Types of changes

What types of changes does your code introduce to PipelineWise?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • Description above provides context of the change
  • I have added tests that prove my fix is effective or that my feature works
  • Unit tests for changes (not needed for documentation changes)
  • CI checks pass with my changes
  • Bumping version in setup.py is an individual PR and not mixed with feature or bugfix PRs
  • Commit message/PR title starts with [AP-NNNN] (if applicable. AP-NNNN = JIRA ID)
  • Branch name starts with AP-NNN (if applicable. AP-NNN = JIRA ID)
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions

@judahrand
Copy link
Contributor Author

@Samira-El

@Samira-El
Copy link
Contributor

Hey @judahrand, I'm happy with the idea in general as we already have it implemented in PipelineWise FastSync. The issue is that I would prefer if we can rename these new parameters to something else other than replica_* as these are reserved for FastSync.

Will review the PR after renaming :)

re infrastructure, it would be great if we can spin up a replica alongside the docker image in the docker-compose to use for dev and testing purposes.

@judahrand
Copy link
Contributor Author

Will review the PR after renaming :)

What would you prefer?

re infrastructure, it would be great if we can spin up a replica alongside the docker image in the docker-compose to use for dev and testing purposes.

This sounds painful but I'll give it a VERY quick look given the debezium image used...

@judahrand
Copy link
Contributor Author

It's also worth adding that PipelineWise FastSync does not spin up a replica either: https://github.com/transferwise/pipelinewise/blob/206e75e630933d1a2b2ab9afb36261a55ccf0e4c/dev-project/docker-compose.yml#L63-L75

@judahrand
Copy link
Contributor Author

judahrand commented Jan 12, 2022

I would prefer if we can rename these new parameters to something else other than replica_* as these are reserved for FastSync.

This also feels confusing to me 🤔Why can they not be used by both? Having to define the replica details twice seems even more confusing? host, port, user, password are already used in both. Why do you feel that this would be a mistake for replica details?

@Samira-El
Copy link
Contributor

This also feels confusing to me thinkingWhy can they not be used by both? Having to define the replica details twice seems even more confusing? host, port, user, password are already used in both. Why do you feel that this would be a mistake for replica details?

It's because it will interfere with how we use replicas internally at Wise, temporary replicas are sometimes spun up to do initial sync or resync with FastSync to avoid overwhelming the primary, but the rest of the flow that uses Singer would use primary.

@Samira-El
Copy link
Contributor

It's also worth adding that PipelineWise FastSync does not spin up a replica either: https://github.com/transferwise/pipelinewise/blob/206e75e630933d1a2b2ab9afb36261a55ccf0e4c/dev-project/docker-compose.yml#L63-L75

I know :)

@judahrand
Copy link
Contributor Author

judahrand commented Jan 12, 2022

This also feels confusing to me thinkingWhy can they not be used by both? Having to define the replica details twice seems even more confusing? host, port, user, password are already used in both. Why do you feel that this would be a mistake for replica details?

It's because it will interfere with how we use replicas internally at Wise, temporary replicas are sometimes spun up to do initial sync or resync with FastSync to avoid overwhelming the primary, but the rest of the flow that uses Singer would use primary.

Hmmm... I see. The replica is still only used if use_replica is true. So it wouldn't actually break anything.

Do you have a preference on the naming in that case? tap_replica_*?

@Samira-El
Copy link
Contributor

Samira-El commented Jan 12, 2022

Ah naming! one out of the two hardest things in software engineering!

How about secondary_*?

@judahrand
Copy link
Contributor Author

I've added the usage of the new flag to the tests. This was easiest by adding a parameterisation to an existing test but that required moving away from unittest.TestCase - I hope this is all okay.

This should be ready for review now.

@judahrand
Copy link
Contributor Author

@Samira-El Could you please give this another look?

Copy link
Contributor

@Samira-El Samira-El left a comment

Choose a reason for hiding this comment

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

Looks good in general, really good stuff!
Left few comments

tap_postgres/db.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
@Samira-El Samira-El changed the title Add use_replica config flag Add use_secondary config flag Jan 19, 2022
@Samira-El Samira-El merged commit 443e67d into transferwise:master Jan 21, 2022
@Samira-El Samira-El mentioned this pull request Jan 25, 2022
13 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants