When running a plcontainer function with resource groups, (See PL/Container Resource Management), it reports and error for the cgroup-parent:
postgres=# select dummyPython();
ERROR: plcontainer: backend create error (containers.c:405)
DETAIL: Failed to create container, return code: 400, detail: {"message":"cgroup-parent for systemd cgroup should be a valid slice named as \"xxx.slice\""}
CONTEXT: PLContainer function "dummypython"
postgres=#
The issue is caused by the way the docker is started in the systemd/systemctl. Check with "docker info":
docker info Client: Version: 27.3.1 Context: default Debug Mode: false ... Using metacopy: true Native Overlay Diff: false userxattr: false Logging Driver: json-file Cgroup Driver: systemd <------------ NOTE HERE Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay ... 127.0.0.0/8 Live Restore Enabled: false
To resolve the issue, use the following command to update docker's configuration.
sudo systemctl edit docker.service
and set the cgroup driver to cgroupfs by appending '--exec-opt native.groupdriver=cgroupfs' to the docker start command.
[Service]
...
ExecStart=/path/to/dockerd ... --exec-opt native.cgroupdriver=cgroupfs
...
Then restart docker by
sudo systemctl restart docker
The re-run the plcontainer function. The container process should be controlled by gpdb's resource group under '/sys/fs/cgroup/gpdb.service'.