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

Epic: pageserver support for sharding phase 1 #5507

Closed
9 of 15 tasks
jcsp opened this issue Oct 9, 2023 · 1 comment
Closed
9 of 15 tasks

Epic: pageserver support for sharding phase 1 #5507

jcsp opened this issue Oct 9, 2023 · 1 comment
Assignees
Labels
c/storage/pageserver Component: storage: pageserver t/Epic Issue type: Epic t/feature Issue type: feature, for new features or requests

Comments

@jcsp
Copy link
Contributor

jcsp commented Oct 9, 2023

This epic describes the pageserver changes required to enable sharding phase 1.

Phase 1 does not include splitting: tenants will be created with a set number of shards.

Tasks

Part 1: establish APIs

Milestone: control plane code that expects sharding-aware APIs can talk to the pageserver, and compute will work when using a ShardMap to talk to multiple pageservers.

Tasks

Part 2: make sharding work

Milestone: the shards within a tenant will store different data: we can demonstrate hosting a 1TiB tenant where each pageserver only holds 1/nth data.

Tasks

  1. c/storage/pageserver t/feature
    jcsp
  2. c/storage/pageserver t/feature
    jcsp
  3. c/storage/pageserver t/feature
    jcsp

Part 3: Loose ends

Outstanding loose ends items moved into #6288

Tasks

  1. c/storage/pageserver t/feature
  2. c/storage/pageserver t/feature
    jcsp
  3. a/tech_debt c/storage/pageserver
    jcsp
  4. a/tech_debt c/storage/pageserver
    jcsp
@jcsp jcsp added t/feature Issue type: feature, for new features or requests c/storage/pageserver Component: storage: pageserver t/Epic Issue type: Epic labels Oct 9, 2023
jcsp added a commit that referenced this issue Dec 5, 2023
)

## Problem

When a pageserver receives a page service request identified by
TenantId, it must decide which `Tenant` object to route it to.

As in earlier PRs, this stuff is all a no-op for tenants with a single
shard: calls to `is_key_local` always return true without doing any
hashing on a single-shard ShardIdentity.

Closes: #6026

## Summary of changes

- Carry immutable `ShardIdentity` objects in Tenant and Timeline. These
provide the information that Tenants/Timelines need to figure out which
shard is responsible for which Key.
- Augment `get_active_tenant_with_timeout` to take a `ShardSelector`
specifying how the shard should be resolved for this tenant. This mode
depends on the kind of request (e.g. basebackups always go to shard
zero).
- In `handle_get_page_at_lsn_request`, handle the case where the
Timeline we looked up at connection time is not the correct shard for
the page being requested. This can happen whenever one node holds
multiple shards for the same tenant. This is currently written as a
"slow path" with the optimistic expectation that usually we'll run with
one shard per pageserver, and the Timeline resolved at connection time
will be the one serving page requests. There is scope for optimization
here later, to avoid doing the full shard lookup for each page.
- Omit consumption metrics from nonzero shards: only the 0th shard is
responsible for tracing accurate relation sizes.

Note to reviewers:
- Testing of these changes is happening separately on the
`jcsp/sharding-pt1` branch, where we have hacked neon_local etc needed
to run a test_pg_regress.
- The main caveat to this implementation is that page service
connections still look up one Timeline when the connection is opened,
before they know which pages are going to be read. If there is one shard
per pageserver then this will always also be the Timeline that serves
page requests. However, if multiple shards are on one pageserver then
get page requests will incur the cost of looking up the correct Timeline
on each getpage request. We may look to improve this in future with a
"sticky" timeline per connection handler so that subsequent requests for
the same Timeline don't have to look up again, and/or by having postgres
pass a shard hint when connecting. This is tracked in the "Loose ends"
section of #5507
@jcsp
Copy link
Contributor Author

jcsp commented Jan 8, 2024

Loose ends moved into #6288

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 t/Epic Issue type: Epic t/feature Issue type: feature, for new features or requests
Projects
None yet
Development

No branches or pull requests

1 participant