distribution cleanup job2

第25行开始清除事务和命令image

sp_MSdistribution_delete以发布库(@publisher_database_id)为单位清除:

  1. 第15行,得到改发布库的需要清除的最大序列号(@max_cleanup_xact_seqno)
  2. 地20行,调用sp_MSdelete_publisherdb_trans来删除这些数据,所以早于@max_cleanup_xact_seqno的数据都会被删除

image

sp_MSdelete_publisherdb_trans是真正执行删除操作的存储过程。该存储过程删除msrepl_commands,并通过调用sp_MSdelete_dodelete来删除msrepl_transactions

原文地址:https://www.cnblogs.com/stswordman/p/2082696.html