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] postgresql-12.14.1 cannot get recoverable-time when pitr #7396

Closed
haowen159 opened this issue May 21, 2024 · 4 comments
Closed

[BUG] postgresql-12.14.1 cannot get recoverable-time when pitr #7396

haowen159 opened this issue May 21, 2024 · 4 comments
Assignees
Labels
kind/bug Something isn't working severity/major Great chance user will encounter the same problem
Milestone

Comments

@haowen159
Copy link
Collaborator

Describe the bug
postgresql-12.14.1 cannot get recoverable-time when pitr

To Reproduce
Steps to reproduce the behavior:
1.create cluster in postgresql-12.14.1

kbcli cluster create  postgres-roddsn --termination-policy=Delete --cluster-definition=postgresql --enable-all-logs=false --cluster-version=postgresql-12.14.1 --set cpu=100m,memory=0.5Gi,replicas=2,storage=3Gi  --namespace default
  1. check status
k get cluster postgres-roddsn
NAME              CLUSTER-DEFINITION   VERSION              TERMINATION-POLICY   STATUS    AGE
postgres-roddsn   postgresql           postgresql-12.14.1   Delete               Running   20m

3.open archive-wal

kubectl patch backupschedule postgres-roddsn-postgresql-backup-schedule --namespace default --type json \
                    -p '[{"op": "replace", "path": "/spec/schedules/'$patch_index'/cronExpression","value":"*/1 * * * *"}]'
kubectl patch backupschedule postgres-roddsn-postgresql-backup-schedule  --namespace default --type json \
                    -p '[{"op": "replace", "path": "/spec/schedules/'$patch_index'/enabled","value":true}]'

$patch_index is the index of archive-wal in set schedules.
see status

