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

Support reusing orchestration id #46

Merged
merged 17 commits into from
Dec 11, 2023
Merged

Support reusing orchestration id #46

merged 17 commits into from
Dec 11, 2023

Conversation

kaibocai
Copy link
Member

This PR tries to update the logic to support reuse orchestration ID, more details can be found #42, dapr/dapr#7101
Corresponding protobuf updates can be found microsoft/durabletask-protobuf#19

@kaibocai
Copy link
Member Author

Draft the PR, need more tests

tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
@kaibocai kaibocai marked this pull request as ready for review November 29, 2023 15:57
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Happy to see the progress on this. See my comments below. I think we may want to simplify/tighten our implementation of this feature.

api/orchestration.go Outdated Show resolved Hide resolved
api/orchestration.go Outdated Show resolved Hide resolved
backend/backend.go Outdated Show resolved Hide resolved
backend/executor.go Outdated Show resolved Hide resolved
backend/backend.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
@kaibocai
Copy link
Member Author

kaibocai commented Dec 1, 2023

@cgillum , re-implemented the logic so it doesn't query existing instances at the beginning and most logic goes to backend implementation to utilize the isolation benefit provided by db transaction. The core logic is a little different from the pseudo-code we discussed at #42 (comment), but the effect is the same and more readable.

I assume it still needs a lot of improvement and updates, but would like to get your opinion on the high-level implementation direction. Thanks.

@kaibocai
Copy link
Member Author

kaibocai commented Dec 1, 2023

tagging @ItalyPaleAle for helping review as well. Thank you Ale!

.github/workflows/pr-validation.yml Show resolved Hide resolved
.github/workflows/pr-validation.yml Outdated Show resolved Hide resolved
api/orchestration.go Outdated Show resolved Hide resolved
api/orchestration.go Outdated Show resolved Hide resolved
api/orchestration.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/backend.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Some initial feedback based on reviewing the test code. I'll focus a bit more on the main code once I feel that we have the right tests in place.

tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Some feedback on the core design.

tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
api/orchestration.go Outdated Show resolved Hide resolved
api/orchestration.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/backend.go Outdated Show resolved Hide resolved
more refactory

refactory
@kaibocai kaibocai force-pushed the kaibocai/reuse-id-split branch from 2290604 to a74c223 Compare December 6, 2023 01:33
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

A few more comments.

ErrNotCompleted = errors.New("orchestration has not yet completed")
ErrNoFailures = errors.New("orchestration did not report failure details")
ErrDuplicateInstance = errors.New("orchestration instance already exists")
ErrSkipInstance = errors.New("skip creating orchestration instance")
Copy link
Member

Choose a reason for hiding this comment

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

Are you using VS Code with the Go extension for editing? Normally it would auto-format the code when you save to line up all the = signs.

api/orchestration.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/sqlite/sqlite.go Outdated Show resolved Hide resolved
backend/backend.go Show resolved Hide resolved
backend/executor.go Show resolved Hide resolved
tests/backend_test.go Outdated Show resolved Hide resolved
tests/grpc/grpc_test.go Outdated Show resolved Hide resolved
internal/protos/orchestrator_service.pb.go Show resolved Hide resolved
internal/protos/orchestrator_service.pb.go Outdated Show resolved Hide resolved
@kaibocai kaibocai changed the title Support reuse orchestration id Support reusing orchestration id Dec 11, 2023
ErrNotCompleted = errors.New("orchestration has not yet completed")
ErrNoFailures = errors.New("orchestration did not report failure details")
ErrDuplicateInstance = errors.New("orchestration instance already exists")
ErrIgnoreInstance = errors.New("ignore creating orchestration instance")
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there are still some issues with the whitespace here :(

CHANGELOG.md Outdated
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.3.2] - 2023-12-11
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## [v0.3.2] - 2023-12-11
## [Unreleased]

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.

3 participants