17.03.2015 13:22, Sergey Shchukin
пишет:
One more thing We have upgraded one of our shards to 9.4.1 and expectedly that did not help. A few things to notice which may be useful. 1. When replay stops, startup process reads a lot from array with $PGDATA. In iotop and iostat we see the following: Total DISK READ: 490.42 M/s | Total DISK WRITE: 3.82 M/s TID PRIO USER DISK READ> DISK WRITE SWAPIN IO COMMAND 3316 be/4 postgres 492.34 M/s 0.00 B/s 0.00 % 39.91 % postgres: startup process <...> Device: rrqm/s wrqm/s r/s w/s rMB/s wMB/s avgrq-sz avgqu-sz await svctm %util <...> md2 0.00 0.00 6501.00 7.00 339.90 0.03 106.97 0.00 0.00 0.00 0.00 md3 0.00 0.00 0.00 1739.00 0.00 6.79 8.00 0.00 0.00 0.00 0.00 root@rpopdb04g ~ # fgrep 9.4 /proc/mounts /dev/md2 /var/lib/pgsql/9.4/data ext4 rw,noatime,nodiratime,barrier=1,stripe=64,data="" 0 0 /dev/md3 /var/lib/pgsql/9.4/data/pg_xlog ext4 rw,noatime,nodiratime,barrier=0,stripe=64,data="" 0 0 root@rpopdb04g ~ # 2. The state of the startup process is changing in such a way: root@rpopdb04g ~ # while true; do ps aux | grep '[s]tartup'; sleep 1; done postgres 3316 26.6 3.2 4732052 4299260 ? Rs 18:04 8:11 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Ts 18:04 8:11 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Rs 18:04 8:12 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Ds 18:04 8:12 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Rs 18:04 8:13 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Rs 18:04 8:13 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Rs 18:04 8:14 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Ts 18:04 8:14 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Ds 18:04 8:15 postgres: startup process postgres 3316 26.6 3.2 4732052 4299260 ? Rs 18:04 8:15 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Ds 18:04 8:15 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Ds 18:04 8:16 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Rs 18:04 8:16 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Rs 18:04 8:17 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Ts 18:04 8:17 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Rs 18:04 8:18 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Rs 18:04 8:18 postgres: startup process postgres 3316 26.7 3.2 4732052 4299260 ? Ds 18:04 8:19 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Rs 18:04 8:19 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Rs 18:04 8:20 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Rs 18:04 8:20 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Ds 18:04 8:21 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Ds 18:04 8:22 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Rs 18:04 8:22 postgres: startup process postgres 3316 26.8 3.2 4732052 4299260 ? Rs 18:04 8:23 postgres: startup process postgres 3316 26.9 3.2 4732052 4299260 ? Rs 18:04 8:23 postgres: startup process postgres 3316 26.9 3.2 4732052 4299260 ? Rs 18:04 8:24 postgres: startup process postgres 3316 26.9 3.2 4732052 4299260 ? Ts 18:04 8:24 postgres: startup process postgres 3316 26.9 3.2 4732052 4299260 ? Rs 18:04 8:25 postgres: startup process ^C root@rpopdb04g ~ # 3. confl* fields in pg_stat_database_conflicts are always zero during the pausing of replay. 4. The stack-traces taken with GDB are not really informative. We will recompile PostgreSQL with —enable-debug option and run it on one of our replicas if needed. Since it is a production system we would like to do it last of all. But we will do it if anybody would not give us any ideas. 5. In one of the experiments replay stopped on 4115/56126DC0 xlog position. Here is a bit of pg_xlogdump output: rpopdb04d/rpopdb M # select pg_xlogfile_name('4115/56126DC0'); pg_xlogfile_name -------------------------- 000000060000411500000056 (1 row) Time: 0.496 ms rpopdb04d/rpopdb M # root@pg-backup04h /u0/rpopdb04/wals/0000000600004115 # /usr/pgsql-9.4/bin/pg_xlogdump 000000060000411500000056 000000060000411500000056 | fgrep 4115/56126DC0 -C10 rmgr: Heap len (rec/tot): 36/ 3948, tx: 3930143874, lsn: 4115/561226C8, prev 4115/56122698, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 196267/4 xmax 3930143874 ; new tid 196267/10 xmax 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143874, lsn: 4115/56123638, prev 4115/561226C8, bkp: 0000, desc: commit: 2015-03-19 18:26:27.725158 MSK rmgr: Heap len (rec/tot): 58/ 90, tx: 3930143875, lsn: 4115/56123668, prev 4115/56123638, bkp: 0000, desc: hot_update: rel 1663/16420/16737; tid 23624/3 xmax 3930143875 ; new tid 23624/21 xmax 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143875, lsn: 4115/561236C8, prev 4115/56123668, bkp: 0000, desc: commit: 2015-03-19 18:26:27.726432 MSK rmgr: Heap len (rec/tot): 36/ 2196, tx: 3930143876, lsn: 4115/561236F8, prev 4115/561236C8, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 123008/4 xmax 3930143876 ; new tid 123008/5 xmax 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143876, lsn: 4115/56123F90, prev 4115/561236F8, bkp: 0000, desc: commit: 2015-03-19 18:26:27.727088 MSK rmgr: Heap len (rec/tot): 36/ 7108, tx: 3930143877, lsn: 4115/56123FC0, prev 4115/56123F90, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 34815/6 xmax 3930143877 ; new tid 34815/16 xmax 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143877, lsn: 4115/56125BA0, prev 4115/56123FC0, bkp: 0000, desc: commit: 2015-03-19 18:26:27.728178 MSK rmgr: Heap len (rec/tot): 36/ 4520, tx: 3930143878, lsn: 4115/56125BD0, prev 4115/56125BA0, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 147863/5 xmax 3930143878 ; new tid 147863/16 xmax 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143878, lsn: 4115/56126D90, prev 4115/56125BD0, bkp: 0000, desc: commit: 2015-03-19 18:26:27.728339 MSK rmgr: Btree len (rec/tot): 20/ 52, tx: 0, lsn: 4115/56126DC0, prev 4115/56126D90, bkp: 0000, desc: vacuum: rel 1663/16420/16796; blk 31222118, lastBlockVacuumed 0 rmgr: Heap len (rec/tot): 36/ 6112, tx: 3930143879, lsn: 4115/56126DF8, prev 4115/56126DC0, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 23461/26 xmax 3930143879 ; new tid 23461/22 xmax 0 rmgr: Heap2 len (rec/tot): 24/ 8160, tx: 0, lsn: 4115/561285F0, prev 4115/56126DF8, bkp: 1000, desc: clean: rel 1663/16420/16782; blk 21997709 remxid 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143879, lsn: 4115/5612A5E8, prev 4115/561285F0, bkp: 0000, desc: commit: 2015-03-19 18:26:27.728805 MSK rmgr: Heap2 len (rec/tot): 20/ 8268, tx: 0, lsn: 4115/5612A618, prev 4115/5612A5E8, bkp: 1000, desc: visible: rel 1663/16420/16782; blk 21997709 rmgr: Heap len (rec/tot): 36/ 7420, tx: 3930143880, lsn: 4115/5612C680, prev 4115/5612A618, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 37456/8 xmax 3930143880 ; new tid 37456/29 xmax 0 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143880, lsn: 4115/5612E398, prev 4115/5612C680, bkp: 0000, desc: commit: 2015-03-19 18:26:27.729141 MSK rmgr: Heap len (rec/tot): 36/ 7272, tx: 3930143881, lsn: 4115/5612E3C8, prev 4115/5612E398, bkp: 1000, desc: hot_update: rel 1663/16420/16737; tid 23614/2 xmax 3930143881 ; new tid 23614/22 xmax 0 rmgr: Heap len (rec/tot): 150/ 182, tx: 0, lsn: 4115/56130048, prev 4115/5612E3C8, bkp: 0000, desc: inplace: rel 1663/16420/12764; tid 11/31 rmgr: Transaction len (rec/tot): 12/ 44, tx: 3930143881, lsn: 4115/56130100, prev 4115/56130048, bkp: 0000, desc: commit: 2015-03-19 18:26:27.729340 MSK rmgr: Heap len (rec/tot): 43/ 75, tx: 3930143882, lsn: 4115/56130130, prev 4115/56130100, bkp: 0000, desc: insert: rel 1663/16420/16773; tid 10159950/26 rmgr: Btree len (rec/tot): 42/ 74, tx: 3930143882, lsn: 4115/56130180, prev 4115/56130130, bkp: 0000, desc: insert: rel 1663/16420/16800; tid 12758988/260 root@pg-backup04h /u0/rpopdb04/wals/0000000600004115 # Any help would be really appropriate. Thanks in advance. |