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

implement dual-write workflows with go-workflows #28

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

vroldanbet
Copy link
Contributor

@vroldanbet vroldanbet commented Sep 18, 2023

Implement as alternative to MSFT's durable-task

Also undoes #27, because that was a bad idea ™️ 🙈 The amount of complexity it added did not justify it, and both implementations are different enough to become a mess to reconcile both

Main benefits:

  • Type safety with generics, no wrapper types
  • more approachable Backend interface
  • different panic handling

Drawbacks:

Forked go-workflows

I forked go-workflows because I couldn't make ko build a CGO-enabled image, so I replaced the CGO library with the Go native library in my fork. This will come in handy as I bring in the Postgres driver too

It's also modified to set the maximum number of connections to 1. SQLite is designed to have multiple readers and a single writer, so whenever 2 processes attempt to write to the same database, a database is locked (5) (SQLITE_BUSY) will show up. Followed the advice in mattn/go-sqlite3#274

Changes to tests

Some E2E tasks were changed due to some subtle changes to how go-workflows handles errors:

  • go-workflows: on panic, tasks are rescheduled and retried, client future blocks until task succeeds
  • durabletask-go: panic is returned as error to the client right away

For that reason, when operations are idempotent, go-workflows eventually succeeds, while durabletask-go has the compensatory code invoked and the client needs to retry.

This is the behaviour I also expected in durabletask-go, as per my review in #16. Perhaps retries need to be explicitly configured? 🤷🏻

Follow ups

  • write e2e tests that validate behaviour when CheckKubeResource activity fails

@github-actions github-actions bot added area/core area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain labels Sep 18, 2023
@vroldanbet vroldanbet self-assigned this Sep 18, 2023
@vroldanbet vroldanbet force-pushed the dual-write-go-workflow branch 4 times, most recently from 61e874c to 03fced3 Compare September 18, 2023 09:53
@vroldanbet vroldanbet force-pushed the dual-write-go-workflow branch 4 times, most recently from 598788b to b3091a1 Compare September 18, 2023 11:18
@vroldanbet

This comment was marked as resolved.

@vroldanbet vroldanbet force-pushed the dual-write-go-workflow branch 3 times, most recently from 332e60f to c8b02a0 Compare September 18, 2023 12:54
@vroldanbet vroldanbet marked this pull request as ready for review September 18, 2023 13:00
@vroldanbet vroldanbet requested a review from ecordell September 18, 2023 16:11
Dockerfile Outdated Show resolved Hide resolved
pkg/proxy/distributedtx/workflows.go Outdated Show resolved Hide resolved
pkg/proxy/authz.go Show resolved Hide resolved
e2e/proxy_test.go Show resolved Hide resolved
pkg/proxy/distributedtx/tasks.go Outdated Show resolved Hide resolved
pkg/proxy/distributedtx/tasks.go Show resolved Hide resolved
@vroldanbet vroldanbet force-pushed the dual-write-go-workflow branch 9 times, most recently from 129b4bc to 72f256f Compare September 19, 2023 09:18
@vroldanbet vroldanbet force-pushed the dual-write-go-workflow branch 2 times, most recently from 13ff697 to 4560b06 Compare September 19, 2023 16:24
the main drivers to replace with go-workflows are:
- we through the maintainer it's being used in production
  in a large scale system
- type-safety with generics, less boilerplate
- more approachable backend interface
- redis support

This commit conducted a refactoring of the code, added
unit tests, and addressed a corner-case in CheckKubeResource
method
@vroldanbet vroldanbet force-pushed the dual-write-go-workflow branch from 4560b06 to 9b559d2 Compare September 19, 2023 16:25
@ecordell ecordell merged commit 0677818 into main Sep 19, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/core area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants