今天發現線上資料庫主從延遲嚴重: 從庫大量日誌沒有做,當時就想到可能是從庫有事物沒有執行完畢,查看了一下未結束的事物和鎖信息,發現並不是這個原因,查看錯誤日誌: 消息Timeout occurred while waiting for latch: class 'COLUMNSTORE_ROWGRO ...
今天發現線上資料庫主從延遲嚴重:
SELECT ag.name AS ag_name, ar.replica_server_name AS ag_replica_server, dr_state.database_id as database_id, dr_state.redo_queue_size, is_ag_replica_local = CASE WHEN ar_state.is_local = 1 THEN N'LOCAL' ELSE 'REMOTE' END , ag_replica_role = CASE WHEN ar_state.role_desc IS NULL THEN N'DISCONNECTED' ELSE ar_state.role_desc END FROM (( sys.availability_groups AS ag JOIN sys.availability_replicas AS ar ON ag.group_id = ar.group_id ) JOIN sys.dm_hadr_availability_replica_states AS ar_state ON ar.replica_id = ar_state.replica_id) JOIN sys.dm_hadr_database_replica_states dr_state on ag.group_id = dr_state.group_id and dr_state.replica_id = ar_state.replica_id;
從庫大量日誌沒有做,當時就想到可能是從庫有事物沒有執行完畢,查看了一下未結束的事物和鎖信息,發現並不是這個原因,查看錯誤日誌:
消息
Timeout occurred while waiting for latch: class 'COLUMNSTORE_ROWGROUP_COLLECTION', id 00000030F72767A0, type 4, Task 0x00000030FF058CA8 : 0, waittime 44400 seconds, flags 0x1a, owning task 0x00000030FF058CA8. Continuing to wait.
我擦,這不是上次碰到的問題嗎,假定您啟用 Microsoft SQL Server 2014年的 AlwaysOn 可用性組功能。在 rowgroups 轉換為壓縮的狀態將導致在主站點上聚集 Columnstore 索引 (CCI) 為插入數據時,在輔助站點上的重做線程可能會遇到閂鎖超時錯誤。COLUMNSTORE_ROWGROUP_COLLECTION內部鎖爭用,這裡說明下,這是SQL Server2014 12.0.2000的一個BUG,列存儲鎖爭用,我們需要升級補丁或者重啟資料庫才能夠解決,我是碰到兩次了,最終解決辦法就是給從庫打了一個補丁,完美解決。