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

stop accepting empty body in /attach API #4282

Closed
2 tasks
problame opened this issue May 19, 2023 · 3 comments · Fixed by #8134
Closed
2 tasks

stop accepting empty body in /attach API #4282

problame opened this issue May 19, 2023 · 3 comments · Fixed by #8134
Assignees
Labels
c/storage/pageserver Component: storage: pageserver

Comments

@problame
Copy link
Contributor

problame commented May 19, 2023

PR #4255 adds the attach-time tenant config capability, but continues to accept the default tenant config for backwards-comaptibility reasons.

Once the corresponding cloud.git work to use attach-time tenant config is done, we should error out if the request body is empty and instead require a correct TenantAttachRequest object in the body.

Required work (in correct order)

  • Adjust test cases that currently use plain detach + attach (if they don't care, they can continue to use an empty config={}
    • Consider requiring the config as an argument to make callers aware that they need to think about this.
  • Make the change
    • ... in tenant_attach_handler
    • ... adjust openapi yaml
    • ... and adjust the test_empty_body added in attach-time tenant config #4255 to expect failure (=> use NegativeEnv)
    • remove now-unused json_request_or_empty_body
@problame problame added the c/storage/pageserver Component: storage: pageserver label May 19, 2023
@problame problame self-assigned this May 19, 2023
@vadim2404 vadim2404 changed the title stop accepting emtpy body in /attach API stop accepting empty body in /attach API May 22, 2023
problame added a commit that referenced this issue May 24, 2023
This PR adds support for supplying the tenant config upon /attach.

Before this change, when relocating a tenant using `/detach` and
`/attach`, the tenant config after `/attach` would be the default config
from `pageserver.toml`.
That is undesirable for settings such as the PITR-interval: if the
tenant's config on the source was `30 days` and the default config on
the attach-side is `7 days`, then the first GC run would eradicate 23
days worth of PITR capability.

The API change is backwards-compatible: if the body is empty, we
continue to use the default config.
We'll remove that capability as soon as the cloud.git code is updated to
use attach-time tenant config
(#4282 keeps track of this).

unblocks neondatabase/cloud#5092 
fixes #1555
part of #886 (Tenant
Relocation)

Implementation
==============

The preliminary PRs for this work were (most-recent to least-recent)

* #4279
* #4267
* #4252
* #4235
@problame
Copy link
Contributor Author

problame commented Nov 8, 2023

This will be obsoleted by the move to the upsert location endpoint.

@problame problame closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2023
@hlinnaka
Copy link
Contributor

If I understand correctly, https://github.com/neondatabase/cloud/pull/10927 removed the last calls of the /attach endpoint from the control plane. Can we remove it from the pageserver now?

I think the python tests are still using it though (tenant_attach in test_runner/fixtures/pageserver/http.py). Should they be changed to use the new API? What exactly is the corresponding new API?

@problame
Copy link
Contributor Author

If I understand correctly, https://github.com/neondatabase/cloud/pull/10927 removed the last calls of the /attach endpoint from the control plane. Can we remove it from the pageserver now?

Yeah, my understanding also is that there shouldn't be any more production users of /attach.

I think the python tests are still using it though (tenant_attach in test_runner/fixtures/pageserver/http.py). Should they be changed to use the new API? What exactly is the corresponding new API?

.../location_config is the new API.

Let's take this conversation into the team channel.

jcsp added a commit that referenced this issue Jun 25, 2024
## Problem

These APIs have been deprecated for some time, but were still used from
test code.

Closes: #4282

## Summary of changes

- It is still convenient to do a "tenant_attach" from a test without
having to write out a location_conf body, so those test methods have
been retained with implementations that call through to their
location_conf equivalent.
conradludgate pushed a commit that referenced this issue Jun 27, 2024
## Problem

These APIs have been deprecated for some time, but were still used from
test code.

Closes: #4282

## Summary of changes

- It is still convenient to do a "tenant_attach" from a test without
having to write out a location_conf body, so those test methods have
been retained with implementations that call through to their
location_conf equivalent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/storage/pageserver Component: storage: pageserver
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants