Get desktop application:
View/edit binary Protocol Buffers messages
NB: unlike libpq, there is no CheckRelExists in gRPC, at the compute team's request. Instead, use GetRelSize with allow_missing=true to check existence.
Fetches a base backup.
Requests a base backup.
The LSN to fetch the base backup at. 0 or absent means the latest LSN known to the Pageserver.
If true, logical replication slots will not be created.
If true, include relation files in the base backup. Mainly for debugging and tests.
Compression algorithm to use. Base backups send a compressed payload instead of using gRPC compression, so that we can cache compressed backups on the server.
Base backup response chunk, returned as an ordered stream.
A basebackup data chunk. The size is undefined, but bounded by the 4 MB gRPC message size limit.
Returns the total size of a database, as # of bytes.
Requests the size of a database, as # of bytes. Only valid on shard 0, other shards will error.
Fetches pages. This is implemented as a bidirectional streaming RPC for performance. Unary requests incur costs for e.g. HTTP/2 stream setup, header parsing, authentication, and so on -- with streaming, we only pay these costs during the initial stream setup. This ~doubles throughput in benchmarks. Other RPCs use regular unary requests, since they are not as frequent and performance-critical, and this simplifies implementation. NB: a gRPC status response (e.g. errors) will terminate the stream. The stream may be shared by multiple Postgres backends, so we avoid this by sending them as GetPageResponse.status_code instead.
Requests one or more pages.
A request ID. Will be included in the response. Should be unique for in-flight requests on the stream.
The request class.
The LSN to read at.
The relation to read from.
Page numbers to read. Must belong to the remote shard. Multiple pages will be executed as a single batch by the Pageserver, amortizing layer access costs and parallelizing them. This may increase the latency of any individual request, but improves the overall latency and throughput of the batch as a whole. TODO: this causes an allocation in the common single-block case. The sender can use a SmallVec to stack-allocate it, but Prost will always deserialize into a heap-allocated Vec. Consider optimizing this. TODO: we might be able to avoid a sort or something if we mandate that these are always in order. But we can't currenly rely on this on the server, because of compatibility with the libpq protocol handler.
A GetPage response. A batch response will contain all of the requested pages. We could eagerly emit individual pages as soon as they are ready, but on a readv() Postgres holds buffer pool locks on all pages in the batch and we'll only return once the entire batch is ready, so no one can make use of the individual pages.
The original request's ID.
The response status code. If not OK, the rel and page fields will be empty.
A string describing the status, if any.
The relation that the pages belong to.
The page(s), in the same order as the request.
Returns the size of a relation, as # of blocks.
Fetches the size of a relation at a given LSN, as # of blocks. Only valid on shard 0, other shards will error.
If true, return missing=true for missing relations instead of a NotFound error.
The number of blocks in the relation.
If allow_missing=true, this is true for missing relations.
Fetches an SLRU segment.
Requests an SLRU segment. Only valid on shard 0, other shards will error.
Returns an SLRU segment. These are up 32 pages (256 KB), so we can send them as a single response.
Acquires or extends a lease on the given LSN. This guarantees that the Pageserver won't garbage collect the LSN until the lease expires. Must be acquired on all relevant shards.
Acquires or extends a lease on the given LSN. This guarantees that the Pageserver won't garbage collect the LSN until the lease expires. Must be acquired on all relevant shards.
The LSN to lease. Can't be 0 or below the current GC cutoff.
Lease acquisition response. If the lease could not be granted because the LSN has already been garbage collected, a FailedPrecondition status will be returned instead.
The lease expiration time.
Base backup compression algorithms.
Used in:
Unknown algorithm. Used when clients send an unsupported algorithm.
No compression.
GZIP compression.
A GetPageRequest class. Primarily intended for observability, but may also be used for prioritization in the future.
Used in:
Unknown class. For backwards compatibility: used when an older client version sends a class that a newer server version has removed.
A normal request. This is the default.
A prefetch request. NB: can only be classified on pg < 18.
A background request (e.g. vacuum).
A GetPageResponse status code. These are effectively equivalent to gRPC statuses. However, we use a bidirectional stream (potentially shared by many backends), and a gRPC status response would terminate the stream so we send GetPageResponse messages with these codes instead.
Used in:
Unknown status. For forwards compatibility: used when an older client version receives a new status code from a newer server version.
The request was successful.
The page did not exist. The tenant/timeline/shard has already been validated during stream setup.
The request was invalid.
The request failed due to an internal server error.
The tenant is rate limited. Slow down and retry later.
NB: shutdown errors are emitted as a gRPC Unavailable status. TODO: consider adding a GET_PAGE_STATUS_CODE_LAYER_DOWNLOAD in the case of a layer download. This could free up the server task to process other requests while the download is in progress.
A page. TODO: it would be slightly more efficient (but less convenient) to have separate arrays of block numbers and images, but given the 8KB page size it's probably negligible. Benchmark it anyway.
Used in:
The page number.
The materialized page image, as an 8KB byte vector.
The LSN a request should read at.
Used in: , , ,
The request's read LSN. Required.
If given, the caller guarantees that the page has not been modified since this LSN. Must be smaller than or equal to request_lsn. This allows the Pageserver to serve an old page without waiting for the request LSN to arrive. Valid for all request types. It is undefined behaviour to make a request such that the page was, in fact, modified between request_lsn and not_modified_since_lsn. The Pageserver might detect it and return an error, or it might return the old page version or the new page version. Setting not_modified_since_lsn equal to request_lsn is always safe, but can lead to unnecessary waiting.
A relation identifier.
Used in: , ,
A Request ID. Should be unique for in-flight requests on a stream. Included in the response.
Used in: ,
The base request ID.
The request attempt. Starts at 0, incremented on each retry.