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

pageserver: remove legacy tenant config code, clean up redundant generation none/broken usages #7947

Merged
merged 9 commits into from
Jun 26, 2024

Conversation

jcsp
Copy link
Contributor

@jcsp jcsp commented Jun 3, 2024

Problem

In #5299, the new config-v1 tenant config file was added to hold the LocationConf type. We left the old config file in place for forward compat, and because running without generations (therefore without LocationConf) as still useful before the storage controller was ready for prime-time.

Closes: #5388

Summary of changes

  • Remove code for reading and writing the legacy config file
  • Remove Generation::Broken: it was unused.
  • Treat missing config file on disk as an error loading a tenant, rather than defaulting it. We can now remove LocationConf::default, and thereby guarantee that we never construct a tenant with a None generation.
  • Update some comments + add some assertions to clarify that Generation::None is only used in layer metadata, not in the state of a running tenant.
  • Update docker compose test to create tenants with a generation

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

@jcsp jcsp added c/storage/pageserver Component: storage: pageserver a/tech_debt Area: related to tech debt labels Jun 3, 2024
Copy link

github-actions bot commented Jun 3, 2024

2934 tests run: 2817 passed, 0 failed, 117 skipped (full report)


Code coverage* (full report)

  • functions: 32.7% (6895 of 21116 functions)
  • lines: 50.0% (53928 of 107861 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
0ca7704 at 2024-06-26T19:29:46.396Z :recycle:

@jcsp jcsp marked this pull request as ready for review June 4, 2024 15:18
@jcsp jcsp requested a review from a team as a code owner June 4, 2024 15:18
@jcsp jcsp requested a review from arpad-m June 4, 2024 15:18
@jcsp jcsp enabled auto-merge (squash) June 4, 2024 21:17
@jcsp
Copy link
Contributor Author

jcsp commented Jun 5, 2024

It turns out that we have an automated test of a docker-compose example, which was never updated to use the storage controller.

That also highlights that once we always try and write a new-style file, we will give unfriendly errors if someone tries to create a tenant with no generation. Let's follow-through and really make that mandatory at the API level.

@jcsp jcsp marked this pull request as draft June 13, 2024 09:35
auto-merge was automatically disabled June 13, 2024 09:35

Pull request was converted to draft

@jcsp jcsp force-pushed the jcsp/issue-5388-legacy-tenant-conf branch 2 times, most recently from 53e632e to 580c635 Compare June 25, 2024 16:34
@jcsp jcsp force-pushed the jcsp/issue-5388-legacy-tenant-conf branch from 580c635 to cab720d Compare June 25, 2024 16:39
@jcsp jcsp marked this pull request as ready for review June 26, 2024 12:18
@jcsp jcsp requested a review from problame June 26, 2024 12:19
@jcsp jcsp changed the title pageserver: remove legacy tenant config code pageserver: remove legacy tenant config code, clean up redundant generation none/broken usages Jun 26, 2024
@jcsp jcsp mentioned this pull request Jun 26, 2024
5 tasks
pageserver/src/tenant/mgr.rs Show resolved Hide resolved
pageserver/src/tenant/secondary/heatmap_uploader.rs Outdated Show resolved Hide resolved
pageserver/src/http/routes.rs Outdated Show resolved Hide resolved
pageserver/src/http/routes.rs Outdated Show resolved Hide resolved
libs/pageserver_api/src/models.rs Show resolved Hide resolved
@jcsp jcsp enabled auto-merge (squash) June 26, 2024 18:44
@jcsp jcsp merged commit c39d5b0 into main Jun 26, 2024
57 checks passed
@jcsp jcsp deleted the jcsp/issue-5388-legacy-tenant-conf branch June 26, 2024 19:54
conradludgate pushed a commit that referenced this pull request Jun 27, 2024
…ration none/broken usages (#7947)

## Problem

In #5299, the new config-v1
tenant config file was added to hold the LocationConf type. We left the
old config file in place for forward compat, and because running without
generations (therefore without LocationConf) as still useful before the
storage controller was ready for prime-time.

Closes: #5388

## Summary of changes

- Remove code for reading and writing the legacy config file
- Remove Generation::Broken: it was unused.
- Treat missing config file on disk as an error loading a tenant, rather
than defaulting it. We can now remove LocationConf::default, and thereby
guarantee that we never construct a tenant with a None generation.
- Update some comments + add some assertions to clarify that
Generation::None is only used in layer metadata, not in the state of a
running tenant.
- Update docker compose test to create tenants with a generation
jcsp added a commit that referenced this pull request Jun 28, 2024
## Problem

For some time, we have created tenants with calls to location_conf. The
legacy "POST /v1/tenant" path was only used in some tests.

## Summary of changes

- Remove the API
- Relocate TenantCreateRequest to the controller API file (this used to
be used in both pageserver and controller APIs)
- Rewrite tenant_create test helper to use location_config API, as
control plane and storage controller do
- Update docker-compose test script to create tenants with
location_config API (this small commit is also present in
#7947)
jcsp added a commit that referenced this pull request Jul 2, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
VladLazar pushed a commit that referenced this pull request Jul 8, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
VladLazar pushed a commit that referenced this pull request Jul 8, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
VladLazar pushed a commit that referenced this pull request Jul 8, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
VladLazar pushed a commit that referenced this pull request Jul 8, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
VladLazar pushed a commit that referenced this pull request Jul 8, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
VladLazar pushed a commit that referenced this pull request Jul 8, 2024
## Problem

Tenant attachment has error paths for failures to write local
configuration, but these types of local storage I/O errors should be
considered fatal for the process. Related thread on an earlier PR that
touched this code:
#7947 (comment)

## Summary of changes

- Make errors writing tenant config fatal (abort process)
- When reading tenant config, make all I/O errors except ENOENT fatal
- Replace use of bare anyhow errors with `LoadConfigError`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/tech_debt Area: related to tech debt c/storage/pageserver Component: storage: pageserver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pageserver: clean up code for pre-LocationConf configuration
3 participants