Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,18 @@ lifecycle
lifecycle
lsn
md
pg
pluggable
pluginName
postgres
prefetching
proto
reconciler
reconcilers
reconcilers
requeue
requeue
rewind
rfc
rfc
rpc
Expand Down
15 changes: 15 additions & 0 deletions docs/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
- [WALStatusResult.AdditionalInformationEntry](#cnpgi-wal-v1-WALStatusResult-AdditionalInformationEntry)

- [WALCapability.RPC.Type](#cnpgi-wal-v1-WALCapability-RPC-Type)
- [WALRestoreRequest.Mode](#cnpgi-wal-v1-WALRestoreRequest-Mode)

- [WAL](#cnpgi-wal-v1-WAL)

Expand Down Expand Up @@ -1703,6 +1704,7 @@ Intentionally empty.
| source_wal_name | [string](#string) | | This field is REQUIRED. Value of this field is the name of the WAL to be retrieved from the archive, such as: 000000010000000100000012 |
| destination_file_name | [string](#string) | | This field is REQUIRED. Value of this field is the full path where the WAL file should be stored |
| parameters | [WALRestoreRequest.ParametersEntry](#cnpgi-wal-v1-WALRestoreRequest-ParametersEntry) | repeated | This field is OPTIONAL. Values are opaque. |
| mode | [WALRestoreRequest.Mode](#cnpgi-wal-v1-WALRestoreRequest-Mode) | | This field is OPTIONAL. Value of this field is the context the WAL file is being restored in |



Expand Down Expand Up @@ -1799,6 +1801,19 @@ Intentionally empty.
| TYPE_SET_FIRST_REQUIRED | 4 | TYPE_SET_FIRST_REQUIRED indicates that the Plugin is able to reply to the SetFirstRequired RPC request |



<a name="cnpgi-wal-v1-WALRestoreRequest-Mode"></a>

### WALRestoreRequest.Mode


| Name | Number | Description |
| ---- | ------ | ----------- |
| MODE_UNSPECIFIED | 0 | MODE_UNSPECIFIED must be interpreted as MODE_RECOVERY: it is what an operator predating this field sends |
| MODE_RECOVERY | 1 | MODE_RECOVERY indicates that the WAL file is being restored by the restore_command of an instance in recovery |
| MODE_REWIND | 2 | MODE_REWIND indicates that the WAL file is being restored on behalf of pg_rewind. pg_rewind fetches every WAL file it needs exactly once, walking the timeline backwards, and treats any restore failure as fatal: the plugin should retrieve exactly the requested file, without WAL prefetching and without caching archive misses observed on nearby WAL files |





Expand Down
166 changes: 121 additions & 45 deletions pkg/wal/wal.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions proto/wal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ message WALArchiveResult {
}

message WALRestoreRequest {
enum Mode {
// MODE_UNSPECIFIED must be interpreted as MODE_RECOVERY: it is
// what an operator predating this field sends
MODE_UNSPECIFIED = 0;

// MODE_RECOVERY indicates that the WAL file is being restored
// by the restore_command of an instance in recovery
MODE_RECOVERY = 1;

// MODE_REWIND indicates that the WAL file is being restored on
// behalf of pg_rewind. pg_rewind fetches every WAL file it needs
// exactly once, walking the timeline backwards, and treats any
// restore failure as fatal: the plugin should retrieve exactly the
// requested file, without WAL prefetching and without caching
// archive misses observed on nearby WAL files
MODE_REWIND = 2;
}

// This field is REQUIRED. Value of this field is the JSON
// serialization of the Cluster corresponding to the Pod being applied
bytes cluster_definition = 1;
Expand All @@ -70,6 +88,10 @@ message WALRestoreRequest {

// This field is OPTIONAL. Values are opaque.
map<string, string> parameters = 4;

// This field is OPTIONAL. Value of this field is the context the
// WAL file is being restored in
Mode mode = 5;
}

message WALRestoreResult {
Expand Down