Repository navigation
feat(bootstrap): support tablespaceMapping for pg_basebackup - #11649
Conversation
|
❗ By default, the pull request is configured to backport to all release branches.
|
|
This is based on #11595 and requires it to be merged. Source tablespaces are not checked before pg_basebackup. The tablespace list isn't available over the replication connection pg_basebackup uses, so a check would need a second, regular SQL connection to the source. That would be a new requirement, because a REPLICATION LOGIN role accepted for replication in pg_hba.conf often can't open regular connections. The webhook covers part of the gap. It rejects invalid mappings (unknown or duplicate names, relative or duplicate sourceLocation, or one containing =). It also warns about tablespaces declared in spec.tablespaces without a mapping, since that's only valid if the source uses the CloudNativePG location. It can't detect source tablespaces that aren't declared at all. The docs describe this limitation. |
|
/test |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/38547152293 |
d9ed2f8 to
a7c1f87
Compare
Users can now map each tablespace declared in spec.tablespaces to its location in the source instance when bootstrapping from a live cluster. Keys must be a subset of the declared tablespaces. Signed-off-by: Leonardo Cecchi <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
…ping pg_basebackup relocates tablespaces by path, while the operator reconciles them by name, so a tablespace declared under a different name than in the source would be created again on a directory that is already in use. The sample now uses a source path that does not look like the CloudNativePG layout, which ends in /data. Signed-off-by: Armando Ruocco <[email protected]>
The source instance gets a tablespace outside the CloudNativePG layout, and the target maps it to its own volume. Every instance of the target, including the replica that joins the new primary, must find the tablespace in the CloudNativePG location with the data of the source. Signed-off-by: Armando Ruocco <[email protected]>
…them pg_basebackup canonicalizes the old directory of a tablespace mapping before matching it, so two entries such as /data/ts and /data/ts/ refer to the same tablespace. The webhook compared them as plain strings and accepted both. Signed-off-by: Armando Ruocco <[email protected]>
a7c1f87 to
777f4c7
Compare
Signed-off-by: Gabriele Bartolini <[email protected]>
tablespaceMapping for pg_basebackup
It fired on every create and update of a pg_basebackup cluster with tablespaces and no mapping, including valid clones from a CloudNativePG source, and the webhook cannot tell the two cases apart. The docs warning stays. Signed-off-by: Marco Nenciarini <[email protected]>
Drop the checks the CRD already enforces (unique names, non-empty values) and the test that bypassed it. The job test now uses literal paths, adds a path with a space and the additional arguments, and parses the result. Signed-off-by: Marco Nenciarini <[email protected]>
pg_basebackup uses a backslash to escape the equal sign in a tablespace mapping, so a location ending in one makes it fail to parse the mapping. Signed-off-by: Marco Nenciarini <[email protected]>
Say that the operator does not check the tablespaces of the source and when an unmapped one fails, add the missing periods to the API comments, shorten the webhook comment, and explain the e2e source path. Signed-off-by: Marco Nenciarini <[email protected]>
|
/test ft=recovery tl=1 d=push |
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/38720018820 |
…udnative-pg/cloudnative-pg#11649) Sources that do not follow the CloudNativePG tablespace layout could not be cloned with `pg_basebackup`. Add `spec.bootstrap.pg_basebackup.tablespaceMapping` to map each tablespace declared in `spec.tablespaces` to its location in the source instance. The operator passes one `--tablespace-mapping` per entry to `pg_basebackup` for the initial clone. Replica joins do not use it. Closes cloudnative-pg/cloudnative-pg#11621 Signed-off-by: Leonardo Cecchi <[email protected]> Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Gabriele Bartolini <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Armando Ruocco <[email protected]> Co-authored-by: Gabriele Bartolini <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit cloudnative-pg/cloudnative-pg@89e5adb)
Sources that do not follow the CloudNativePG tablespace layout could not be cloned with
pg_basebackup. Addspec.bootstrap.pg_basebackup.tablespaceMappingto map each tablespace declared inspec.tablespacesto its location in the source instance. The operator passes one--tablespace-mappingper entry topg_basebackupfor the initial clone. Replica joins do not use it.Closes #11621
Add to the release notes: