Documentation
¶
Overview ¶
Package wal contains reusable code for WAL interactions.
Index ¶
Constants ¶
const GRPCInitialConnWindowSizeBytes = 64 * 1024 * 1024 // 64 MiB
GRPCInitialConnWindowSizeBytes is the HTTP/2 per-connection flow-control window. It must be at least as large as GRPCInitialWindowSizeBytes; we oversize it to leave room for multiple concurrent streams on the same connection.
const GRPCInitialWindowSizeBytes = 16 * 1024 * 1024 // 16 MiB
GRPCInitialWindowSizeBytes is the HTTP/2 per-stream flow-control window used by both the WAL gRPC client and server. Sized at 2× MaxBlockSizeBytes so that streaming a WAL block does not require multiple WINDOW_UPDATE round trips.
const GRPCOverheadBytes = 512 * 1024 // 512 KiB
GRPCOverheadBytes is the extra allowance we add server-side to account for gRPC framing (compressed proto headers, envelopes, etc.). Empirically sized at 512 KiB to safely accommodate framing for an 8 MiB payload.
const GRPCSocketBufferSizeBytes = 1 * 1024 * 1024 // 1 MiB
GRPCSocketBufferSizeBytes is the TCP socket read/write buffer size hint for the gRPC transport. Larger values help sustain high throughput on links with non-trivial RTT.
const MaxBlockSizeBytes = 8 * 1024 * 1024 // 8 MiB
MaxBlockSizeBytes is the maximum WAL block payload size (without gRPC framing) accepted by the server. Client-side commands sending WAL data must keep each message <= this size.
const MaxGRPCMessageSizeBytes = MaxBlockSizeBytes + GRPCOverheadBytes
MaxGRPCMessageSizeBytes is the maximum total message size (payload + gRPC framing) we accept/send.
const PartialSuffix = ".partial"
PartialSuffix is the suffix carried by a WAL segment that was not fully received, such as one left behind by a failover.
Variables ¶
This section is empty.
Functions ¶
func IsPartialWALFile ¶
IsPartialWALFile reports whether name is the .partial variant of a complete WAL segment, such as one left behind by a failover.
func IsWALSegmentOrPartial ¶
IsWALSegmentOrPartial reports whether name is a complete WAL segment or its .partial variant.
func TrimPartialSuffix ¶
TrimPartialSuffix returns name without the .partial suffix.
func WithPartialSuffix ¶
WithPartialSuffix returns name with the .partial suffix, if it does not already have it.
Types ¶
type Feedback ¶
type Feedback struct {
// corresponding to flush_lsn in pg_stat_replication
FlushLSN uint64
// corresponding to write_lsn in pg_stat_replication
WriteLSN uint64
// corresponding to replay_lsn in pg_stat_replication
ReplayLSN uint64
}
Feedback represents the feedback we get from the Klio server when writing a WAL file.