[Bug]: New replica searches for WAL archive that doesn't exist

Is there an existing issue already for this bug?

[X] I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

[X] I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

[X] I have read the troubleshooting guide and I think this is a new bug.

Contact Details
<EMAIL_ADDRESS>Version
1.23.0
What version of Kubernetes are you using?
1.29
What is your Kubernetes environment?
Cloud: Amazon EKS
How did you install the operator?
YAML manifest
What happened?

Cluster experienced an issue and failed over (Node resources issue)
Original primary does not come back online. End up destroying it
Make a volume snapshot before starting new replica so the recovery doesn't have to go through large WAL archive
When attempting to spin up a new replica the logs suggest the new replica is looking for a WAL archive that doesn't exist.

Status of cluster at time the new replica is requested (scaling up)
First Point of Recoverability:  2024-04-30T14:01:25Z
Working WAL archiving:          OK
WALs waiting to be archived:    0
Last Archived WAL:<PHONE_NUMBER>000682000000E2   @   2024-04-30T20:36:13.111958Z
Last Failed WAL:                00000011.history           @   2024-04-30T18:52:16.746355Z
When the replica pod starts up, the logs suggest its looking for a file that doesn't exist yet:
"logger":"wal-restore","msg":"WAL file not found in the recovery object store","logging_pod":"pgv2-dev-11","walName":"00000012.history"
I can also verify that the wal archive does not exist in the pg_wal directory on the primary so it wasn't a flushing issue.
The cnpg status will indicate the replica is in Standby (file based) recovery, but it does not fully synchronize.
Instances status
Name         Database Size  Current LSN   Replication role      Status  QoS         Manager Version

pgv2-dev-1   719 GB         682/E3002900  Primary               OK      Guaranteed  1.23.0
pgv2-dev-11  719 GB         682/E40000A0  Standby (file based)  OK      Guaranteed  1.23.0
pgv2-dev-3   719 GB         682/E3002900  Standby (sync)        OK      Guaranteed  1.23.0
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: pgv2-dev
  namespace: pgdb
spec:
  description: V2 Database Cluster DEV
  imageName: ghcr.io/cloudnative-pg/postgis:16-3.4

  instances: 2
  maxSyncReplicas: 1
  minSyncReplicas: 1

  logLevel: debug
  enableSuperuserAccess: true
  enablePDB: true
  superuserSecret:
    name: superuser-auth
  smartShutdownTimeout: 180
  startDelay: 300
  stopDelay: 300
  failoverDelay: 0
  switchoverDelay: 300

  primaryUpdateMethod: restart
  primaryUpdateStrategy: unsupervised

  serviceAccountTemplate:
    metadata:
      annotations:
        eks.amazonaws.com/role-arn: <AWS ARN>
  bootstrap:
    recovery:
      source: v2
      database: v2dev
      owner: app
      secret:
        name: app-auth
      volumeSnapshots:
        #Make a volume snapshot backup JUST BEFORE creating this cluster
        storage:
          apiGroup: snapshot.storage.k8s.io
          kind: VolumeSnapshot
          name: v2-yyyyMMddhhmmss
        walStorage:
          apiGroup: snapshot.storage.k8s.io
          kind: VolumeSnapshot
          name: v2-yyyyMMddhhmmss-wal

  externalClusters:
  - name: v2
    barmanObjectStore:
      data:
        compression: gzip
        jobs: 2
      destinationPath: s3://<BUCKET DIR>
      s3Credentials:
        inheritFromIAMRole: true
      wal:
        compression: gzip
        maxParallel: 20
    connectionParameters:
      dbname: postgres
      host: v2-rw.default.svc
      user: postgres
    password:
      key: password
      name: superuser-auth

  replica:
    enabled: true
    source: v2

  replicationSlots:
    highAvailability:
      enabled: true
      slotPrefix: _cnpg_
    synchronizeReplicas:
      enabled: true
    updateInterval: 300

  postgresql:
    parameters:
      archive_mode: "on"
      archive_timeout: 5min
      auto_explain.log_min_duration: 10s
      dynamic_shared_memory_type: posix
      log_destination: csvlog
      log_directory: /controller/log
      log_filename: postgres
      log_rotation_age: "0"
      log_rotation_size: "0"
      log_truncate_on_rotation: "false"
      logging_collector: "on"
      maintenance_work_mem: 1GB
      max_connections: "600"
      max_parallel_workers: "32"
      max_parallel_workers_per_gather: "4"
      max_replication_slots: "32"
      max_wal_size: 2048MB
      max_worker_processes: "32"
      pg_stat_statements.max: "10000"
      pg_stat_statements.track: all
      shared_buffers: 1GB
      shared_memory_type: mmap
      shared_preload_libraries: ""
      ssl_max_protocol_version: TLSv1.3
      ssl_min_protocol_version: TLSv1.3
      wal_keep_size: 1024MB
      wal_level: logical
      wal_log_hints: "on"
      wal_receiver_timeout: 10s
      wal_sender_timeout: 10s
      work_mem: 256MB
    pg_hba:
    - host all app all password
    syncReplicaElectionConstraint:
      enabled: false

  backup:
    barmanObjectStore:
      data:
        compression: gzip
        jobs: 2
      destinationPath: s3://<BUCKET DIR>/
      s3Credentials:
        inheritFromIAMRole: true
      wal:
        compression: gzip
        maxParallel: 20
    retentionPolicy: 30d
    target: prefer-standby
    volumeSnapshot:
      className: v2-vsc
      online: true
      onlineConfiguration:
        immediateCheckpoint: true
        waitForArchive: false
      snapshotOwnerReference: none
      walClassName: v2-vsc-wal

  monitoring:
    customQueriesConfigMap:
    - key: queries
      name: cnpg-default-monitoring
    disableDefaultQueries: false
    enablePodMonitor: false
  resources:
    limits:
      cpu: "3"
      memory: 4Gi
    requests:
      cpu: "3"
      memory: 4Gi
  storage:
    resizeInUseVolumes: true
    size: 3000Gi
    storageClass: gp3
  walStorage:
    resizeInUseVolumes: true
    size: 50Gi
    storageClass: io2-unencrypted
  affinity:
    enablePodAntiAffinity: true
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: eks.amazonaws.com/nodegroup
            operator: In
            values:
            - pgdb-server
    podAntiAffinityType: preferred
    topologyKey: failure-domain.beta.kubernetes.io/zone

