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

Commit provisioning transaction before starting pipeline #1759

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

lovromazgon
Copy link
Member

Description

When provisioning a pipeline through a pipeline configuration file, the pipeline is started inside of the same db transaction in which it's created. We should rather commit the transaction after creating the pipeline and starting it outside of that transaction. The main reason is that the context passed to Start should not have a transaction attached, especially not one that will be committed after the pipeline is started, as that context might be used to retrieve or write data to the database. If it contains a committed transaction, those operations will fail.

This was found when trying to create a schema in a standalone processor using the built-in schema registry:

2024-08-07T09:09:07+00:00 ERR failed executing service method error="failed to get schema by subject and version: failed to get subject schema from store: failed to get subject schema with subject:version \"test:employees-source:payload\":'\\x01': badger: could not get key \"schemaregistry:subjectschema:test:employees-source:payload:1\": This transaction has been discarded. Create a new one" component=standalone.wasmProcessor method=get_schema processor_id=test:access-schema stack=[{"file":"/Users/mahahajja/repos/conduit/pkg/plugin/processor/procutils/schema.go","func":"github.com/conduitio/conduit/pkg/plugin/processor/procutils.(*SchemaService).GetSchema","line":76}]

Quick checks

  • I have followed the Code Guidelines.
  • There is no other pull request for the same update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

@lovromazgon lovromazgon requested a review from a team as a code owner August 7, 2024 16:33
Copy link
Contributor

@hariso hariso left a comment

Choose a reason for hiding this comment

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

Nice find!

@lovromazgon lovromazgon merged commit 8670c8a into main Aug 7, 2024
3 checks passed
@lovromazgon lovromazgon deleted the lovro/provision-pipeline-txn branch August 7, 2024 16:48
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.

2 participants