There are already a number of data sources you can reference when investigating replication issues. One data source on my wish list was to have a one-stop shop in Extended Events similar to the AlwaysOn Health Session.<\/p>\n
It turns out that SQL Server 2012 does have a few new replication related events, but don\u2019t get too excited\u2026 Books Online manages our expectations in the following text (underlined text added by me):<\/p>\n
\n\u201cReplication supports Extended Events, however, this feature is for internal use only at this time<\/u>. Replication extended events were added to help customer support engineers collect information to troubleshoot replication problems. The information collected is not useful for replication performance tuning or monitoring<\/u>.\u201d <\/p>\n<\/blockquote>\n
There was a dash of hope in the \u201cat this time\u201d qualifier, but that was the only good news I could get from this. But even then, I wanted to be absolutely sure that there were truly no hidden diagnostic data sources that could be leveraged for replication issues.<\/p>\n
I found the following potentially promising events in sys.dm_xe_objects:<\/p>\n
\nrepl_event
logreader_process_text_info
logreader_process_text_ptr
logreader_process_filestream_info
logreader_add_compensation_range
logreader_add_eor
logreader_apply_filter_proc <\/p>\n<\/blockquote>\nThe first one was what I decided to investigate today was \u201crepl_event\u201d. It is described in sys.dm_xe_objects as \u201cOccurs when sp_repl_generateevent is called. this event is an internal repl event for tracing repl stored procedures. The data that is returned from user_event includes the event_id that was specified in the call to sp_repl_generateevent. This can be a value between x and y.\u201c :<\/p>\n
\nCREATE<\/span> EVENT SESSION<\/span> [repl_event] ON<\/span> SERVER \r\nADD<\/span> EVENT sqlserver.repl_event \r\nADD<\/span> TARGET package0.ring_buffer\r\nWITH<\/span> (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE<\/span>,TRACK_CAUSALITY=OFF<\/span>,STARTUP_STATE=ON<\/span>);\r\nGO<\/span><\/pre>\n<\/blockquote>\n