Relevant log output
stream logs failed container "postgres" in pod "pgv2-dev-11" is waiting to start: PodInitializing for pgdb/pgv2-dev-11 (postgres)
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"setup","msg":"Starting CloudNativePG Instance Manager","logging_pod":"pgv2-dev-11","version":"1.23.0","build":{"Version":"1.23.0","Commit":"f6292625","Date":"2024-04-25"}}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"setup","msg":"starting tablespace manager","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"setup","msg":"starting external server manager","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"setup","msg":"starting controller-runtime manager","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting EventSource","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","source":"kind source: *v1.Cluster"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting Controller","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting webserver","logging_pod":"pgv2-dev-11","address":":9187"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"roles_reconciler","msg":"starting up the runnable","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:25Z","msg":"starting the postgres loop","caller":"internal/cmd/manager/instance/run/lifecycle/lifecycle.go:74","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:25Z","msg":"starting signal loop","caller":"internal/cmd/manager/instance/run/lifecycle/lifecycle.go:81","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"roles_reconciler","msg":"setting up RoleSynchronizer loop","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:25Z","msg":"Checking PGDATA coherence","caller":"pkg/management/postgres/instance.go:296","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting webserver","logging_pod":"pgv2-dev-11","address":"localhost:8010"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting webserver","logging_pod":"pgv2-dev-11","address":":8000"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting EventSource","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","source":"kind source: *v1.Cluster"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting Controller","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting EventSource","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","source":"kind source: *v1.Cluster"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting Controller","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting workers","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","worker count":1}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting workers","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","worker count":1}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting workers","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","worker count":1}
{"level":"debug","ts":"2024-04-30T20:40:25Z","logger":"tbs_reconciler","msg":"no tablespaces to create","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"98b7c93f-91d2-4d99-9245-72823280b28b","caller":"internal/management/controller/tablespaces/reconciler.go:68","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:25Z","msg":"Reconciling Cluster","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","caller":"internal/management/controller/instance_controller.go:111","logging_pod":"pgv2-dev-11","cluster":{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","namespace":"pgdb","name":"pgv2-dev"}}
{"level":"debug","ts":"2024-04-30T20:40:25Z","logger":"external_servers_reconciler","msg":"starting up the external servers reconciler","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"6f865827-ab7c-4a90-b4b6-321a879e262a","caller":"internal/management/controller/externalservers/reconciler.go:56","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:25Z","msg":"Reconciling custom monitoring queries","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","caller":"internal/management/controller/instance_controller.go:753","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:25Z","msg":"External server connection string","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"6f865827-ab7c-4a90-b4b6-321a879e262a","serverName":"v2","caller":"internal/management/controller/externalservers/reconciler.go:80","logging_pod":"pgv2-dev-11","connectionString":"dbname='postgres' host='v2-rw.default.svc' passfile='/controller/external/v2/pgpass' user='postgres'"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Refreshed configuration file","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","filename":"/controller/certificates/server.crt","secret":"pgv2-dev-server"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Refreshed configuration file","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","filename":"/controller/certificates/server.key","secret":"pgv2-dev-server"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Refreshed configuration file","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","filename":"/controller/certificates/streaming_replica.crt","secret":"pgv2-dev-replication"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Refreshed configuration file","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","filename":"/controller/certificates/streaming_replica.key","secret":"pgv2-dev-replication"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Refreshed configuration file","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","filename":"/controller/certificates/client-ca.crt","secret":"pgv2-dev-ca"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Refreshed configuration file","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","filename":"/controller/certificates/server-ca.crt","secret":"pgv2-dev-ca"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Installed configuration file","logging_pod":"pgv2-dev-11","pgdata":"/var/lib/postgresql/data/pgdata","filename":"pg_ident.conf"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Cluster status","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","currentPrimary":"pgv2-dev-1","targetPrimary":"pgv2-dev-1","isReplicaCluster":false}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"This is an old primary instance, waiting for the switchover to finish","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","currentPrimary":"pgv2-dev-1","targetPrimary":"pgv2-dev-1"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Switchover completed","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","targetPrimary":"pgv2-dev-1","currentPrimary":"pgv2-dev-1"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Waiting for the new primary to be available","logging_pod":"pgv2-dev-11","primaryConnInfo":"host=pgv2-dev-rw user=streaming_replica port=5432 sslkey=/controller/certificates/streaming_replica.key sslcert=/controller/certificates/streaming_replica.crt sslrootcert=/controller/certificates/server-ca.crt application_name=pgv2-dev-11 sslmode=verify-ca dbname=postgres connect_timeout=5"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Extracting pg_controldata information","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","reason":"before pg_rewind"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_controldata","msg":"pg_control version number:            1300\nCatalog version number:               202307071\nDatabase system identifier:<PHONE_NUMBER>997741588\nDatabase cluster state:               in archive recovery\npg_control last modified:             Tue 30 Apr 2024 08:37:38 PM UTC\nLatest checkpoint location:           682/E251A0C8\nLatest checkpoint's REDO location:    682/E251A040\nLatest checkpoint's REDO WAL file:<PHONE_NUMBER>000682000000E2\nLatest checkpoint's TimeLineID:       17\nLatest checkpoint's PrevTimeLineID:   17\nLatest checkpoint's full_page_writes: on\nLatest checkpoint's NextXID:          0:181815604\nLatest checkpoint's NextOID:          149694561\nLatest checkpoint's NextMultiXactId:  1\nLatest checkpoint's NextMultiOffset:  0\nLatest checkpoint's oldestXID:        722\nLatest checkpoint's oldestXID's DB:   1\nLatest checkpoint's oldestActiveXID:  181815603\nLatest checkpoint's oldestMultiXid:   1\nLatest checkpoint's oldestMulti's DB: 1\nLatest checkpoint's oldestCommitTsXid:0\nLatest checkpoint's newestCommitTsXid:0\nTime of latest checkpoint:            Tue 30 Apr 2024 08:35:11 PM UTC\nFake LSN counter for unlogged rels:   0/3E8\nMinimum recovery ending location:     682/E3000000\nMin recovery ending loc's timeline:   17\nBackup start location:                0/0\nBackup end location:                  0/0\nEnd-of-backup record required:        no\nwal_level setting:                    logical\nwal_log_hints setting:                on\nmax_connections setting:              600\nmax_worker_processes setting:         32\nmax_wal_senders setting:              10\nmax_prepared_xacts setting:           0\nmax_locks_per_xact setting:           64\ntrack_commit_timestamp setting:       off\nMaximum data alignment:               8\nDatabase block size:                  8192\nBlocks per segment of large relation: 131072\nWAL block size:                       8192\nBytes per WAL segment:                16777216\nMaximum length of identifiers:        64\nMaximum columns in an index:          32\nMaximum size of a TOAST chunk:        1996\nSize of a large-object chunk:         2048\nDate/time type storage:               64-bit integers\nFloat8 argument passing:              by value\nData page checksum version:           0\nMock authentication nonce:            b2ae8cbe39949b76539a9f04f6903695bba7311148df10284169aa832cc898ae\n","pipe":"stdout","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","msg":"Starting up pg_rewind","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","pgdata":"/var/lib/postgresql/data/pgdata","options":["-P","--source-server","host=pgv2-dev-rw user=streaming_replica port=5432 sslkey=/controller/certificates/streaming_replica.key sslcert=/controller/certificates/streaming_replica.crt sslrootcert=/controller/certificates/server-ca.crt application_name=pgv2-dev-11 sslmode=verify-ca dbname=postgres","--target-pgdata","/var/lib/postgresql/data/pgdata","--restore-target-wal"]}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"pg_rewind: connected to server","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"pg_rewind: executing \"/usr/lib/postgresql/16/bin/postgres\" for target server to complete crash recovery","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"2024-04-30 20:40:25.801 UTC [29] LOG:  database system was interrupted while in recovery at log time 2024-04-30 20:35:11 UTC","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"2024-04-30 20:40:25.801 UTC [29] HINT:  If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target.","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"2024-04-30 20:40:25.905 UTC [29] LOG:  database system was not properly shut down; automatic recovery in progress","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"2024-04-30 20:40:25.969 UTC [29] LOG:  redo starts at 682/E251A040","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"2024-04-30 20:40:25.999 UTC [29] LOG:  unexpected pageaddr 680/60000000 in WAL segment<PHONE_NUMBER>000682000000E3, LSN 682/E3000000, offset 0","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:25Z","logger":"pg_rewind","msg":"2024-04-30 20:40:25.999 UTC [29] LOG:  redo done at 682/E251A1C8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.03 s","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:26Z","logger":"external_servers_reconciler","msg":"starting up the external servers reconciler","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"0d35dfe0-84ee-4a1e-bbe0-0debe5696f32","caller":"internal/management/controller/externalservers/reconciler.go:56","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:26Z","logger":"tbs_reconciler","msg":"no tablespaces to create","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"37020710-021e-430c-b564-eae2cb5f6b96","caller":"internal/management/controller/tablespaces/reconciler.go:68","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:26Z","msg":"External server connection string","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"0d35dfe0-84ee-4a1e-bbe0-0debe5696f32","serverName":"v2","caller":"internal/management/controller/externalservers/reconciler.go:80","logging_pod":"pgv2-dev-11","connectionString":"dbname='postgres' host='v2-rw.default.svc' passfile='/controller/external/v2/pgpass' user='postgres'"}
{"level":"debug","ts":"2024-04-30T20:40:26Z","logger":"tbs_reconciler","msg":"no tablespaces to create","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"c507c153-4fa1-4523-933d-9de54f7b372f","caller":"internal/management/controller/tablespaces/reconciler.go:68","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:26Z","logger":"external_servers_reconciler","msg":"starting up the external servers reconciler","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"70c90437-ecc1-4b01-8ff7-11f78af99451","caller":"internal/management/controller/externalservers/reconciler.go:56","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:26Z","msg":"External server connection string","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"70c90437-ecc1-4b01-8ff7-11f78af99451","serverName":"v2","caller":"internal/management/controller/externalservers/reconciler.go:80","logging_pod":"pgv2-dev-11","connectionString":"dbname='postgres' host='v2-rw.default.svc' passfile='/controller/external/v2/pgpass' user='postgres'"}
{"level":"info","ts":"2024-04-30T20:40:26Z","logger":"pg_rewind","msg":"2024-04-30 20:40:26.221 UTC [29] LOG:  checkpoint starting: end-of-recovery immediate wait","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:26Z","logger":"pg_rewind","msg":"2024-04-30 20:40:26.223 UTC [29] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.001 s, total=0.002 s; sync files=0, longest=0.000 s, average=0.000 s; distance=11159 kB, estimate=11159 kB; lsn=682/E3000028, redo lsn=682/E3000028","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_rewind","msg":"PostgreSQL stand-alone backend 16.2 (Debian 16.2-1.pgdg110+2)","pipe":"stdout","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_rewind","msg":"2024-04-30 20:40:27.103 UTC [29] LOG:  checkpoint starting: shutdown immediate","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_rewind","msg":"2024-04-30 20:40:27.123 UTC [29] LOG:  checkpoint complete: wrote 1 buffers (0.0%); 0 WAL file(s) added, 1 removed, 0 recycled; write=0.002 s, sync=0.001 s, total=0.020 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16384 kB, estimate=16384 kB; lsn=682/E4000028, redo lsn=682/E4000028","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_rewind","msg":"pg_rewind: source and target cluster are on the same timeline","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_rewind","msg":"pg_rewind: no rewind required","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_rewind","msg":"backend> ","pipe":"stdout","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"Demoting instance","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11","pgpdata":"/var/lib/postgresql/data/pgdata"}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"Updated replication settings","logging_pod":"pgv2-dev-11","filename":"override.conf"}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"Extracting pg_controldata information","logging_pod":"pgv2-dev-11","reason":"postmaster start up"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"pg_controldata","msg":"pg_control version number:            1300\nCatalog version number:               202307071\nDatabase system identifier:<PHONE_NUMBER>997741588\nDatabase cluster state:               shut down\npg_control last modified:             Tue 30 Apr 2024 08:40:27 PM UTC\nLatest checkpoint location:           682/E4000028\nLatest checkpoint's REDO location:    682/E4000028\nLatest checkpoint's REDO WAL file:<PHONE_NUMBER>000682000000E4\nLatest checkpoint's TimeLineID:       17\nLatest checkpoint's PrevTimeLineID:   17\nLatest checkpoint's full_page_writes: on\nLatest checkpoint's NextXID:          0:181815604\nLatest checkpoint's NextOID:          149694561\nLatest checkpoint's NextMultiXactId:  1\nLatest checkpoint's NextMultiOffset:  0\nLatest checkpoint's oldestXID:        722\nLatest checkpoint's oldestXID's DB:   1\nLatest checkpoint's oldestActiveXID:  0\nLatest checkpoint's oldestMultiXid:   1\nLatest checkpoint's oldestMulti's DB: 1\nLatest checkpoint's oldestCommitTsXid:0\nLatest checkpoint's newestCommitTsXid:0\nTime of latest checkpoint:            Tue 30 Apr 2024 08:40:27 PM UTC\nFake LSN counter for unlogged rels:   0/3E8\nMinimum recovery ending location:     0/0\nMin recovery ending loc's timeline:   0\nBackup start location:                0/0\nBackup end location:                  0/0\nEnd-of-backup record required:        no\nwal_level setting:                    logical\nwal_log_hints setting:                on\nmax_connections setting:              600\nmax_worker_processes setting:         32\nmax_wal_senders setting:              10\nmax_prepared_xacts setting:           0\nmax_locks_per_xact setting:           64\ntrack_commit_timestamp setting:       off\nMaximum data alignment:               8\nDatabase block size:                  8192\nBlocks per segment of large relation: 131072\nWAL block size:                       8192\nBytes per WAL segment:                16777216\nMaximum length of identifiers:        64\nMaximum columns in an index:          32\nMaximum size of a TOAST chunk:        1996\nSize of a large-object chunk:         2048\nDate/time type storage:               64-bit integers\nFloat8 argument passing:              by value\nData page checksum version:           0\nMock authentication nonce:            b2ae8cbe39949b76539a9f04f6903695bba7311148df10284169aa832cc898ae\n","pipe":"stdout","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"Instance is still down, will retry in 1 second","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"15648365-92da-4ecc-8e11-968e7875036a","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Reconciling Cluster","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"320fac48-6f15-4133-940f-8df5cc0f128d","caller":"internal/management/controller/instance_controller.go:111","logging_pod":"pgv2-dev-11","cluster":{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","namespace":"pgdb","name":"pgv2-dev"}}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Reconciling custom monitoring queries","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"320fac48-6f15-4133-940f-8df5cc0f128d","caller":"internal/management/controller/instance_controller.go:753","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"2024-04-30 20:40:27.180 UTC [32] LOG:  redirecting log output to logging collector process","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"2024-04-30 20:40:27.180 UTC [32] HINT:  Future log output will appear in directory \"/controller/log\".","pipe":"stderr","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.180 UTC","process_id":"32","session_id":"6631573b.20","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"ending log output to stderr","hint":"Future log output will go to log destination \"csvlog\".","backend_type":"postmaster","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.180 UTC","process_id":"32","session_id":"6631573b.20","session_line_num":"2","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"starting PostgreSQL 16.2 (Debian 16.2-1.pgdg110+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit","backend_type":"postmaster","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.180 UTC","process_id":"32","session_id":"6631573b.20","session_line_num":"3","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"listening on IPv4 address \"<IP_ADDRESS>\", port 5432","backend_type":"postmaster","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.180 UTC","process_id":"32","session_id":"6631573b.20","session_line_num":"4","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"listening on IPv6 address \"::\", port 5432","backend_type":"postmaster","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"2024-04-30 20:40:27.180 UTC [32] LOG:  ending log output to stderr","source":"/controller/log/postgres","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"2024-04-30 20:40:27.180 UTC [32] HINT:  Future log output will go to log destination \"csvlog\".","source":"/controller/log/postgres","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.183 UTC","process_id":"32","session_id":"6631573b.20","session_line_num":"5","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"listening on Unix socket \"/controller/run/.s.PGSQL.5432\"","backend_type":"postmaster","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.188 UTC","process_id":"36","session_id":"6631573b.24","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"database system was shut down at 2024-04-30 20:40:27 UTC","backend_type":"startup","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"Updated replication settings","logging_pod":"pgv2-dev-11","filename":"override.conf"}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"Updated replication settings","logging_pod":"pgv2-dev-11","filename":"override.conf"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.290 UTC","user_name":"postgres","database_name":"postgres","process_id":"46","connection_from":"[local]","session_id":"6631573b.2e","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:27Z","msg":"DB not available, will retry","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"320fac48-6f15-4133-940f-8df5cc0f128d","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.292 UTC","user_name":"postgres","database_name":"postgres","process_id":"47","connection_from":"[local]","session_id":"6631573b.2f","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"wal-restore","msg":"WAL file not found in the recovery object store","logging_pod":"pgv2-dev-11","walName":"00000012.history","options":["--cloud-provider","aws-s3","s3://x319-cnpg-barman-bucket/","pgv2-dev"],"startTime":"2024-04-30T20:40:27Z","endTime":"2024-04-30T20:40:27Z","elapsedWalTime":0.362220191}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.757 UTC","process_id":"36","session_id":"6631573b.24","session_line_num":"2","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"entering standby mode","backend_type":"startup","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.781 UTC","user_name":"postgres","database_name":"postgres","process_id":"57","connection_from":"[local]","session_id":"6631573b.39","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.872 UTC","user_name":"postgres","database_name":"postgres","process_id":"59","connection_from":"[local]","session_id":"6631573b.3b","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:27Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:27Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:27.927 UTC","user_name":"postgres","database_name":"postgres","process_id":"60","connection_from":"[local]","session_id":"6631573b.3c","session_line_num":"1","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:28Z","msg":"Reconciling Cluster","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"2bdb660e-46b5-4c6a-a18e-bc17bdffd380","caller":"internal/management/controller/instance_controller.go:111","logging_pod":"pgv2-dev-11","cluster":{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","namespace":"pgdb","name":"pgv2-dev"}}
{"level":"debug","ts":"2024-04-30T20:40:28Z","msg":"Reconciling custom monitoring queries","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"2bdb660e-46b5-4c6a-a18e-bc17bdffd380","caller":"internal/management/controller/instance_controller.go:753","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:28Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:28.190 UTC","user_name":"postgres","database_name":"postgres","process_id":"62","connection_from":"[local]","session_id":"6631573c.3e","session_line_num":"1","session_start_time":"2024-04-30 20:40:28 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:28Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:28Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:28.212 UTC","user_name":"postgres","database_name":"postgres","process_id":"63","connection_from":"[local]","session_id":"6631573c.3f","session_line_num":"1","session_start_time":"2024-04-30 20:40:28 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:28Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:28.214 UTC","user_name":"postgres","database_name":"postgres","process_id":"64","connection_from":"[local]","session_id":"6631573c.40","session_line_num":"1","session_start_time":"2024-04-30 20:40:28 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:28Z","msg":"DB not available, will retry","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"2bdb660e-46b5-4c6a-a18e-bc17bdffd380","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:28Z","logger":"wal-restore","msg":"Restored WAL file","logging_pod":"pgv2-dev-11","walName":"00000011.history","startTime":"2024-04-30T20:40:27Z","endTime":"2024-04-30T20:40:28Z","elapsedWalTime":0.3778327}
{"level":"info","ts":"2024-04-30T20:40:28Z","logger":"wal-restore","msg":"WAL restore command completed (parallel)","logging_pod":"pgv2-dev-11","walName":"00000011.history","maxParallel":20,"successfulWalRestore":1,"failedWalRestore":19,"endOfWALStream":false,"startTime":"2024-04-30T20:40:27Z","downloadStartTime":"2024-04-30T20:40:27Z","downloadTotalTime":0.378065225,"totalTime":0.456196816}
{"level":"info","ts":"2024-04-30T20:40:28Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:28.237 UTC","process_id":"36","session_id":"6631573b.24","session_line_num":"3","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"restored log file \"00000011.history\" from archive","backend_type":"startup","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:28Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:28Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:29Z","msg":"Reconciling Cluster","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"0dccee4c-a55c-4ce4-9eab-b69d2bf40ce9","caller":"internal/management/controller/instance_controller.go:111","logging_pod":"pgv2-dev-11","cluster":{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","namespace":"pgdb","name":"pgv2-dev"}}
{"level":"debug","ts":"2024-04-30T20:40:29Z","msg":"Reconciling custom monitoring queries","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"0dccee4c-a55c-4ce4-9eab-b69d2bf40ce9","caller":"internal/management/controller/instance_controller.go:753","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:29Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:29.512 UTC","user_name":"postgres","database_name":"postgres","process_id":"111","connection_from":"[local]","session_id":"6631573d.6f","session_line_num":"1","session_start_time":"2024-04-30 20:40:29 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:29Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:29Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:29.532 UTC","user_name":"postgres","database_name":"postgres","process_id":"112","connection_from":"[local]","session_id":"6631573d.70","session_line_num":"1","session_start_time":"2024-04-30 20:40:29 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:29Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:29.588 UTC","user_name":"postgres","database_name":"postgres","process_id":"113","connection_from":"[local]","session_id":"6631573d.71","session_line_num":"1","session_start_time":"2024-04-30 20:40:29 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:29Z","msg":"DB not available, will retry","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"0dccee4c-a55c-4ce4-9eab-b69d2bf40ce9","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"debug","ts":"2024-04-30T20:40:30Z","msg":"Reconciling Cluster","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"598035a4-2e04-44b5-83a7-7514d47b62f6","caller":"internal/management/controller/instance_controller.go:111","logging_pod":"pgv2-dev-11","cluster":{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","namespace":"pgdb","name":"pgv2-dev"}}
{"level":"debug","ts":"2024-04-30T20:40:30Z","msg":"Reconciling custom monitoring queries","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"598035a4-2e04-44b5-83a7-7514d47b62f6","caller":"internal/management/controller/instance_controller.go:753","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:30Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:30.708 UTC","user_name":"postgres","database_name":"postgres","process_id":"115","connection_from":"[local]","session_id":"6631573e.73","session_line_num":"1","session_start_time":"2024-04-30 20:40:30 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:30Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:30Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:30.740 UTC","user_name":"postgres","database_name":"postgres","process_id":"116","connection_from":"[local]","session_id":"6631573e.74","session_line_num":"1","session_start_time":"2024-04-30 20:40:30 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:30Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:30Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:30.809 UTC","user_name":"postgres","database_name":"postgres","process_id":"117","connection_from":"[local]","session_id":"6631573e.75","session_line_num":"1","session_start_time":"2024-04-30 20:40:30 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:30Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.014 UTC","user_name":"postgres","database_name":"postgres","process_id":"118","connection_from":"[local]","session_id":"6631573f.76","session_line_num":"1","session_start_time":"2024-04-30 20:40:31 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.032 UTC","user_name":"postgres","database_name":"postgres","process_id":"119","connection_from":"[local]","session_id":"6631573f.77","session_line_num":"1","session_start_time":"2024-04-30 20:40:31 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:31Z","msg":"DB not available, will retry","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"598035a4-2e04-44b5-83a7-7514d47b62f6","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.124 UTC","user_name":"postgres","database_name":"postgres","process_id":"120","connection_from":"[local]","session_id":"6631573f.78","session_line_num":"1","session_start_time":"2024-04-30 20:40:31 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"57P03","message":"the database system is starting up","backend_type":"client backend","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:31Z","msg":"Instance status probe failing","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11","err":"failed to connect to `host=/controller/run user=postgres database=postgres`: server error (FATAL: the database system is starting up (SQLSTATE 57P03))"}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"wal-restore","msg":"WAL file not found in the recovery object store","logging_pod":"pgv2-dev-11","walName":"0000001100000682000000E4","options":["--cloud-provider","aws-s3","s3://x319-cnpg-barman-bucket/","pgv2-dev"],"startTime":"2024-04-30T20:40:28Z","endTime":"2024-04-30T20:40:31Z","elapsedWalTime":3.152753172}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.604 UTC","process_id":"36","session_id":"6631573b.24","session_line_num":"4","session_start_time":"2024-04-30 20:40:27 UTC","virtual_transaction_id":"1/0","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"consistent recovery state reached at 682/E40000A0","backend_type":"startup","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.604 UTC","process_id":"36","session_id":"6631573b.24","session_line_num":"5","session_start_time":"2024-04-30 20:40:27 UTC","virtual_transaction_id":"1/0","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"invalid record length at 682/E40000A0: expected at least 24, got 0","backend_type":"startup","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.604 UTC","process_id":"32","session_id":"6631573b.20","session_line_num":"6","session_start_time":"2024-04-30 20:40:27 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"database system is ready to accept read-only connections","backend_type":"postmaster","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.614 UTC","process_id":"121","session_id":"6631573f.79","session_line_num":"1","session_start_time":"2024-04-30 20:40:31 UTC","transaction_id":"0","error_severity":"LOG","sql_state_code":"00000","message":"started streaming WAL from primary at 682/E4000000 on timeline 17","backend_type":"walreceiver","query_id":"0"}}
{"level":"info","ts":"2024-04-30T20:40:31Z","logger":"postgres","msg":"record","logging_pod":"pgv2-dev-11","record":{"log_time":"2024-04-30 20:40:31.614 UTC","process_id":"121","session_id":"6631573f.79","session_line_num":"2","session_start_time":"2024-04-30 20:40:31 UTC","transaction_id":"0","error_severity":"FATAL","sql_state_code":"08P01","message":"could not receive data from WAL stream: ERROR:  requested starting point 682/E4000000 is ahead of the WAL flush position of this server 682/E3000000","backend_type":"walreceiver","query_id":"0"}}
{"level":"debug","ts":"2024-04-30T20:40:31Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:31Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:32Z","msg":"Reconciling Cluster","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"00a69c30-b361-4731-81d6-d61d3b8fd1a0","caller":"internal/management/controller/instance_controller.go:111","logging_pod":"pgv2-dev-11","cluster":{"apiVersion":"postgresql.cnpg.io/v1","kind":"Cluster","namespace":"pgdb","name":"pgv2-dev"}}
{"level":"debug","ts":"2024-04-30T20:40:32Z","msg":"Reconciling custom monitoring queries","controller":"cluster","controllerGroup":"postgresql.cnpg.io","controllerKind":"Cluster","Cluster":{"name":"pgv2-dev","namespace":"pgdb"},"namespace":"pgdb","name":"pgv2-dev","reconcileID":"00a69c30-b361-4731-81d6-d61d3b8fd1a0","caller":"internal/management/controller/instance_controller.go:753","logging_pod":"pgv2-dev-11"}
{"level":"info","ts":"2024-04-30T20:40:32Z","logger":"wal-restore","msg":"WAL file not found in the recovery object store","logging_pod":"pgv2-dev-11","walName":"00000012.history","options":["--cloud-provider","aws-s3","s3://x319-cnpg-barman-bucket/","pgv2-dev"],"startTime":"2024-04-30T20:40:31Z","endTime":"2024-04-30T20:40:32Z","elapsedWalTime":0.344877257}
{"level":"debug","ts":"2024-04-30T20:40:32Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}
{"level":"debug","ts":"2024-04-30T20:40:32Z","msg":"Cached object request received","caller":"pkg/management/log/log.go:178","logging_pod":"pgv2-dev-11"}

Code of Conduct

[X] I agree to follow this project's Code of Conduct

We are experiencing this same issue. @stevec-skyhawk did you manage to find a solution?

We are experiencing this same issue. @stevec-skyhawk did you manage to find a solution?

No, we did not find a solution. We ended up having to create a new cluster through the recovery process.

We are also seeing the same issue.


[TreeView] Expand/collapse node only when clicking on expand/collapse icon

[x] I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡
When I click on a tree item that has children, the node expands, wherever I click on the line. While this behavior might be ok for most users, I would like to have the possibility to expand/collapse only when I click on the expand/collapse icon - not on the label.
Motivation 🔦
In my project, I have a tree and I'd like to display a panel with information about a node when I click on it.
When my node does not have children, it is very easy to achieve this behavior. But when my node has children, it expends at the same time its information are displayed, which is not the behavior I want. So I lack a way to have a different behavior when I click on the label (display node info) and when I click on the expand/collapse icon (expand/collapse the node).

I have the same use case, it could be useful !

Here is a workaround.
You need to import the TreeViewContext
Prevent the label click from being processed by the wrapped TreeItem.
Use the normal click handling code omitting the toggle expansion logic.
function ExpandIconOnlyTreeItem(props:TreeItemProps){
  const {label,...other} = props;
  const context = useContext(TreeViewContext.default) as any;

  const focused = context.isFocused ? context.isFocused(props.nodeId) : false;
  const labelClicked = useCallback(
    (event:any) => {
      if (!focused) {
        context.focus(props.nodeId);
      }

      const multiple = context.multiSelect && (event.shiftKey || event.ctrlKey || event.metaKey);

      if (!context.selectionDisabled) {
        if (multiple) {
          if (event.shiftKey) {
            context.selectRange(event, { end: props.nodeId });
          } else {
            context.selectNode(event, props.nodeId, true);
          }
        } else {
          context.selectNode(event, props.nodeId);
        }
      }
      event.stopPropagation()
      if (props.onClick) {
        props.onClick(event);
      }
    }
  ,[]);

  return <TreeItem {...other} label={{label}}/>
}

@tonyhallett can you please specify how exactly you imported TreeViewContext in your workaround?
Also thanks for the commit, it'll be much more elegant to solve it by adding the iconClickExpandOnly prop to TreeView.

const TreeViewContext = require('@material-ui/lab/esm/TreeView/TreeViewContext');
Also as mentioned you can use expanded and onNodeToggle and check that event similarly to how I did in the pull request instead of using the private TreeViewContext.
https://github.com/mui-org/material-ui/blob/176bf440590df95cccae46768cb5c0475cc6746f/packages/material-ui-lab/src/TreeItem/TreeItem.js#L175

Could we have an option to expand when clicking the icon or the label, but collapsing only when clicking the icon?

Could we have an option to expand when clicking the icon or the label, but collapsing only when clicking the icon?

We're probably going with a solution that enables checking in an onClick handler if the click came from the icon or label and then you can customize this behavior. Props-based approaches don't scale very well for one-off use cases.

We're probably going with a solution that enables checking in an onClick handler if the click came from the icon or label and then you can customize this behavior. Props-based approaches don't scale very well for one-off use cases.

Fine for me. It would be great to have a mechanism to stop the propagation of the event. Like, in the onSelect event handler, a boolean that says whether the item will expand, whether it will be selected. That would give us complete flexibility, covering pretty much any desired behaviour, while keeping the props under control.
(If that is exactly what you were planning to do... well, great :) )

@eps1lon I think I don't completely understand the approach you described.
I think you may have suggested that the fix is removing the onClick={handleClick} from the content and inserting onClick = {() => handleClick('icon')} in the icon and onClick = {() => handleClick('label')} in the label, and then using this as input to control the behavior.
I think you may also have suggested that the code would use the event argument on handleClick to know if the click was in the icon or in the label (maybe via event.target).
I'm trying to fix this and PR but this is my first time contributing to an open source project, so I could really use some guidance. Thanks.

I have create a React hook that can be used to get the desired behaviour, including that desired by @savissimo.
npm useseparatetoggleclick.
codesandbox demo
@guicostaarantes - I can see where the confusion lies.

We're probably going with a solution that enables checking in an onClick handler if the click came from the icon or label and then you can customize this behavior.

@eps1lon I think I don't completely understand the approach you described.

If you see the comment from @eps1lon on the pull request that I made
https://github.com/mui-org/material-ui/pull/20087#issuecomment-602176492

I think we should rather use the approach we use with the other components: Add labelProps that are spread to the {label} and then you can intercept clicks that happen on the label.

By spreading props on Typography it will be possible to add an onClick handler which can be used in the same manner as my hook ( which added an onClick to the icon.  We only need the event information for all label clicks or all icon clicks ).
I will update my pull request accordingly tomorrow.  Even so the hook to me seems to be a better solution.
I will also create another pull request tomorrow that determines if the click is from label or icon and surfaces this information to onNodeToggle as an additional argument - 'label'|'icon'|'keyboard'.
Then @eps1lon can choose to have either / both and if desired to include the hook.

sandbox  using the new onNodeToggle (#20609) to allow expansion only for icon ( or label ) click.  Hooks can be created that are similar ( and simpler ) to npm useseparatetoggleclick.

@tonyhallett is it possible to attach onClick event on label only with useseparatetoggleclick package?

@isrsen1 the purpose of the useseparatetoggleclick is to manage separated click toggling for you. If you specifically need an onclick on the label provide a span as the label and handle the click on that.

@tonyhallett is it possible to set default expanded nodes with useseparatetoggleclick package?

@tonyhallett Thanks so much for useseparatetoggleclick - I am curious...  is this a "temporary" solution that will be replaced once this feature comes out of lab?  (and btw - what is the best way to find out when things leave lab and go to core?)

@tonyhallett Just by way of update (and for future people with the problem)...  I found that the best path to solving this was to take over the selection/expanded logic that you guys are already exposing and have a demo for on this page under "Controlled tree view"...  (though I think it would be cool if there were behavior props right on the tree)...  this method allows me do all sorts of other behaviour easily anyway
`
let selectingNode = false
const handleToggle = (event, nodeIds) => {
if ( !selectingNode ) {
setExpanded(nodeIds);
selectingNode = false
//doSomethingElse?
}
};
const handleSelect = (event, nodeIds) => {
selectingNode = true
// do something else
}
`

@turnkeyDoug  how would you prevent a node being selected i.e. stopping the onNodeSelect function when an icon is clicked?  Could you share your code snippet please on how you resolved it as mentioned above?

Not the most efficient, but the workaround that worked for me was to check if your handle is a parent of the event target:
const [expanded, setExpanded] = React.useState([]);
const handleToggle = (event, nodeIds) => {
  if (event.target.closest('.someClass')) {
    setExpanded(nodeIds);
  }
};

<TreeView onNodeToggle={handleToggle} expanded={expanded}>
  ...
</TreeView>

Hi @mikeizzy, do you have some some sample code in somewhere I can look at... I am a total rookie in coding working my way around - Thanks!!!

The controlled TreeView example is on their docs site:
https://material-ui.com/components/tree-view/#controlled-tree-view
Read about using state hooks on the React official site:
https://reactjs.org/docs/hooks-state.html
Using the DOM's "closest" method:
https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
-you can setExpanded only if the clicked element is a child of whichever node you decide to be your control.
  const handleToggle = (event, nodeIds) => {
    if (event.target.closest(".MuiTreeItem-iconContainer")) {
      setExpanded(nodeIds);
    }
  };

Thank you @mikeizzy,
I implemented your suggestion.  May I request if you have a solution for how to prevent onNodeSelect when you expand/collapse icon.  I would wish only to expand/collapse (onNodeToggle) icon when I click on Icon but not select any particular node (onNodeSelect)

Thank you @mikeizzy,
I implemented your suggestion. May I request if you have a solution for how to prevent onNodeSelect when you expand/collapse icon. I would wish only to expand/collapse (onNodeToggle) icon when I click on Icon but not select any particular node (onNodeSelect)

Also looking for this. Thank you.

I don't think this has been mentioned yet, but since version v4.0.0-alpha.52 of material ui lab you can specify the onLabelClick prop.
You can then call event.preventDefault() to prevent onNodeToggle from being called.
Like this
onLabelClick={(event) => {event.preventDefault();}
https://material-ui.com/api/tree-item/

@NiroSenor @flora8984461
Here is @mikeizzy solution expanded to include "only select if clicking label" functionality:
const handleToggle = (event, nodeIds) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(iconClicked) {
      setExpanded(nodeIds);
    }
  };

  const handleSelect = (event, accountId) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(!iconClicked) {
      setSelected(accountId);
    }
  };

@NiroSenor @flora8984461
Here is @mikeizzy solution expanded to include "only select if clicking label" functionality:
//only expand if icon was clicked
const handleToggle = (event, nodeIds) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(iconClicked) {
      setExpanded(nodeIds);
    }
  };

//only select if icon wasn't clicked
  const handleSelect = (event, accountId) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(!iconClicked) {
      setSelected(accountId);
    }
  };

This works perfectly, but I can't believe I just spent an hour and a half trying to get this functionality to work!

Thank you so much for your great work!

I have same issue, it always close on click even when I dont want it to be closed

Here is the solution I did:
 const handleToggle = (event, nodeIds) => {
    console.log("toggle changer");
    console.log("nodeIds:", nodeIds);
    console.log("selected:", selected);
    console.log("expanded:", expanded);

    const A = nodeIds;
    const B = expanded;
    const clicked = A.filter((n) => !B.includes(n))[0];

    const _A = expanded;
    const _B = nodeIds;
    const closed = _A.filter((n) => !_B.includes(n))[0];

    console.log("clicked: ", clicked);
    console.log("closed: ", closed);

    if (clicked === selected) {
      setExpanded(nodeIds);
    } else if (selected !== closed) {
      setSelected(nodeIds);
    } else {
      setExpanded(nodeIds);
    }
  };

I just tweaked this code a little bit https://material-ui.com/components/tree-view/#controlled-tree-view
and changed handleToggle functions a little bit according to my need,
Here is what I have achived for my specific usecase:

any better solution is always welcome  😊

korean plz :-(

korean plz :-(

Fantastic Solution!

@NiroSenor @flora8984461
Here is @mikeizzy solution expanded to include "only select if clicking label" functionality:
//only expand if icon was clicked
const handleToggle = (event, nodeIds) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(iconClicked) {
      setExpanded(nodeIds);
    }
  };

//only select if icon wasn't clicked
  const handleSelect = (event, accountId) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(!iconClicked) {
      setSelected(accountId);
    }
  };

This works perfectly, but I can't believe I just spent an hour and a half trying to get this functionality to work!

here is the simple solution worked for me.
` const renderTree = (nodes) => {
return (

    );
};`

Prevent the default event and propogation in label on TreeItem and rest is same like
 <TreeView                                                 onNodeToggle={handleToggle}                                                 expanded={expanded}                                                 defaultExpanded={[                                                     "EC1",                                                     "EC2",                                                     "EC3",                                                     "EC4"                                                 ]}                                                 defaultCollapseIcon={<MinusSquare />}                                                 defaultExpandIcon={<PlusSquare />}                                                 defaultSelected={["EC4"]}                                                 defaultEndIcon={<CloseSquare />}                                             >                                                 {listItem &&                                                     renderTree(listItem[0])}                                             </TreeView>
handle Toggle is
const handleToggle = (event, nodeIds) => {
setExpanded(nodeIds);
};
where the expanded is the array of parent ID's

@mikeizzy How would your solution apply in v5.x?

For v5.x:
<TreeItem label={
 event.stopPropagation()}>{label}
} />

@NiroSenor @flora8984461 Here is @mikeizzy solution expanded to include "only select if clicking label" functionality:
//only expand if icon was clicked
const handleToggle = (event, nodeIds) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(iconClicked) {
      setExpanded(nodeIds);
    }
  };

//only select if icon wasn't clicked
  const handleSelect = (event, accountId) => {
    event.persist()
    let iconClicked = event.target.closest(".MuiTreeItem-iconContainer")
    if(!iconClicked) {
      setSelected(accountId);
    }
  };

This works perfectly, but I can't believe I just spent an hour and a half trying to get this functionality to work!

Thanks. It works. And I refactored it to meet my requirement.
  function handleNodeToggle(event: React.SyntheticEvent, nodeIds: string[]) {
    event.persist();
    const iconClicked = (event.target as any).closest(".MuiTreeItem-iconContainer");
    const isDoubleClicked = (event as any).detail === 2;
    if (iconClicked || isDoubleClicked) {
      setExpanded(nodeIds);
    }
  }

Here is what worked for me
// CustomTreeItem.tsx (base on official MUI example)

import { TreeItem2, TreeItem2Props } from '@mui/x-tree-view/TreeItem2';
import { useTreeItem2Utils } from '@mui/x-tree-view/hooks';
import { UseTreeItem2ContentSlotOwnProps } from '@mui/x-tree-view/useTreeItem2';
import { forwardRef } from 'react';

export const CustomTreeItem = forwardRef(function MyTreeItem(
    props: TreeItem2Props,
    ref: React.Ref<HTMLLIElement>
) {
    const { interactions } = useTreeItem2Utils({
        itemId: props.itemId,
        children: props.children,
    });

    const handleContentClick: UseTreeItem2ContentSlotOwnProps['onClick'] = (event) => {
        event.defaultMuiPrevented = true;
        interactions.handleSelection(event);
    };

    const handleIconContainerClick = (event: React.MouseEvent) => {
        interactions.handleExpansion(event);
        event.stopPropagation(); // Prevents the content click handler from being triggered
    };

    return (
        <TreeItem2
            {...props}
            ref={ref}
            slotProps={{
                content: { onClick: handleContentClick },
                iconContainer: { onClick: handleIconContainerClick },
            }}
        />
    );
});

then use it like this
...
const handleSelectedItemsChange = (event: React.SyntheticEvent, id: string | null) => {
    setSelectedItem(id);
};

...
<RichTreeView
    items={ENTITIES}
    slots={{ item: CustomTreeItem }}
    selectedItems={selected_item}
    onSelectedItemsChange={handleSelectedItemsChange}
/>


Fluffy BH snow on TH

Is it possible?

I'll probably rip the game again to see if I can actually add it in assetbundle

not fluffy but sound added


Typescript compliation issue - Type 'RequestInit' is not assignable to type 'never'

having compilation issue with the @anthropic-ai/bedrock-sdk, using in node js + ts
../node_modules/@anthropic-ai/bedrock-sdk/client.d.ts:45:5 - error TS2416: Property 'buildRequest' in type 'AnthropicBedrock' is not assignable to the same property in base type 'APIClient'.
  Type '{ (options: FinalRequestOptions<unknown>): { req: RequestInit; url: string; timeout: number; }; (options: FinalRequestOptions<unknown>): { ...; }; }' is not assignable to type '<Req>(options: FinalRequestOptions<Req>) => { req: never; url: string; timeout: number; }'.
    Call signature return types '{ req: RequestInit; url: string; timeout: number; }' and '{ req: never; url: string; timeout: number; }' are incompatible.
      The types of 'req' are incompatible between these types.
        Type 'RequestInit' is not assignable to type 'never'.

45     buildRequest(options: Core.FinalRequestOptions<unknown>): {
       ~~~~~~~~~~~~

Found 1 error in ../node_modules/@anthropic-ai/bedrock-sdk/client.d.ts:45

using
@anthropic-ai/bedrock-sdk: 0.9.2
typescript: 5.2.2

Can you share your tsconfig? This is likely an issue in your config.

{
  "compilerOptions": {
    "outDir": "dist",
    "module": "commonjs",
    "rootDir": ".",
    "target": "es6",
    "noImplicitAny": false,
    "moduleResolution": "Node",
    "allowJs": true,
    "resolveJsonModule": true
  },
  "include": [
    "src",
    "__tests__"
  ],
  "exclude": [
    "node_modules",
    "./_isolated_",
    "./workspaces",
    "**/dist"
  ]
}

Can you try "moduleResolution": "nodeNext"?

it now fails on something else
with or without the shim
import '@anthropic-ai/sdk/shims/node'
../node_modules/@anthropic-ai/bedrock-sdk/client.d.ts:41:15 - error TS2416: Property 'prepareRequest' in type 'AnthropicBedrock' is not assignable to the same property in base type 'APIClient'.
  Type '(request: RequestInit, { url, options }: { url: string; options: import("/Users/yaronrosh/logzio/gaia-hermes-ws/node_modules/@anthropic-ai/sdk/core").FinalRequestOptions<unknown>; }) => Promise<...>' is not assignable to type '(request: import("/Users/yaronrosh/logzio/gaia-hermes-ws/node_modules/@types/node-fetch/index").RequestInit, { url, options }: { url: string; options: import("/Users/yaronrosh/logzio/gaia-hermes-ws/node_modules/@anthropic-ai/sdk/core").FinalRequestOptions<unknown>; }) => Promise<...>'.
    Types of parameters 'request' and 'request' are incompatible.
      Type 'import("/node_modules/@types/node-fetch/index").RequestInit' is not assignable to type 'RequestInit'.
        Types of property 'body' are incompatible.
          Type 'import("/node_modules/@types/node-fetch/index").BodyInit' is not assignable to type 'BodyInit'.
            Type 'ReadableStream' is not assignable to type 'BodyInit'.
              Type 'ReadableStream' is missing the following properties from type 'ReadableStream<any>': locked, cancel, getReader, pipeThrough, and 3 more.

41     protected prepareRequest(request: RequestInit, { url, options }: {
                 ~~~~~~~~~~~~~~

../node_modules/@anthropic-ai/bedrock-sdk/client.d.ts:45:5 - error TS2416: Property 'buildRequest' in type 'AnthropicBedrock' is not assignable to the same property in base type 'APIClient'.
  Type '(options: FinalRequestOptions<unknown>) => { req: RequestInit; url: string; timeout: number; }' is not assignable to type '<Req>(options: FinalRequestOptions<Req>) => { req: RequestInit; url: string; timeout: number; }'.
    Call signature return types '{ req: RequestInit; url: string; timeout: number; }' and '{ req: RequestInit; url: string; timeout: number; }' are incompatible.
      The types of 'req.body' are incompatible between these types.
        Type 'BodyInit' is not assignable to type 'import("/Users/yaronrosh/logzio/gaia-hermes-ws/node_modules/@types/node-fetch/index").BodyInit'.
          Type 'Blob' is not assignable to type 'BodyInit'.
            Type 'Blob' is missing the following properties from type 'URLSearchParams': append, delete, entries, forEach, and 8 more.

45     buildRequest(options: Core.FinalRequestOptions<unknown>): {
       ~~~~~~~~~~~~

Got it. Does "moduleResolution": "nodeNext"help?

Answering on behalf of Yaron, it didn't help as well.

hmm… that's surprising. Can you share a codesandbox with minimal repro?

I also get exactly the same error when I set "module": "NodeNext", "moduleResolution": "NodeNext",. I also started from the same error, pretty much copying the example:
import AnthropicBedrock from '@anthropic-ai/bedrock-sdk';

const createInput = async (messages) => {
  const client = new AnthropicBedrock({
    awsAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    awsSecretKey: process.env.AWS_ACCESS_KEY_ID,
    awsRegion: process.env.AWS_DEFAULT_REGION,
  });

  const message = await client.messages.create({
    model: 'anthropic.claude-3-5-sonnet-20240620-v1:0',
    max_tokens: 256,
    messages
  });

  return message;
}

Can you share a codesandbox with a minimal repro? Without more details, we can't really directly fix this.
You might also try import '@anthropic-ai/sdk/shims/node' or import '@anthropic-ai/sdk/shims/web' before your first import of the SDK.

This repro is pretty much the same as the docs; please run npm run build in this, https://codesandbox.io/p/sandbox/angry-thunder-ll36v2. Note it is the tsc command that fails.
I worked around this by converting the ts file to a js file with JSDOC comments, but that is a work around, not a "solution"

Thanks, we'll take a look!

@S-unya unfortunately I'm getting a "Sandbox not found" error message from https://codesandbox.io/p/sandbox/angry-thunder-ll36v2, is it private?


Constructors as first-class citizen

module test where
import nat
suc' : nat -> nat = suc

yields:
Type checking failed: expected a data type for the constructor suc but got Pi (nat) ((\(_ : nat) -> nat))

The workaround is to lambda-abstract suc:
suc' : nat -> nat = \(n : nat) -> suc n

File loaded.

I tried to end this message in a pun about "pointless" but I can't seem to hit the spot.

I implemented this for an earlier version of cubical where abstractions were not typed simply by eta-expanding the constructors sufficiently much. This was really easy to implement as I only needed to know how many arguments were missing in the application of the constructor. However with typed abstraction this becomes a little bit more complicated as I need to know what types are expected for the abstractions that I create while eta expanding (and this might be tricky to get right in the presence of dependent types...). Because of this I never bothered implementing this for cubicaltt. So for now the user has to eta expand by hand when necessary.
A possible way for solving this would be to do typed conversion. This would have the additional benefit that we can have untyped applications again and my old code for eta-expanding constructors should work.

Oh, one more thing. My previous solution for this was for a version without any HITs and I'm not sure if the presence of path constructors could complicate things...


[BUG] Can't remove PCI device from VM

Describe the bug

You can't remove a PCI device from a VM
To Reproduce
Steps to reproduce the behavior:

Deploy harvester to a node with PCI devices (like a GPU)
enable passthrough
Assign the available device to a VM and create it
Edit the config for the device and go to PCI devices

Expected behavior

The PCI devices tab should show currently assigned devices and you should be able to remove them
Support bundle

supportbundle_6c61bb28-b510-451b-80bc-f85c7f86bbeb_2022-10-18T22-21-10Z.zip
Environment

Harvester ISO version: v1.1.0-rc3
Underlying Infrastructure (e.g. Baremetal with Dell PowerEdge R630): Single node DL160

Additional context
Add any other context about the problem here.

Tested in Harvester master-7b698413-head. Verified as fixed.
Verification Steps

Add GPU to VM
Verify that VM has access to GPU
Remove GPU
Check that GPU isn't on VM 2
Add GPU to VM 2
Verify that VM 2 has GPU and it works


Dominik

Week 7: Your first repository

[x] Create a repository in your account and add a readme file
[x] Comment on this issue with a link to your repository

Week 9: PPI strategy

[ ] Upload a file with your proposed PPI strategy in your repository
[ ] Comment on this issue with a link to the file
[ ] Have a look through the PPI strategy of one of your fellow students and comment on their issue with feedback

Any time: Exploratory data analysis demo

[ ] Create a repository for your project and add a suitable Readme file
[ ] Link to the data
[ ] Upload your R markdown code
[ ] Comment on this issue with a link to your new repository if you'd like feedback from your tutors or fellow students

Here is my profile: https://github.com/soferos.

A GitHub veteran 😄 Thank you Dominik!


Enable mirror of meta-conan

Add https://github.com/conan-io/meta-conan to github-mirror so it can be consumed from jhcn-oss.

@h5b since it's on Github, please create a fork instead of a new repo.

create fork instead of mirror, close.

done


Add to_data to BaseBatch

Codecov Report
All modified lines are covered by tests :white_check_mark:

Files
Coverage Δ

src/redcat/base.py
100.00% <100.00%> (ø)

src/redcat/batchdict.py
100.00% <100.00%> (ø)

src/redcat/batchlist.py
100.00% <100.00%> (ø)

src/redcat/tensor.py
100.00% <100.00%> (ø)

:loudspeaker: Thoughts on this report? Let us know!.


TileLoader.PostDraw called on inactive tiles

This should be fixed. I think the second calling of TileLoader.PostDraw is incorrectly positioned, but the gotos are a little confusing to decipher.
The effect of this is apparent with doors, since they simply set the tile inactive and leave the tile type value there when closed.

I'd say let's save this for 1.3.6, see if any of that code changed and we might fix it actually by just fixing the patches with a bit of luck.


Repayment Lock shows negative days for new borrow

Overview
When doing a new borrow, the repayment lock has a negative amount of days listed in the borrow modal
References and additional details

Acceptance Criteria
Should say 0 days, or the current amount of days until repayment is unlocked
Need By Date
No response
Screenshots/Mockups
No response
Ownership

[X] If my bounty needs engineering or needs product I have added the respective labels on the right
[X] As the sponsor of this bounty I will review the changes in a preview environment (ops/product) or review the PR (engineering)

Estimated effort
No response
Sponsor / Stakeholder
No response
Bounty Hunters

Join our discord
Include an expected timeline for you to complete work in the work plan when you apply for this bounty!
Please refer to this link for some basic info
Please do not start work on this issue until you are approved in Gitcoin.

@MBMaria I'm looking to contribute towards this, can you tell me how do I do that?


Figure out how to support operator overloads

Lua allows operator overloads and several API's provide type-overloaded objects such as vectors in DotA. It would be nice if we could find a way to support declarations of type overloaded objects. For example:
class Vector {
    constructor(public x: number, public y: number) { }
    // Overloading + operator
    public __add(other: Vector): Vector {
        return new Vector(this.x + other.x, this.y + other.y);
    }
}

Would be nice if we could then do:
const v1 = new Vector(2,3);
const v2 = new Vector(4,5);
const v3 = v1 + v2;

Unfortunately since JavaScript does not support operator overloading, there is no good way to declare this in TypeScript. Operator overloads are very useful however, and it would be nice if we could support them somehow.

The real issue here is the '+' syntax. Typescript is pretty strict about this and short of using some really hacky type assertion stuff, I don't believe it's possible without modifying TS itself.
let a = new Vector(1, 2);
let b = new Vector(3, 4);
type V = Vector & number;
let c = <V>(<V>a + <V>b);

But if the goal is to support external code that uses overloads, declaring a custom function that 'magically' gets converted to the correct operator could be a way to go.
interface Addable<O, R = O> {
    __add(other: O): R;
}

declare function $add<O, R>(a: Addable<O, R>, b: O): R;

declare class Vector implements Addable<Vector>, Addable<number, Vector> {
    public constructor(x: number, y: number);
    public __add(other: Vector): Vector;
    public __add(other: number): Vector;
}

let a = new Vector(1, 2);
let b = new Vector(3, 4);
let c = $add(a, b);
let d = $add(a, 7);

local a = Vector.new(true,1,2);
local b = Vector.new(true,3,4);
local c = (a+b);
local d = (a+7);

yeah the issue is typescript here, and not the translation. This is a pretty common issue encountered when encountering declarations. Would be nice if we could come up with some kind of convention to deal with this. One hack I use is to indeed define type Vector = number which allows the use of operators, but then other properties are an issue. Your type intersection looks interesting, I will look into that.

The big problem with the intersection is the result of any '+' will be typed as a number, not the intersection type. So it has to be cast back again.
type V = Vector & number;
declare a: V;
declare b: V;
let c = a + b; //typeof c == number
let d: V = a + b; //error: cannot assign number to V
let e = <V>(a + b); //the only way

The best workaround i found so far is casting one(or both) operand to any and then back to the original type after calculation. But this also doesnt work in every case.
I think we can only properly implement overloading if TS adds support for it (but they already said the wont do it unless JS does it aswell). We could create a fork of TS and add it ourselves, but that would be a lot of work and hard to maintain

Yes I would prefer not to have to maintain TypeScript ourself. I am actually pretty happy with the intersection type @tomblind suggested, it does still require some casting but much less, it is certainly much better than the current 'type Vector = number' hack used in the DotA declarations.

Documented the workaround on the wiki:
https://github.com/Perryvw/TypescriptToLua/wiki/Writing-Declarations#operator-overloads
Closing this since we can not do anything else about this for now.


WCAG 2.2: Images ‖ Target Size (Minimum)

What
Update images guidance to specify a minimum set of dimensions that linked images should have.
Resources

Images styles page
WCAG 2.2 criterion for 'Target Size (Minimum)'

Why
The new WCAG 2.2 Level AA Criterion 'Target Size (Minimum)' says:

The size of the target for pointer inputs is at least 24 by 24 CSS pixels

Although it feels unlikely for a service team to use images smaller than this in public-facing services, case working tools may have smaller controls (for example, a toolbar on a WYSIWYG editor). We may want to include specific guidance about minimum sizes for linked or interactive images and iconography.
Who needs to work on this

Content designer or technical writer

Who needs to review this

Accessibility specialist
Content designer or technical writer

Done when

[ ] Guidance has been updated

Closing issue – content has been drafted, reviewed and added to pull request #3090 as part of https://github.com/alphagov/govuk-design-system/issues/3276.