Skip to content

Add WAL content for 2.0 release #499

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

Open
wants to merge 4 commits into
base: TDE_REL_17_STABLE
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following sections break down the key architectural components of this desig
* Indexes
* Sequences
* Temporary tables
* Write Ahead Log (WAL), still in beta. **Do not enable this feature in production environments**.
* Write Ahead Log (WAL)

**Extension** means that `pg_tde` should be implemented only as an extension, possibly compatible with any PostgreSQL distribution, including the open source community version. This requires changes in the PostgreSQL core to make it more extensible. Therefore, `pg_tde` currently works only with the [Percona Server for PostgreSQL](https://docs.percona.com/postgresql/17/index.html) - a binary replacement of community PostgreSQL and included in Percona Distribution for PostgreSQL.

Expand Down Expand Up @@ -82,9 +82,6 @@ Later decisions are made using a slightly modified Storage Manager (SMGR) API: w

### WAL encryption

!!! note
The WAL encryption feature is currently in beta and is not effective unless explicitly enabled. It is not yet production ready. **Do not enable this feature in production environments**.

WAL encryption is controlled globally via a global GUC variable, `pg_tde.wal_encrypt`, that requires a server restart.

WAL keys also contain the [LSN](https://www.postgresql.org/docs/17/wal-internals.html) of the first WAL write after key creation. This allows `pg_tde` to know which WAL ranges are encrypted or not and with which key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

[`pg_waldump` :octicons-link-external-16:](https://www.postgresql.org/docs/current/pgwaldump.html) is a tool to display a human-readable rendering of the Write-Ahead Log (WAL) of a PostgreSQL database cluster.

!!! warning
The WAL encryption feature is currently in beta and is not effective unless explicitly enabled. It is not yet production ready. **Do not enable this feature in production environments**.

To read encrypted WAL records, `pg_waldump` supports the following additional arguments:

* `keyring_path` is the directory where the keyring configuration files for WAL are stored. The following files are included:
Expand Down
5 changes: 1 addition & 4 deletions contrib/pg_tde/documentation/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ The principal key is used to encrypt the internal keys. The principal key is sto

### WAL encryption

!!! note
WAL encryption is currently in beta and is not effective unless explicitly enabled. It is not yet production ready. **Do not enable this feature in production environments**.

WAL encryption is done globally for the entire database cluster. All modifications to any database within a PostgreSQL cluster are written to the same WAL to maintain data consistency and integrity and ensure that PostgreSQL cluster can be restored to a consistent state. Therefore, WAL is encrypted globally.

When you turn on WAL encryption, `pg_tde` encrypts entire WAL files starting from the first WAL write after the server was started with the encryption turned on.
Expand Down Expand Up @@ -140,7 +137,7 @@ Since the `SET ACCESS METHOD` command drops hint bits and this may affect the pe
You must restart the database in the following cases to apply the changes:

* after you enabled the `pg_tde` extension
* when enabling WAL encryption, which is currently in beta. **Do not enable this feature in production environments**.
* when enabling WAL encryption

After that, no database restart is required. When you create or alter the table using the `tde_heap` access method, the files are marked as those that require encryption. The encryption happens at the storage manager level, before a transaction is written to disk. Read more about [how tde_heap works](index/table-access-method.md#how-tde_heap-works-with-pg_tde).

Expand Down
5 changes: 1 addition & 4 deletions contrib/pg_tde/documentation/docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ SELECT pg_tde_create_key_using_database_key_provider(

### pg_tde_create_key_using_global_key_provider

Creates a principal key at a global key provider with the given name. Use this key later with the `pg_tde_set_` series of functions.
Creates a principal key at a global key provider with the given name. Use this key later with the `pg_tde_set_*` series of functions.

```sql
SELECT pg_tde_create_key_using_global_key_provider(
Expand Down Expand Up @@ -286,9 +286,6 @@ SELECT pg_tde_set_server_key_using_global_key_provider(
);
```

!!! warning
The WAL encryption feature is currently in beta and is not effective unless explicitly enabled. It is not yet production ready. **Do not enable this feature in production environments**.

The `ensure_new_key` parameter instructs the function how to handle a principal key during key rotation:

* If set to `true`, a new key must be unique.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Global Principal Key configuration

You can configure a default principal key using a global key provider. This key will be used by all databases that do not have their own encryption keys configured. The function **both** sets the principal key and rotates internal keys as needed.
You can configure a default principal key using a global key provider. This key is used by all databases that do not have their own encryption keys configured.

There are two main functions for this:

- [pg_tde_create_key_using_global_key_provider()](../functions.md#pg_tde_create_key_using_global_key_provider) creates a principal key at a global key provider
- [pg_tde_set_default_key_using_global_key_provider()](../functions.md#pg_tde_set_default_key_using_global_key_provider) sets the default principal key and rotates the internal encryption key if one is already configured

## Create a default principal key

!!! note

The sample output below is for demonstration purposes only. Be sure to replace the key name and provider with your actual values.

To create a global principal key, run:
Expand Down Expand Up @@ -57,15 +63,19 @@ SELECT pg_tde_set_default_key_using_global_key_provider(
* `global_vault_provider` is the name of the global key provider you previously configured.

!!! note

If no error is reported, the action completed successfully.

## How key generation works

The key material (actual cryptographic key) is auto-generated by `pg_tde` and stored securely by the configured provider.

!!! note

This process sets the **default principal key for the entire server**. Any database without a key explicitly configured will fall back to this key.

## Next steps

To confirm that encryption is working as expected, follow the validation steps:

[Validate Encryption with pg_tde :material-arrow-right:](../test.md){.md-button}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
The following are current limitations of `pg_tde`:

* System tables, which include statistics data and database statistics, are currently **not encrypted**.
* The WAL encryption feature is currently in beta and is not effective unless explicitly enabled. It is not yet production ready. **Do not enable this feature in production environments**.

[View the versions and supported deployments :material-arrow-right:](supported-versions.md){.md-button}
2 changes: 1 addition & 1 deletion contrib/pg_tde/documentation/docs/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ ALTER TABLE table_name SET ACCESS METHOD tde_heap;

## Next steps

[Configure WAL Encryption (tech preview) :material-arrow-right:](wal-encryption.md){.md-button}
[Configure WAL encryption :material-arrow-right:](wal-encryption.md){.md-button}
7 changes: 3 additions & 4 deletions contrib/pg_tde/documentation/docs/wal-encryption.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Configure WAL Encryption (tech preview)

!!! warning
The WAL encryption feature is currently in beta and is not effective unless explicitly enabled. It is not yet production ready. **Do not enable this feature in production environments**.
# Configure WAL encryption

Before enabling WAL encryption, follow the steps below to create a principal key and configure it for WAL:

Expand Down Expand Up @@ -118,3 +115,5 @@ Now WAL files start to be encrypted for both encrypted and unencrypted tables.

For more technical references related to architecture, variables or functions, see:
[Technical Reference](advanced-topics/tech-reference.md){.md-button}

💬 Need help customizing this for your infrastructure? [Contact Percona support :octicons-link-external-16:](get-help.md)
2 changes: 1 addition & 1 deletion contrib/pg_tde/documentation/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ nav:
- "Keyring file configuration": global-key-provider-configuration/keyring.md
- "2.2 Global Principal Key configuration": global-key-provider-configuration/set-principal-key.md
- "3. Validate encryption with pg_tde": test.md
- "4. Configure WAL encryption (tech preview)": wal-encryption.md
- "4. Configure WAL encryption": wal-encryption.md
- "Technical reference":
- "Overview": advanced-topics/tech-reference.md
- "Architecture": architecture/architecture.md
Expand Down