Skip to content

Conversation

@begelundmuller
Copy link
Contributor

@begelundmuller begelundmuller commented Nov 22, 2024

@begelundmuller begelundmuller self-assigned this Nov 22, 2024
@begelundmuller begelundmuller marked this pull request as ready for review December 12, 2024 13:57

func (s *Service) findProvisionedRuntimeResource(ctx context.Context, deploymentID string) (*database.ProvisionerResource, bool, error) {
prs, err := s.DB.FindProvisionerResourcesForDeployment(ctx, deploymentID)
pr, err := s.DB.FindProvisionerResourceByName(ctx, deploymentID, string(provisioner.ResourceTypeRuntime), "")
Copy link
Member

Choose a reason for hiding this comment

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

Its a little odd as method is FindProvisionerResourceByName but the name is empty ?

Copy link
Contributor Author

@begelundmuller begelundmuller Dec 18, 2024

Choose a reason for hiding this comment

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

Okay, I changed the query name to ...ByTypeAndName.

The runtime resource is not currently named because there is only supposed to be one resource of that type for each deployment. (I see how this might be a little confusing.) This is different than for ClickHouse, where it matches to the connector name and you could in theory have multiple ClickHouses for one deployment (e.g. if you define clickhouse-a.yaml and clickhouse-b.yaml).

return nil, fmt.Errorf("provisioner: the requested provisioner %q does not support resource type %q", provisionerName, opts.Type)
}
} else {
for n, candidate := range s.ProvisionerSet {
Copy link
Member

Choose a reason for hiding this comment

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

is iterating over a map deterministic in order ? is that a concern here ?

Copy link
Contributor Author

@begelundmuller begelundmuller Dec 18, 2024

Choose a reason for hiding this comment

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

I don't think iterating is deterministic, and yes it's a concern (but not urgently at the moment). We have a separate issue to move to "provisioner chains", which will have deterministic ordering. So it will be improved in a follow up.

Annotations map[string]string
}

func (s *Service) Provision(ctx context.Context, opts *ProvisionOptions) (*database.ProvisionerResource, error) {
Copy link
Member

Choose a reason for hiding this comment

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

In general if provisioning fails then deployment should be deleted ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not anymore – if provisioning fails, the deployment will still be in Postgres with an error status. Provisioning can then be retried by doing a reset (the reset will delete the old deployment record in Postgres, so no leaks).

This enables moving provisioning to a retryable background job, where the UI/CLI can poll the deployment until its status becomes "ok". Kasper is planning to do this move when he gets some time.

}

if olap.Dialect() == drivers.DialectClickHouse {
// Returning early with empty results because this query tends to hang on ClickHouse.
Copy link
Member

Choose a reason for hiding this comment

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

just confirming - this is intentional ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, should probably have been a separate PR, but we want to keep that.

@begelundmuller begelundmuller merged commit 082eb36 into main Dec 20, 2024
11 checks passed
@begelundmuller begelundmuller deleted the begelundmuller/managed-connectors branch December 20, 2024 16:40
k-anshul pushed a commit that referenced this pull request Jan 6, 2025
* Protos and parser for managed connectors

* Admin APIs for provisioning

* Fix test

* Fix lint

* Fix tests

* Minor improvements

* Nit

* Fix test connector acquire

* Change to `FindProvisionerResourceByTypeAndName`
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