积极答复者
同步延迟,Logreader日志显示: Replicated transactions are waiting for next Log backup or for mirroring partner to catch up.

问题
-
同步延迟,Logreader日志显示: Replicated transactions are waiting for next Log backup or for mirroring partner to catch up.
已经确定发布数据库没有打开 sync with backup 选项,而且测试验证过,没有日志备份,日志读取器工作不会受影响
跟踪标记 1448 已经打开,测试验证,手工将镜像 suspend,日志读器工作不受影响
但 LogReader agent 日志仍然会出现 Replicated transactions are waiting for next Log backup or for mirroring partner to catch up. 而且持续时间长,初步确定的现象是:
online rebuild index,这时候会产生大量日志(超过1G),完成之后日志 logreader agent 出现等待,并显示上述信息,在镜像同步完成之前不会消失(镜像是高性能模式 parter safety off), 将镜像暂停 (set partner suspend), 很快 logreader agent 继续工作,再将镜像恢复 (set partner resume), logreader agent 仍然继续工作,不再受镜像同步的影响
不知道大家有没有遇到这种问题,有没有什么彻底的解决方法
诡异的是为什么logreader agent会堵塞,镜像要 suspend 再resume就不再受影响(当然,这个suspend 再resume不是持久的,如果这样设置一次之后就再也没问题,那也算解决问题了)
顺便一提的是联机重建索引的日志开销,有时候一个几非MB的表,重建一个索引的日志开销超过10G,不管是排序放到tempdb,还是取消并行,都不会降低这种日志开销
答案
-
如果搭建了镜像, 那么logreader是读取mirror端的日志,而不是primary端的日志。所以如果大量的rebuild index,出现这种情况是正常的。
即使没有镜像,rebuild index也会造成log reader读取缓慢,因为log reader要过滤大量的non-replciate日志
- 已标记为答案 liwei-MSFTModerator 2014年12月12日 1:58
-
不管是读 primary 还是读 mirror, 都无法解释为什么把 mirror 做了 suspend 再 resume 后, logreader 马上就好了
不过你说到的是读 mirro, 我倒是想到了一种可能, rebuild 产生大量日志,在没有同步到 mirror 前,无法从 mirror 读,所以等,但是 suspend mirror的话,logreader 认为不可以读mirror了,所以改为读 primary, 这时候是肯定可以读的,于是 logreader 继续,mirror 在 resume 后也继续
我想这个才算是 suspend 再 resume mirror 可解决问题的原因吧?否则一味只读 mirror 或只读 primary 始终是解释不通的
- 已标记为答案 zjcxc.邹建 2014年12月17日 2:46
全部回复
-
原因: As per message i checked the transaction log backups were happened or not,
checked it and log backups were happening . Finally one option
is pending to review and it is mirroring. I checked the status of mirroring and
seen principal database went to synchronizing mode.
May be mirroring went in synchronizing mode due to heavy or so many
transactions in the route to apply at mirror database. So replication is
waiting to be synchronized status of principal database. I exactly do not know
why replication went in waiting even transaction log backups were happened. I
checked online solution and received some of the solutions from here and it
suggests following,解决办法: Enable trace flag 1448
After this setting the Log Reader Agent can continue replicating changes regardless of the mirroring state. Please read more here. I never applied these suggestions. Replication and mirroring both are using
transaction logs and this could be the reason why replication was in high delay status while mirroring was stuck or in process to synchronize mirror database.
So i turned off mirroring and monitored replication status. Finally replication was succeed to remove delay and applied all pending commands. Then i configured mirroring again after done with replication sync.Conclusion : We have two options either to wait for synchronized status of principal database or turned of mirroring, getting replication synced properly and reconfigure mirroring again depend on priority and importance.It will be better to go for correct solution to avoid such issue
Please Mark As Answer if it is helpful.
- 已编辑 KevinLiu328 2014年11月7日 3:13
- 已标记为答案 Michelle GeModerator 2014年11月14日 10:13
- 取消答案标记 zjcxc.邹建 2014年11月18日 1:30
-
如果搭建了镜像, 那么logreader是读取mirror端的日志,而不是primary端的日志。所以如果大量的rebuild index,出现这种情况是正常的。
即使没有镜像,rebuild index也会造成log reader读取缓慢,因为log reader要过滤大量的non-replciate日志
- 已标记为答案 liwei-MSFTModerator 2014年12月12日 1:58
-
不管是读 primary 还是读 mirror, 都无法解释为什么把 mirror 做了 suspend 再 resume 后, logreader 马上就好了
不过你说到的是读 mirro, 我倒是想到了一种可能, rebuild 产生大量日志,在没有同步到 mirror 前,无法从 mirror 读,所以等,但是 suspend mirror的话,logreader 认为不可以读mirror了,所以改为读 primary, 这时候是肯定可以读的,于是 logreader 继续,mirror 在 resume 后也继续
我想这个才算是 suspend 再 resume mirror 可解决问题的原因吧?否则一味只读 mirror 或只读 primary 始终是解释不通的
- 已标记为答案 zjcxc.邹建 2014年12月17日 2:46