-
Notifications
You must be signed in to change notification settings - Fork 808
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
feat(sql): use a connection pool named "read" for some read operations in SqlExecutionRepository #4803
feat(sql): use a connection pool named "read" for some read operations in SqlExecutionRepository #4803
Conversation
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.
Could we include an example (maybe in one of the commit messages or the description) for how to configure orca to use a read pool?
… DataSource bean available depending on configuration
d2a56fe
to
53927e2
Compare
...rc/main/kotlin/com/netflix/spinnaker/orca/sql/pipeline/persistence/SqlExecutionRepository.kt
Outdated
Show resolved
Hide resolved
…SqlExecutionRepository if configured to do so. WIP: so far this is only configuration, nothing actually uses the read pool
…nRepository to pave the way to use the read pool for selecting by correlation id
- correlation ids for completed pipelines/orchestrations - a stage
53927e2
to
942d48c
Compare
jooq.transactional { | ||
it.deleteFrom(table("correlation_ids")).where(field("id").eq(correlationId)).execute() | ||
} | ||
if (execution == null) { |
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.
A POTENTIAL concern since we ARE querying now from the read pool: Can the orchestration be on a delayed sync, so it'd actually exist in the RW & not be sync'd yet? Wondering if a fallback is needed in such a case. OR this could be handled upstream when it doesn't find it to retry?
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.
We haven't seen problems with this, but I agree there's a hole if two orchestrations start very quickly. One use of retrieveByCorrelationId
(the only function that calls this one) is in ExecutionLauncher.checkForCorrelatedExecution, called by ExecutionLauncher.start. Same deal for retrievePipelineForCorrelationId
below.
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.
Yeah it's a concern - I know of some workflows that use orchestration stuff that could get impacted by this, and read-sync issues are the "biggest" headaches of RO queries based on past. This seems to be the biggest spot that's a POTENTIAL risk as I THINK (and still tracing) the others do retries on an operation that throws an error or doesn't respond. It's possible these upstream may ALSO retry, but not 100% sure YET if that exception is encountered...
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.
OK, reverted back to withPool(poolName)
…selectExecution since it's not used.
8d9095c
to
00de9c0
Compare
Introduce a read pool for some read-only database queries in SqlExecutionRepository. Enable this by configuring an additional connection pool named
"read"
, like this:Additional read-only database queries happen in places that expect to see "just-written" contents. They're not safe to convert to use the read replica until there's logic in place to be aware of replication lag, and wait until the read replica is up-to-date.