Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 4.13 KB

File metadata and controls

76 lines (58 loc) · 4.13 KB
title pg hardstorage wal fetch
description CLI reference for the pg hardstorage wal fetch command.
tags
cli
reference

pg_hardstorage wal fetch

Fetch one WAL segment from the repository (restore_command shim)

Synopsis

Reassemble one PostgreSQL WAL segment from the repository's content-addressed chunk store into .

PostgreSQL invokes this command from restore_command during recovery; the canonical configuration line is:

restore_command = 'pg_hardstorage wal fetch %f %p --repo '

The deployment + repo identify the source; %f and %p are PG's substitutions for the segment file name and the target path respectively.

Exit codes: 0 - segment retrieved and written 6 - segment not in repo (ExitNotFound)

0 - other error (network, repo missing, etc.)

IMPORTANT: at end-of-archive this command exits 6, NOT 1. PostgreSQL's postmaster treats any restore_command exit other than 0/1 as a crash and restarts recovery, which loops forever once the cluster is caught up. The canonical restore_command above must therefore map 6 -> 1 (the "no more WAL, stop and promote" signal PG expects). The line that pg_hardstorage restore writes does this automatically via the shim '...; ec=$?; [ $ec = 6 ] && exit 1 || exit $ec'. If you hand-write restore_command, you MUST include that 6->1 mapping yourself.

pg_hardstorage wal fetch <deployment> <segment-name> <target-path> [flags]

Options

  -h, --help          help for fetch
      --repo string   repository URL (file://, s3://, ...) — must already exist (required)

Options inherited from parent commands

      --airgapped airgapped: strict                                                       refuse outbound endpoints (LLM providers, sinks, OTLP collectors) outside loopback / RFC1918 / explicit airgap.allowlist. Also enabled by PG_HARDSTORAGE_AIRGAPPED=1 or airgapped: strict in the config file.
  -c, --config string                                                                     path to config file (default: XDG/FHS lookup)
      --cpu-profile go tool pprof <path>                                                  write a pprof CPU profile to this path for the duration of the command (go tool pprof <path> to analyse). Off when empty.
      --mem-profile string                                                                write a pprof heap profile to this path at command exit. Off when empty.
      --no-color                                                                          disable ANSI color in text output
      --on-error-llm                                                                      on a structured-error failure, drop into the matching LLM helper skill (auto_on_error trigger). Also enabled by PG_HARDSTORAGE_ON_ERROR_LLM=1.
      --otel-endpoint string                                                              OpenTelemetry OTLP/HTTP endpoint (e.g. http://otel-collector:4318); empty disables tracing
      --otel-stdout                                                                       also export OpenTelemetry traces to stderr (useful for dev)
  -o, --output string                                                                     output format: text|json|ndjson|yaml|template|csv|markdown|html|tap|junit|pdf (default: text on TTY, json off-TTY)
      --profile-port go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=30   if non-zero, expose net/http/pprof on 127.0.0.1:<port> for live profiling of long-running commands (e.g. go tool pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=30). Off when zero.
  -q, --quiet                                                                             suppress non-essential output
      --template string                                                                   Go text/template applied when --output template (or implied if --template is set without --output)

SEE ALSO