Skip to content
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

[BUG] pg kbadmin or superuser account can't write data when the disk usage reaches highWatermark #4677

Closed
JashBook opened this issue Aug 7, 2023 · 1 comment
Assignees
Labels
bug kind/bug Something isn't working
Milestone

Comments

@JashBook
Copy link
Collaborator

JashBook commented Aug 7, 2023

Describe the bug
kbadmin and superuser account can't write data when the disk usage reaches highWatermark.

kbcli version
Kubernetes: v1.26.6-eks-a5565ad
KubeBlocks: 0.6.0-beta.27
kbcli: 0.6.0-beta.27

To Reproduce
Steps to reproduce the behavior:

  1. edit postgresql clusterdefinition
    volumeProtectionSpec:
      highWatermark: 90
      volumes:
      - highWatermark: 85
        name: data
  1. create pg cluster
kbcli cluster create pg-cpms --cluster-definition postgresql --set cpu=0.5,memory=1Gi,storage=1Gi,replicas=1 --termination-policy WipeOut
  1. create superuser account cpmsadmin
CREATE USER cpmsadmin WITH PASSWORD '12345678';

ALTER USER cpmsadmin WITH SUPERUSER;
  1. create table insert data until disk usage reaches highWatermark 90
echo "df -h" | kubectl exec -it pg-cpms-postgresql-0 -c postgresql -- bash

Unable to use a TTY - input is not a terminal or the right kind of file
Filesystem      Size  Used Avail Use% Mounted on
overlay          20G   14G  6.7G  67% /
tmpfs            64M     0   64M   0% /dev
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/nvme0n1p1   20G   14G  6.7G  67% /etc/hosts
tmpfs           3.3G   12K  3.3G   1% /kb-podinfo
tmpfs           3.3G   40K  3.3G   1% /dev/shm
/dev/nvme2n1   1014M  905M  110M  90% /home/postgres/pgdata
tmpfs           3.3G   12K  3.3G   1% /run/secrets/kubernetes.io/serviceaccount
tmpfs           1.9G     0  1.9G   0% /proc/acpi
tmpfs           1.9G     0  1.9G   0% /sys/firmware
  1. See error
    write data by kbadmin error
kbcli cluster connect pg-cpms --as-user kbadmin
postgres=# \c sysbenchtest
You are now connected to database "sysbenchtest" as user "kbadmin".

sysbenchtest=# INSERT INTO sbtest1 (k, c, pad) VALUES (20018, '70192647109-58773799756-61144883681-29087436526-98857870463-78730358056-02694527015-25273073842-07126702451-52494844567', '93885688285-36546175237-45117392583-60906394706-10106666018');
ERROR:  cannot execute INSERT in a read-only transaction

sysbenchtest=# UPDATE sbtest1 SET k=k+1 WHERE id=1;
ERROR:  cannot execute UPDATE in a read-only transaction
sysbenchtest=# 

write data by cpmsadmin error

kbcli cluster connect pg-cpms --as-user cpmsadmin

postgres=# \c sysbenchtest
You are now connected to database "sysbenchtest" as user "cpmsadmin".
sysbenchtest=# INSERT INTO sbtest1 (k, c, pad) VALUES (20018, '70192647109-58773799756-61144883681-29087436526-98857870463-78730358056-02694527015-25273073842-07126702451-52494844567', '93885688285-36546175237-45117392583-60906394706-10106666018');
ERROR:  cannot execute INSERT in a read-only transaction

sysbenchtest=# UPDATE sbtest1 SET k=k+1 WHERE id=1;
ERROR:  cannot execute UPDATE in a read-only transaction

Expected behavior
pg kbadmin or superuser account can write data when the disk usage reaches highWatermark.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@JashBook JashBook added the kind/bug Something isn't working label Aug 7, 2023
@JashBook JashBook added this to the Release 0.6.0 milestone Aug 7, 2023
@xuriwuyun
Copy link
Contributor

As the disk protection lock is set at the instance level, neither the admin nor the superuser have the ability to write to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants