On Thu, Nov 18, 2021 at 1:51 PM Michael Paquier <mich...@paquier.xyz> wrote: > > On Thu, Nov 18, 2021 at 01:32:08PM +0530, Bharath Rupireddy wrote: > > Hm. So, the pg_waldump can have handlers for SIGINT, SIGTERM, SIGQUIT > > and then it should emit the computed stats in those handlers the > > comobinations - "-s/-f/-z" and "-s/-e/-f/-z". I'm okay with this > > behaviour. Michael Paquier had suggested the same upthread. If okay, I > > will work on that patch. > > While on it, I am pretty sure that we should add in the stats report > the start and end LSNs matching with the reports. If you use --follow > and the call is interrupted, we would not really know to which part of > the WAL stream a report applies to without this information, likely in > the shape of an extra header.
Currently, the SIGINT, SIGTERM, SIGQUIT interruptions will cause the pg_waldump process with --follow option to get killed. And it is a good idea to specify the range of LSNs (start and end) upto which the stats are computed. Maybe as another printf message at the end of the stats report, after the "Total" section or at the beginning of the stats report. Something like "summary of the statistics computed from << LSN >> to <<LSN>> are:", see [1]. [1] ubuntu3:~/postgres/src/bin/pg_waldump$ ./pg_waldump -p data -s 0/1480000 --stats summary of the statistics computed from 0/1480000 and 0/158ABCD are: Type N (%) Record size (%) FPI size (%) Combined size (%) ---- - --- ----------- --- -------- --- ------------- --- XLOG 13 ( 0.13) 1138 ( 0.18) 8424 ( 2.46) 9562 ( 0.99) Transaction 14 ( 0.14) 1407 ( 0.22) 0 ( 0.00) 1407 ( 0.15) Storage 4 ( 0.04) 172 ( 0.03) 0 ( 0.00) 172 ( 0.02) CLOG 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) Database 1 ( 0.01) 42 ( 0.01) 0 ( 0.00) 42 ( 0.00) Tablespace 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) MultiXact 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) RelMap 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) Standby 37 ( 0.36) 2318 ( 0.37) 0 ( 0.00) 2318 ( 0.24) Heap2 74 ( 0.73) 12841 ( 2.05) 121184 ( 35.46) 134025 ( 13.84) Heap 9005 ( 88.23) 532313 ( 84.91) 84208 ( 24.64) 616521 ( 63.64) Btree 1058 ( 10.37) 76710 ( 12.24) 127932 ( 37.43) 204642 ( 21.13) Hash 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) Gin 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) Gist 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) Sequence 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) SPGist 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) BRIN 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) CommitTs 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) ReplicationOrigin 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) Generic 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) LogicalMessage 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) 0 ( 0.00) -------- -------- -------- -------- Total 10206 626941 [64.72%] 341748 [35.28%] 968689 [100%] Regards, Bharath Rupireddy.