Repository navigation
Support separate execution contexts for spawned nodes - #447
Open
AndrewBille wants to merge 11 commits into
Open
AndrewBille wants to merge 11 commits into
AndrewBille wants to merge 11 commits into
Conversation
| res = node.execute('select * from test') | ||
| assert (res == []) | ||
|
|
||
| def test_replicate__target_context(self): |
Collaborator
There was a problem hiding this comment.
Привет.
А чего с node_svc: PostgresNodeService тест не сделал? Оно бы проверило работу как с локальной так и с удаленной системой.
PostgresNode cloning currently always reuses the source node's OsOperations and PortManager. NodeBackup propagates that behavior to spawn_primary(), spawn_replica(), and PostgresNode.replicate(), which prevents a spawned node from running in another execution context. Add optional target_os_ops, target_host and target_port arguments and propagate them through the cloning and backup/replication path. When the target OsOperations differs, let PostgresNode select a PortManager for that context. Preserve the existing behavior when the new arguments are not specified. A physical backup contains the source node's listen_addresses setting, so override listen_addresses and port with the spawned node's values. Also remove the same-host assertion from source_walsender: master process inspection is already performed through the master's own OsOperations. Different source and target OsOperations are supported when both execution contexts can access the backup directory using the same path.
AndrewBille
force-pushed
the
target-execution-context
branch
from
October 13, 2026 08:12
18e83f7 to
cb0a4a0
Compare
The target OsOperations was previously applied only when constructing the spawned PostgresNode. The backup itself was still created using the source node's OsOperations. This worked when source and target execution contexts shared a filesystem, such as Linux network namespaces, but did not support different filesystems or remote hosts. Allow NodeBackup to use an explicit OsOperations and make PostgresNode.replicate() create the backup directly in target_os_ops. This makes pg_basebackup, temporary directory creation, copytree and backup cleanup operate in the target execution context. Spawned nodes now inherit the backup's OsOperations. When cloning into a different OsOperations, do not inherit source bin_dir or host; let the target PostgresNode resolve them from its own execution context. Add tests for backup copying across execution contexts and physical replication from a remote source to a local target.
PgLab keeps PostgreSQL lifecycle, backup and replication in Testgres while placing nodes into separate Linux network namespaces and cgroups. This provides a concrete consumer for the target execution-context replication API: replicas can use their own OsOperations, address and port while pg_basebackup runs in the target context.
Add the PgLab regression suite to Testgres tests and run the privileged Linux scenarios in a dedicated Ubuntu job. The normal test matrix only runs the API compatibility checks. Destructive netns/cgroup tests are opt-in through TESTGRES_PGLAB_TESTS and are enabled by the dedicated CI job.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PostgresNode clones currently inherit the source node's OsOperations,
host and port-management context. This prevents a replica created through
replicate()/spawn_replica() from running in another execution context.
This change adds optional target_os_ops, target_host and target_port
parameters and propagates them through the node cloning and backup
spawning path.
Existing behavior is preserved when these parameters are omitted.
The target and source execution contexts are expected to have access to
the backup directory at the same path.
The new tests cover: