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

feat: Create initial Coordinator V2 service #444

Merged
merged 46 commits into from
Jan 11, 2024
Merged

Conversation

morgsmccauley
Copy link
Collaborator

@morgsmccauley morgsmccauley commented Dec 12, 2023

This PR adds the initial Coordinator V2 service, which acts as the main driver for the Control Plane.

Coordinator Overview

Coordinator V2 will exist as a new standalone service with it's primary goal being ensuring the current registry configuration is mapped to the system. It's core logic is just an infinite loop which reads the registry, and sends necessary requests to the Block Streamer and Runner services to synchronise that config.

Block Streamer Changes

Some changes have been made to Block Streamer to enable the above:

  1. version and redis_stream have been added to the proto so that Coordinator can configure them.
  2. Support for ActionFunctionCall has been added - Initially I thought only ActionAny allowed, but the current registry has ActionFunctionCall and therefore needs to be supported.
  3. last_published_block is now written to Redis to enable "Start from interruption"

What's not been done

I wanted to limit the scope of this PR as it was starting to get big, I'll address these tasks in follow up PRs:

  • Provisioning - Coordinator should check the status of provisioning, and act when the state isn't as expected. This can be done after Expose endpoint to control provisioning #426 is implemented.
  • Retry recoverable errors - Any error will be propagated cause the error to exit, this includes connection errors to the Block Streamer and Runner services. As these are very likely to occur (across restarts) we should retry these errors.
  • Environment configuration - There are many hard coded values (endpoints, registry contract, etc.) which should be configurable via the environment.
  • Logging and Metrics

@morgsmccauley morgsmccauley linked an issue Dec 12, 2023 that may be closed by this pull request
Base automatically changed from test/block-streamer to main December 14, 2023 00:21
@morgsmccauley morgsmccauley changed the base branch from main to refactor/shared-registry-types December 14, 2023 21:30
Base automatically changed from refactor/shared-registry-types to main December 15, 2023 02:02
@morgsmccauley morgsmccauley force-pushed the feat/control-plane branch 4 times, most recently from 3241d19 to c971512 Compare December 21, 2023 02:42
@morgsmccauley morgsmccauley changed the base branch from main to 415-add-createdupdated-at-timestamps December 21, 2023 02:43
Base automatically changed from 415-add-createdupdated-at-timestamps to main January 4, 2024 19:54
@morgsmccauley morgsmccauley force-pushed the feat/control-plane branch 2 times, most recently from 3dbc9ee to b76eb37 Compare January 8, 2024 02:04
@morgsmccauley morgsmccauley changed the base branch from main to 468-create-rust-grpc-client-for-runner January 8, 2024 02:04
Base automatically changed from 468-create-rust-grpc-client-for-runner to main January 8, 2024 21:24
@@ -26,7 +26,7 @@ wildmatch = "2.1.1"

registry-types = { path = "../registry/types", features = ["near-primitives"] }

near-lake-framework = "0.7.4"
near-lake-framework = "=0.7.4"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The existing mocks for near-lake-framework depend on behaviour which does not exist in the next version.

I'm pinning this for now, when we upgrade we'll need to find another way to mock it.

}
MatchingRule::Event { .. } => {
bail!("Event matching rule not yet supported for historical processing, function {:?} {:?}", indexer.account_id, indexer.function_name);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since we have a single stream for historical/real-time we can no longer bail here. Instead we just log and continue to the 'real-time' portion. Which is essentially the same behaviour.

coordinator/src/main.rs Outdated Show resolved Hide resolved
@morgsmccauley morgsmccauley marked this pull request as ready for review January 8, 2024 22:37
@morgsmccauley morgsmccauley requested a review from a team as a code owner January 8, 2024 22:37
@morgsmccauley morgsmccauley changed the title feat/control plane feat: Create initial Coordinator V2 service Jan 8, 2024
Copy link
Collaborator

@darunrs darunrs left a comment

Choose a reason for hiding this comment

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

Sorry it took a while to review! Mainly just have some small comments on the specifics. Looks good to me overall!

block-streamer/proto/block_streamer.proto Show resolved Hide resolved
block-streamer/proto/block_streamer.proto Show resolved Hide resolved
block-streamer/src/block_stream.rs Outdated Show resolved Hide resolved
coordinator/src/executors_handler.rs Show resolved Hide resolved
coordinator/src/main.rs Show resolved Hide resolved
coordinator/src/main.rs Show resolved Hide resolved
coordinator/src/redis.rs Show resolved Hide resolved
coordinator/src/registry.rs Show resolved Hide resolved
coordinator/src/main.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@darunrs darunrs left a comment

Choose a reason for hiding this comment

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

LGTM! Looks like the build failure is a rate limit issue, so that's resolvable... hopefully.

@morgsmccauley morgsmccauley merged commit b76fac0 into main Jan 11, 2024
12 checks passed
@morgsmccauley morgsmccauley deleted the feat/control-plane branch January 11, 2024 02:02
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.

Create Control service
2 participants