k get backupschedule postgres-roddsn-postgresql-backup-schedule -o yaml
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: BackupSchedule
metadata:
  annotations:
    apps.kubeblocks.io/backup-policy-template: postgresql-backup-policy-template
    config.kubeblocks.io/last-applied-configuration: '[{"key":"archive_command","value":"''''"}]'
    dataprotection.kubeblocks.io/is-default-policy: "true"
    dataprotection.kubeblocks.io/reconfigure-ref: |
      {
        "name": "postgresql-configuration",
        "key": "postgresql.conf",
        "enable": {
          "archive-wal": [{"key": "archive_command","value": "''"}]
        },
        "disable": {
          "archive-wal": [{ "key": "archive_command","value": "'/bin/true'"}]
        }
      }
  creationTimestamp: "2024-05-21T07:18:25Z"
  finalizers:
  - cluster.kubeblocks.io/finalizer
  - dataprotection.kubeblocks.io/finalizer
  generation: 6
  labels:
    app.kubernetes.io/instance: postgres-roddsn
    app.kubernetes.io/managed-by: kubeblocks
    apps.kubeblocks.io/component-def-ref: postgresql
    apps.kubeblocks.io/component-name: postgresql
    dataprotection.kubeblocks.io/backup-policy: postgres-roddsn-postgresql-backup-policy
  name: postgres-roddsn-postgresql-backup-schedule
  namespace: default
  ownerReferences:
  - apiVersion: apps.kubeblocks.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Cluster
    name: postgres-roddsn
    uid: c0ae0ee9-0e34-44ef-8a92-3144aa50196d
  resourceVersion: "12084"
  uid: d9e63078-b9b1-434b-b311-49b9882c3653
spec:
  backupPolicyName: postgres-roddsn-postgresql-backup-policy
  schedules:
  - backupMethod: pg-basebackup
    cronExpression: '* 18 * * *'
    enabled: false
    retentionPeriod: 7d
  - backupMethod: volume-snapshot
    cronExpression: '* 18 * * *'
    enabled: false
    retentionPeriod: 7d
  - backupMethod: wal-g
    cronExpression: '* 18 * * *'
    enabled: false
    retentionPeriod: 7d
  - backupMethod: archive-wal
    cronExpression: '*/1 * * * *'
    enabled: true
    retentionPeriod: 8d
status:
  observedGeneration: 6
  phase: Available
  1. create backup
kbcli cluster backup postgres-roddsn --method pg-basebackup --namespace default

see status

kbcli cluster list-backups postgres-roddsn --namespace default
NAME                                            NAMESPACE   SOURCE-CLUSTER    METHOD          STATUS                                  TOTAL-SIZE   DURATION   CREATE-TIME                  COMPLETION-TIME              EXPIRATION                   
d9e63078-postgres-roddsn-postg-archive-wal      default     postgres-roddsn   archive-wal     Running(AvailablePods: 1374397479904)   188071                  May 21,2024 15:21 UTC+0800                                May 29,2024 15:21 UTC+0800   
backup-default-postgres-roddsn-20240521152209   default     postgres-roddsn   pg-basebackup   Completed                               3006253      10s        May 21,2024 15:22 UTC+0800   May 21,2024 15:22 UTC+0800            

5.describe cluster

kbcli cluster describe postgres-roddsn
Name: postgres-roddsn    Created Time: May 21,2024 15:18 UTC+0800
NAMESPACE   CLUSTER-DEFINITION   VERSION              STATUS    TERMINATION-POLICY   
default     postgresql           postgresql-12.14.1   Running   Delete               

Endpoints:
COMPONENT    MODE        INTERNAL                                                    EXTERNAL   
postgresql   ReadWrite   postgres-roddsn-postgresql.default.svc.cluster.local:5432   <none>     
                         postgres-roddsn-postgresql.default.svc.cluster.local:6432              

Topology:
COMPONENT    INSTANCE                       ROLE        STATUS    AZ       NODE                              CREATED-TIME                 
postgresql   postgres-roddsn-postgresql-1   secondary   Running   <none>   k3d-default-server-0/172.19.0.3   May 21,2024 15:18 UTC+0800   
postgresql   postgres-roddsn-postgresql-0   primary     Running   <none>   k3d-default-server-0/172.19.0.3   May 21,2024 15:18 UTC+0800   

Resources Allocation:
COMPONENT    DEDICATED   CPU(REQUEST/LIMIT)   MEMORY(REQUEST/LIMIT)   STORAGE-SIZE   STORAGE-CLASS     
postgresql   false       100m / 100m          512Mi / 512Mi           data:3Gi       csi-hostpath-sc   

Images:
COMPONENT    TYPE         IMAGE                                              
postgresql   postgresql   docker.io/apecloud/spilo:12.14.1-pgvector-v0.6.1   

Data Protection:
BACKUP-REPO             AUTO-BACKUP   BACKUP-SCHEDULE   BACKUP-METHOD   BACKUP-RETENTION   RECOVERABLE-TIME   
backuprepo-kbcli-test   Enabled       */1 * * * *       archive-wal     8d                                    

Show cluster events: kbcli cluster list-events -n default postgres-roddsn

see error
The RECOVERABLE-TIME is empty!

6. Create a cluster in the PostgreSQL-14.8.0 engine and perform the same steps,RECOVERABLE-TIME is not empty

kbcli cluster describe postgres-wiqbxx
Name: postgres-wiqbxx    Created Time: May 21,2024 15:28 UTC+0800
NAMESPACE   CLUSTER-DEFINITION   VERSION             STATUS    TERMINATION-POLICY   
default     postgresql           postgresql-14.8.0   Running   WipeOut              

Endpoints:
COMPONENT    MODE        INTERNAL                                                    EXTERNAL   
postgresql   ReadWrite   postgres-wiqbxx-postgresql.default.svc.cluster.local:5432   <none>     
                         postgres-wiqbxx-postgresql.default.svc.cluster.local:6432              

Topology:
COMPONENT    INSTANCE                       ROLE      STATUS    AZ       NODE                              CREATED-TIME                 
postgresql   postgres-wiqbxx-postgresql-0   primary   Running   <none>   k3d-default-server-0/172.19.0.3   May 21,2024 15:28 UTC+0800   

Resources Allocation:
COMPONENT    DEDICATED   CPU(REQUEST/LIMIT)   MEMORY(REQUEST/LIMIT)   STORAGE-SIZE   STORAGE-CLASS     
postgresql   false       100m / 100m          512Mi / 512Mi           data:3Gi       csi-hostpath-sc   

Images:
COMPONENT    TYPE         IMAGE                                             
postgresql   postgresql   docker.io/apecloud/spilo:14.8.0-pgvector-v0.6.1   

Data Protection:
BACKUP-REPO             AUTO-BACKUP   BACKUP-SCHEDULE   BACKUP-METHOD   BACKUP-RETENTION   RECOVERABLE-TIME                                                
backuprepo-kbcli-test   Enabled       */1 * * * *       archive-wal     8d                 May 21,2024 15:30:57 UTC+0800 ~ May 21,2024 15:31:34 UTC+0800   

Show cluster events: kbcli cluster list-events -n default postgres-wiqbxx

Expected behavior
A clear and concise description of what you expected to happen.

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.

@haowen159 haowen159 added the kind/bug Something isn't working label May 21, 2024
@JashBook JashBook added the severity/major Great chance user will encounter the same problem label May 21, 2024
@wangyelei
Copy link
Contributor

Your operation is not a problem. But the recoverable time is between fullBackup.status.timeRange.end (and startTime must be greater than continuous Backup.status.timeRange.start)~continuous Backup.status. timeRange.end. You can check it.

@haowen159
Copy link
Collaborator Author

Your operation is not a problem. But the recoverable time is between fullBackup.status.timeRange.end (and startTime must be greater than continuous Backup.status.timeRange.start)~continuous Backup.status. timeRange.end. You can check it.
img_v3_02b4_7db6e377-8f6e-4aea-af13-37671a180c4g
According to the information in the preceding figure, the full backup is created after the incremental backup,which is same to step 4.

@wangyelei
Copy link
Contributor

pls check the backup.status.timeRange, it is real data time range.

@wangyelei
Copy link
Contributor

fixed at apecloud/kubeblocks-addons#578

@github-actions github-actions bot added this to the Release 0.8.3 milestone May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working severity/major Great chance user will encounter the same problem
Projects
None yet
Development

No branches or pull requests

3 participants