最近经常有同学会问关于WAL 的问题,问能不能总结一下,这里我们总结关于WAL write ahead log 的问题的一个系列
在PostgreSQL write ahead log 的解析部分,pg_waldump 是必须被提起的工具,并且这个工具在不同的版本中都有变化, pg_waldump工具最早是产生于 PG9.3作为一个 contrib module 模块中的部分出现的,经历了9.4.9.5 的功能的添加,在PG10 将原来 pg_xlogdump 名字改为pg_waldump 截止到当前 postgresql 16(非正式) 版本中 pg_waldump还在进行各种的随着数据库的升级后的版本更新。
pg_waldump 中获取日志信息的来源可以通过 pg_waldump --rmgr-list来获得可以获得事务信息来源。
在使用pg_waldump的命令读取日志,可能会出现错误,一般产生这个问题主要是数据库处理数据的时候在 idel 的状态,因为PG 有相关的参数在没有数据库的活动的情况下,也可以产生日志,在读取这样的部分的情况下就会产生问题。
pg_waldump /pgdata/data/pg_wal/00000001000000070000000D
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34000028, prev 7/331903C8, desc: RUNNING_XACTS nextXid 1061 latestCompletedXid 1060 oldestRunningXid 1061
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34000060, prev 7/34000028, desc: RUNNING_XACTS nextXid 1061 latestCompletedXid 1060 oldestRunningXid 1061
rmgr: XLOG len (rec/tot): 114/ 114, tx: 0, lsn: 7/34000098, prev 7/34000060, desc: CHECKPOINT_ONLINE redo 7/34000060; tli 1; prev tli 1; fpw true; xid 0:1061; oid 32873; multi 4; offset 9; oldest xid 726 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 1061; online
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34000110, prev 7/34000098, desc: RUNNING_XACTS nextXid 1061 latestCompletedXid 1060 oldestRunningXid 1061
pg_waldump: fatal: error in WAL record at 7/34000110: invalid record length at 7/34000148: wanted 24, got 0
我们做如下的操作,然后通过pg_waldump 来查看相关的记录
cache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 snapshot 2608 relcache 24778
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34021D88, prev 7/34021BF0, desc: RUNNING_XACTS nextXid 1062 latestCompletedXid 1061 oldestRunningXid 1062
rmgr: Heap len (rec/tot): 59/ 59, tx: 1062, lsn: 7/34021DC0, prev 7/34021D88, desc: INSERT+INIT off 1 flags 0x00, blkref #0: rel 1663/24760/24778 blk 0
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1062, lsn: 7/34021E00, prev 7/34021DC0, desc: COMMIT 2023-03-26 08:16:06.160522 EDT
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34021E28, prev 7/34021E00, desc: RUNNING_XACTS nextXid 1063 latestCompletedXid 1062 oldestRunningXid 1063
rmgr: Heap len (rec/tot): 69/ 69, tx: 1063, lsn: 7/34021E60, prev 7/34021E28, desc: HOT_UPDATE off 1 xmax 1063 flags 0x40 ; new off 2 xmax 0, blkref #0: rel 1663/24760/24778 blk 0
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1063, lsn: 7/34021EA8, prev 7/34021E60, desc: COMMIT 2023-03-26 08:16:19.239652 EDT
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34021ED0, prev 7/34021EA8, desc: RUNNING_XACTS nextXid 1064 latestCompletedXid 1063 oldestRunningXid 1064
rmgr: Heap len (rec/tot): 54/ 54, tx: 1064, lsn: 7/34021F08, prev 7/34021ED0, desc: DELETE off 2 flags 0x00 KEYS_UPDATED , blkref #0: rel 1663/24760/24778 blk 0
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1064, lsn: 7/34021F40, prev 7/34021F08, desc: COMMIT 2023-03-26 08:16:32.959424 EDT
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34021F68, prev 7/34021F40, desc: RUNNING_XACTS nextXid 1065 latestCompletedXid 1064 oldestRunningXid 1065
rmgr: XLOG len (rec/tot): 114/ 114, tx: 0, lsn: 7/34021FA0, prev 7/34021F68, desc: CHECKPOINT_ONLINE redo 7/34021F68; tli 1; prev tli 1; fpw true; xid 0:1065; oid 32873; multi 4; offset 9; oldest xid 726 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 1065; online
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34022030, prev 7/34021FA0, desc: RUNNING_XACTS nextXid 1065 latestCompletedXid 1064 oldestRunningXid 1065
从上面的pg_wal 日志里,我们可以清晰的看出来相关的操作, standby , heap ,transaction 为组成的整体操作。
从这里我们搞清楚了进行一个操作如 INSERT UPDATE DELETE ,在wal 日志中均会产生
1 具体的操作 2 commit 3 更新 XACTS ID
在分析中,我们可以针对要分析的位置和日志进行定位,在需要分析的操作前我们先查看当前的 wal lsn 通过 select pg_current_wal_lsn(); 来进行定位
在整体需要跟踪学习的操作完毕后我们可以通过如下的语句来进行日志的文件和位置的定位。
select pg_current_wal_lsn(),
pg_walfile_name(pg_current_wal_lsn()),
pg_walfile_name_offset(pg_current_wal_lsn());
通过语句我们定位到当前的LSN 号,日志文件号信息等。通过pg_waldump 命令的参数,-s -e
下面我们做一个实验
日志的初始lsn 7/34022068 操作结束时lsn 7/3403C748
日志的名字为 00000001000000070000000D
pg_waldump /pgdata/data/pg_wal/00000001000000070000000D -s 7/34022068 -e 7/3403C748 在我们确认日志,开始,结束点后,我们得到如下的解析后的日志信息
rmgr: Storage len (rec/tot): 42/ 42, tx: 0, lsn: 7/34022068, prev 7/34022030, desc: CREATE base/24760/24781
rmgr: Heap len (rec/tot): 54/ 1582, tx: 1065, lsn: 7/34022098, prev 7/34022068, desc: INSERT off 8 flags 0x00, blkref #0: rel 1663/24760/1247 blk 14 FPW
rmgr: Btree len (rec/tot): 53/ 4973, tx: 1065, lsn: 7/340226C8, prev 7/34022098, desc: INSERT_LEAF off 244, blkref #0: rel 1663/24760/2703 blk 2 FPW
rmgr: Btree len (rec/tot): 53/ 6165, tx: 1065, lsn: 7/34023A38, prev 7/340226C8, desc: INSERT_LEAF off 172, blkref #0: rel 1663/24760/2704 blk 2 FPW
rmgr: Heap2 len (rec/tot): 57/ 261, tx: 1065, lsn: 7/34025268, prev 7/34023A38, desc: MULTI_INSERT 1 tuples flags 0x02, blkref #0: rel 1663/24760/2608 blk 65 FPW
rmgr: Btree len (rec/tot): 53/ 4929, tx: 1065, lsn: 7/34025370, prev 7/34025268, desc: INSERT_LEAF off 113, blkref #0: rel 1663/24760/2673 blk 37 FPW
rmgr: Btree len (rec/tot): 53/ 5657, tx: 1065, lsn: 7/340266D0, prev 7/34025370, desc: INSERT_LEAF off 199, blkref #0: rel 1663/24760/2674 blk 52 FPW
rmgr: Heap len (rec/tot): 211/ 211, tx: 1065, lsn: 7/34027CF0, prev 7/340266D0, desc: INSERT off 9 flags 0x00, blkref #0: rel 1663/24760/1247 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34027DC8, prev 7/34027CF0, desc: INSERT_LEAF off 244, blkref #0: rel 1663/24760/2703 blk 2
rmgr: Btree len (rec/tot): 53/ 7097, tx: 1065, lsn: 7/34027E08, prev 7/34027DC8, desc: INSERT_LEAF off 68, blkref #0: rel 1663/24760/2704 blk 4 FPW
rmgr: Heap2 len (rec/tot): 85/ 85, tx: 1065, lsn: 7/340299E0, prev 7/34027E08, desc: MULTI_INSERT 1 tuples flags 0x02, blkref #0: rel 1663/24760/2608 blk 65
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34029A38, prev 7/340299E0, desc: INSERT_LEAF off 113, blkref #0: rel 1663/24760/2673 blk 37
rmgr: Btree len (rec/tot): 53/ 4229, tx: 1065, lsn: 7/34029A80, prev 7/34029A38, desc: INSERT_LEAF off 148, blkref #0: rel 1663/24760/2674 blk 50 FPW
rmgr: Heap len (rec/tot): 54/ 5218, tx: 1065, lsn: 7/3402AB20, prev 7/34029A80, desc: INSERT off 25 flags 0x01, blkref #0: rel 1663/24760/1259 blk 5 FPW
rmgr: Btree len (rec/tot): 53/ 2553, tx: 1065, lsn: 7/3402BF88, prev 7/3402AB20, desc: INSERT_LEAF off 123, blkref #0: rel 1663/24760/2662 blk 2 FPW
rmgr: Btree len (rec/tot): 53/ 4085, tx: 1065, lsn: 7/3402C9A0, prev 7/3402BF88, desc: INSERT_LEAF off 108, blkref #0: rel 1663/24760/2663 blk 2 FPW
rmgr: Btree len (rec/tot): 53/ 3853, tx: 1065, lsn: 7/3402D998, prev 7/3402C9A0, desc: INSERT_LEAF off 188, blkref #0: rel 1663/24760/3455 blk 4 FPW
rmgr: Heap2 len (rec/tot): 57/ 1117, tx: 1065, lsn: 7/3402E8C0, prev 7/3402D998, desc: MULTI_INSERT 1 tuples flags 0x02, blkref #0: rel 1663/24760/1249 blk 55 FPW
rmgr: Btree len (rec/tot): 53/ 5689, tx: 1065, lsn: 7/3402ED20, prev 7/3402E8C0, desc: INSERT_LEAF off 165, blkref #0: rel 1663/24760/2658 blk 14 FPW
rmgr: Btree len (rec/tot): 53/ 1553, tx: 1065, lsn: 7/34030378, prev 7/3402ED20, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10 FPW
rmgr: Heap2 len (rec/tot): 830/ 830, tx: 1065, lsn: 7/34030990, prev 7/34030378, desc: MULTI_INSERT 6 tuples flags 0x02, blkref #0: rel 1663/24760/1249 blk 55
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34030CD0, prev 7/34030990, desc: INSERT_LEAF off 165, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34030D18, prev 7/34030CD0, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34030D58, prev 7/34030D18, desc: INSERT_LEAF off 167, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34030DA0, prev 7/34030D58, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34030DE0, prev 7/34030DA0, desc: INSERT_LEAF off 165, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34030E28, prev 7/34030DE0, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34030E68, prev 7/34030E28, desc: INSERT_LEAF off 168, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34030EB0, prev 7/34030E68, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34030EF0, prev 7/34030EB0, desc: INSERT_LEAF off 165, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34030F38, prev 7/34030EF0, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Btree len (rec/tot): 72/ 72, tx: 1065, lsn: 7/34030F78, prev 7/34030F38, desc: INSERT_LEAF off 169, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1065, lsn: 7/34030FC0, prev 7/34030F78, desc: INSERT_LEAF off 73, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Heap2 len (rec/tot): 85/ 85, tx: 1065, lsn: 7/34031000, prev 7/34030FC0, desc: MULTI_INSERT 1 tuples flags 0x02, blkref #0: rel 1663/24760/2608 blk 65
rmgr: Btree len (rec/tot): 53/ 6161, tx: 1065, lsn: 7/34031058, prev 7/34031000, desc: INSERT_LEAF off 208, blkref #0: rel 1663/24760/2673 blk 41 FPW
rmgr: Btree len (rec/tot): 53/ 6133, tx: 1065, lsn: 7/34032888, prev 7/34031058, desc: INSERT_LEAF off 102, blkref #0: rel 1663/24760/2674 blk 48 FPW
rmgr: Standby len (rec/tot): 42/ 42, tx: 1065, lsn: 7/34034098, prev 7/34032888, desc: LOCK xid 1065 db 24760 rel 24781
rmgr: Transaction len (rec/tot): 405/ 405, tx: 1065, lsn: 7/340340C8, prev 7/34034098, desc: COMMIT 2023-03-26 11:45:21.364693 EDT; inval msgs: catcache 76 catcache 75 catcache 76 catcache 75 catcache 51 catcache 50 catcache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 catcache 7 catcache 6 snapshot 2608 relcache 24781
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34034260, prev 7/340340C8, desc: RUNNING_XACTS nextXid 1066 latestCompletedXid 1065 oldestRunningXid 1066
rmgr: Heap len (rec/tot): 59/ 59, tx: 1066, lsn: 7/34034298, prev 7/34034260, desc: INSERT+INIT off 1 flags 0x00, blkref #0: rel 1663/24760/24781 blk 0
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1066, lsn: 7/340342D8, prev 7/34034298, desc: COMMIT 2023-03-26 11:45:32.308997 EDT
rmgr: Heap len (rec/tot): 59/ 59, tx: 1067, lsn: 7/34034300, prev 7/340342D8, desc: INSERT off 2 flags 0x00, blkref #0: rel 1663/24760/24781 blk 0
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1067, lsn: 7/34034340, prev 7/34034300, desc: COMMIT 2023-03-26 11:45:41.511395 EDT
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34034368, prev 7/34034340, desc: RUNNING_XACTS nextXid 1068 latestCompletedXid 1067 oldestRunningXid 1068
rmgr: Heap len (rec/tot): 54/ 54, tx: 1068, lsn: 7/340343A0, prev 7/34034368, desc: DELETE off 2 flags 0x00 KEYS_UPDATED , blkref #0: rel 1663/24760/24781 blk 0
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1068, lsn: 7/340343D8, prev 7/340343A0, desc: COMMIT 2023-03-26 11:45:56.431164 EDT
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34034400, prev 7/340343D8, desc: RUNNING_XACTS nextXid 1069 latestCompletedXid 1068 oldestRunningXid 1069
rmgr: Storage len (rec/tot): 42/ 42, tx: 0, lsn: 7/34034438, prev 7/34034400, desc: CREATE base/24760/24784
rmgr: Standby len (rec/tot): 42/ 42, tx: 1069, lsn: 7/34034468, prev 7/34034438, desc: LOCK xid 1069 db 24760 rel 24784
rmgr: Heap len (rec/tot): 203/ 203, tx: 1069, lsn: 7/34034498, prev 7/34034468, desc: INSERT off 27 flags 0x00, blkref #0: rel 1663/24760/1259 blk 5
rmgr: Btree len (rec/tot): 64/ 64, tx: 1069, lsn: 7/34034568, prev 7/34034498, desc: INSERT_LEAF off 124, blkref #0: rel 1663/24760/2662 blk 2
rmgr: Btree len (rec/tot): 53/ 5905, tx: 1069, lsn: 7/340345A8, prev 7/34034568, desc: INSERT_LEAF off 40, blkref #0: rel 1663/24760/2663 blk 1 FPW
rmgr: Btree len (rec/tot): 64/ 64, tx: 1069, lsn: 7/34035CC0, prev 7/340345A8, desc: INSERT_LEAF off 189, blkref #0: rel 1663/24760/3455 blk 4
rmgr: Heap2 len (rec/tot): 180/ 180, tx: 1069, lsn: 7/34035D00, prev 7/34035CC0, desc: MULTI_INSERT 1 tuples flags 0x02, blkref #0: rel 1663/24760/1249 blk 55
rmgr: Btree len (rec/tot): 64/ 64, tx: 1069, lsn: 7/34035DB8, prev 7/34035D00, desc: INSERT_LEAF off 172, blkref #0: rel 1663/24760/2658 blk 14
rmgr: Btree len (rec/tot): 64/ 64, tx: 1069, lsn: 7/34035DF8, prev 7/34035DB8, desc: INSERT_LEAF off 80, blkref #0: rel 1663/24760/2659 blk 10
rmgr: Heap len (rec/tot): 54/ 8042, tx: 1069, lsn: 7/34035E38, prev 7/34035DF8, desc: INSERT off 4 flags 0x01, blkref #0: rel 1663/24760/2610 blk 1 FPW
rmgr: Btree len (rec/tot): 53/ 3253, tx: 1069, lsn: 7/34037DC0, prev 7/34035E38, desc: INSERT_LEAF off 158, blkref #0: rel 1663/24760/2678 blk 1 FPW
rmgr: Btree len (rec/tot): 53/ 3253, tx: 1069, lsn: 7/34038A90, prev 7/34037DC0, desc: INSERT_LEAF off 158, blkref #0: rel 1663/24760/2679 blk 1 FPW
rmgr: Heap2 len (rec/tot): 85/ 85, tx: 1069, lsn: 7/34039748, prev 7/34038A90, desc: MULTI_INSERT 1 tuples flags 0x02, blkref #0: rel 1663/24760/2608 blk 65
rmgr: Btree len (rec/tot): 72/ 72, tx: 1069, lsn: 7/340397A0, prev 7/34039748, desc: INSERT_LEAF off 209, blkref #0: rel 1663/24760/2673 blk 41
rmgr: Btree len (rec/tot): 72/ 72, tx: 1069, lsn: 7/340397E8, prev 7/340397A0, desc: INSERT_LEAF off 200, blkref #0: rel 1663/24760/2674 blk 52
rmgr: XLOG len (rec/tot): 49/ 109, tx: 1069, lsn: 7/34039830, prev 7/340397E8, desc: FPI , blkref #0: rel 1663/24760/24784 blk 1 FPW
rmgr: XLOG len (rec/tot): 49/ 137, tx: 1069, lsn: 7/340398A0, prev 7/34039830, desc: FPI , blkref #0: rel 1663/24760/24784 blk 0 FPW
rmgr: Heap len (rec/tot): 188/ 188, tx: 1069, lsn: 7/34039930, prev 7/340398A0, desc: INPLACE off 25, blkref #0: rel 1663/24760/1259 blk 5
rmgr: Heap len (rec/tot): 188/ 188, tx: 1069, lsn: 7/340399F0, prev 7/34039930, desc: INPLACE off 27, blkref #0: rel 1663/24760/1259 blk 5
rmgr: Transaction len (rec/tot): 274/ 274, tx: 1069, lsn: 7/34039AB0, prev 7/340399F0, desc: COMMIT 2023-03-26 11:46:15.154540 EDT; inval msgs: catcache 51 catcache 50 catcache 51 catcache 50 catcache 51 catcache 50 catcache 7 catcache 6 catcache 32 relcache 24781 relcache 24784 relcache 24784 relcache 24781 snapshot 2608
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/34039BC8, prev 7/34039AB0, desc: RUNNING_XACTS nextXid 1070 latestCompletedXid 1069 oldestRunningXid 1070
rmgr: XLOG len (rec/tot): 49/ 8037, tx: 0, lsn: 7/34039C00, prev 7/34039BC8, desc: FPI_FOR_HINT , blkref #0: rel 1663/24760/2610 blk 1 FPW
rmgr: XLOG len (rec/tot): 49/ 2145, tx: 0, lsn: 7/3403BB80, prev 7/34039C00, desc: FPI_FOR_HINT , blkref #0: rel 1663/24760/1249 blk 55 FPW
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/3403C400, prev 7/3403BB80, desc: RUNNING_XACTS nextXid 1070 latestCompletedXid 1069 oldestRunningXid 1070
rmgr: Heap len (rec/tot): 65/ 197, tx: 1070, lsn: 7/3403C438, prev 7/3403C400, desc: UPDATE off 1 xmax 1070 flags 0x00 ; new off 3 xmax 0, blkref #0: rel 1663/24760/24781 blk 0 FPW
rmgr: Btree len (rec/tot): 53/ 133, tx: 1070, lsn: 7/3403C500, prev 7/3403C438, desc: INSERT_LEAF off 2, blkref #0: rel 1663/24760/24784 blk 1 FPW
rmgr: Transaction len (rec/tot): 34/ 34, tx: 1070, lsn: 7/3403C588, prev 7/3403C500, desc: COMMIT 2023-03-26 11:46:50.660698 EDT
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/3403C5B0, prev 7/3403C588, desc: RUNNING_XACTS nextXid 1071 latestCompletedXid 1070 oldestRunningXid 1071
rmgr: XLOG len (rec/tot): 114/ 114, tx: 0, lsn: 7/3403C5E8, prev 7/3403C5B0, desc: CHECKPOINT_ONLINE redo 7/34039C00; tli 1; prev tli 1; fpw true; xid 0:1070; oid 32873; multi 4; offset 9; oldest xid 726 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 1070; online
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/3403C660, prev 7/3403C5E8, desc: RUNNING_XACTS nextXid 1071 latestCompletedXid 1070 oldestRunningXid 1071
rmgr: Standby len (rec/tot): 50/ 50, tx: 0, lsn: 7/3403C698, prev 7/3403C660, desc: RUNNING_XACTS nextXid 1071 latestCompletedXid 1070 oldestRunningXid 1071
rmgr: XLOG len (rec/tot): 114/ 114, tx: 0, lsn: 7/3403C6D0, prev 7/3403C698, desc: CHECKPOINT_ONLINE redo 7/3403C698; tli 1; prev tli 1; fpw true; xid 0:1071; oid 32873; multi 4; offset 9; oldest xid 726 in DB 1; oldest multi 1 in DB 1; oldest/newest commit timestamp xid: 0/0; oldest running xid 1071; online
那么这里需要说明通过pg_waldump 本身是无法给你解析出类似 mysqlbinlog 那样的解析出实际操作的数据的,pg_waldump 本身是在告诉你pg_wal 中的日志本身操作后写入的方式和数据类型,同时pg_wal 本身另一个功能更是将日志中的数据统计信息进行输出,如下方截图中的部分。
从下图可以看到,FPI ,full page write 所在日志中占据的比重,通过pg_waldump 中的 -z 参数
pg_waldump /pgdata/data/pg_wal/00000001000000070000000D -s 7/34022068 -e 7/3403C748 -z
标签:WAL,POSTGRESQL,tx,lsn,len,tot,rec,日志,prev From: https://blog.51cto.com/u_14150796/7343349