HADR_LOGCAPTURE_WAIT Wait Type in SQL Server

⏳Part of the SQL Server Wait Types Library, every wait type explained.Related deep dive: HADR_SYNC_COMMIT Wait TypeRelated pillar: High Availability

Is It a Problem?

No. Microsoft calls it an expected wait if the log scan is caught up to the end of log or is reading from disk, and Get Wait Statistics filters it out by default. It often sits near the top of raw wait lists on AG primaries for exactly that reason.


What It Means

It is waiting for log records to become available, either because the connections have not generated new log yet, or for I/O to complete when reading log that is not in the cache. In practice it is mostly the log capture on the primary being caught up.


When It Does Matter

It does not on its own. For AG lag, start with the send and redo queues:

SELECT
    ar.replica_server_name,
    DB_NAME(drs.database_id) AS database_name,
    drs.synchronization_state_desc,
    drs.log_send_queue_size,
    drs.log_send_rate,
    drs.redo_queue_size,
    drs.redo_rate
FROM sys.dm_hadr_database_replica_states AS drs
JOIN sys.availability_replicas AS ar ON ar.replica_id = drs.replica_id
ORDER BY drs.log_send_queue_size DESC;

The baseline to monitor is log_send_queue_size draining after bursts; the waits that cost time are HADR_SYNC_COMMIT and HADR_DATABASE_FLOW_CONTROL. The query needs VIEW SERVER STATE.


The HADR Commit and Flow Waits

These are the Availability Group waits on the path a commit takes from the primary to its secondaries: capturing log, sending it, waiting for it to harden, and the controls that throttle it. The main page is HADR_SYNC_COMMIT.

  • HADR_SYNC_COMMITSynchronous commit. The primary waiting for a synchronous secondary to harden the log.The main page for this family
  • HADR_DATABASE_FLOW_CONTROLFlow control. Sends paused because the queue of unacknowledged messages is full.Worth a look when it climbs
  • HADR_GROUP_COMMITGroup commit. Commits held briefly so several fit into one log block; expected.Worth a look when it climbs
  • HADR_LOGPROGRESS_SYNCLog progress. Concurrency control while updating each replica’s log progress.Worth a look when it climbs
  • HADR_LOGCAPTURE_WAITLog capture. Waiting for log records to become available; expected when caught up.Usually noise. This page.
  • PREEMPTIVE_HADR_LEASE_MECHANISMLease. The Availability Group lease manager scheduling.Worth investigating
  • HADR_SEEDING_LIMIT_BACKUPSAutomatic seeding. Recorded during automatic seeding; reported as long and benign.Worth a look when it climbs

Where To Go Next

HADR_LOGCAPTURE_WAIT is background noise on an Availability Group primary. If you are chasing a real problem, start with the waits that cost you time.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *