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

[compute_ctl] Empty computes and /configure API #3963

Merged
merged 1 commit into from
Apr 6, 2023
Merged

Conversation

ololobus
Copy link
Member

@ololobus ololobus commented Apr 5, 2023

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:

  1. Start compute with

    -p http://localhost:9095 \
    -D compute_pgdata \
    -C "postgresql://cloud_admin@127.0.0.1:5434/postgres" \
    -b ./pg_install/v15/bin/postgres
  2. 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. Also RwLock was replaced with Mutex because the latter works well with Condvar.

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

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • Do we need to implement analytics? if so did you add the relevant metrics to the dashboard?
  • If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section.

Checklist before merging

  • Do not forget to reformat commit message to not include the above checklist

@ololobus ololobus requested a review from a team as a code owner April 5, 2023 20:04
@ololobus ololobus requested review from NanoBjorn and removed request for a team April 5, 2023 20:04
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Test results for cf745b6:


debug build: 212 tests run: 202 passed, 0 failed, 10 (full report)


release build: 212 tests run: 202 passed, 0 failed, 10 (full report)


Copy link
Contributor

@lubennikovaav lubennikovaav left a comment

Choose a reason for hiding this comment

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

looks good to me.
thanks for splitting it into smaller PR

compute_tools/src/monitor.rs Outdated Show resolved Hide resolved
compute_tools/src/compute.rs Outdated Show resolved Hide resolved
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:

1. Start compute with
   ```shell
   cargo run --bin compute_ctl -- -i no-compute \
    -p http://localhost:9095 \
    -D compute_pgdata \
    -C "postgresql://cloud_admin@127.0.0.1:5434/postgres" \
    -b ./pg_install/v15/bin/postgres
   ```

2. 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.
Also `RwLock` was replaced with `Mutex` because the latter works well
with `Condvar`.

First part of the neondatabase/cloud#4433
@ololobus ololobus merged commit e42982f into main Apr 6, 2023
@ololobus ololobus deleted the alexk/empty-compute branch April 6, 2023 19:22
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.

2 participants