备库读涉及快照的流程
rbreak procarray.c:.
比较简单,直接拿快照就好了。
堆栈:
备库更新procarray流程
主库的事务状态会拼成xlog发送给备库:
- 主库上有三个事务在运行
- 备库收到
info == XLOG_RUNNING_XACTS
类型xlog,解析后还原为RunningTransactionsData running
- 使用running刷新备库snapshot状态
备库 【1】
代码语言:javascript复制(gdb) bt
#0 RecordKnownAssignedTransactionIds (xid=612) at procarray.c:3199
#1 0x0000000000549019 in StartupXLOG () at xlog.c:7279
#2 0x00000000007e181f in StartupProcessMain () at startup.c:230
#3 0x000000000055d5c9 in AuxiliaryProcessMain (argc=2, argv=0x7ffe04557c20) at bootstrap.c:426
#4 0x00000000007e0710 in StartChildProcess (type=StartupProcess) at postmaster.c:5463
#5 0x00000000007db5bb in PostmasterMain (argc=3, argv=0x1a79c80) at postmaster.c:1377
#6 0x00000000007195f6 in main (argc=3, argv=0x1a79c80) at main.c:228
【2】
代码语言:javascript复制#0 KnownAssignedXidsAdd (from_xid=612, to_xid=612, exclusive_lock=0 '