[compute_ctl] Empty computes and /configure API #3963
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
This commit adds an option to start compute without spec and then pass it a valid spec via
POST /configure
API endpoint. This is a main prerequisite for maintaining the pool of compute nodes in the control-plane.For example:
Start compute with
-p http://localhost:9095 \ -D compute_pgdata \ -C "postgresql://[email protected]:5434/postgres" \ -b ./pg_install/v15/bin/postgres
Configure it with
shell curl -d "{\"spec\": $(cat ./compute-spec.json)}" http://localhost:3080/configure
Internally, it's implemented using a
Condvar
+Mutex
. Compute spec is moved under Mutex, as it's now could be updated in the http handler. AlsoRwLock
was replaced withMutex
because the latter works well withCondvar
.First part of the #3923
Issue ticket number and link
First part of https://github.com/neondatabase/cloud/issues/4433
Checklist before requesting a review
Checklist before merging