Thursday, July 7, 2011

Protecting My App From Synchronous Database Mirroring - A Step Too Far?

The application I am writing at the moment does massive amounts of inserts, and it was never designed to be used with synchronous database mirroring. A DBA recently set up synchronous mirroring instead of asynchronous, and everything ground to a halt.

So now when this windows service starts up it checks what is going on back there in mirroring land:

declare @MirrorLevel int
      @MirrorLevel = isnull(mirroring_safety_level,0)
from sys.database_mirroring
where database_id = db_id()

select case @MirrorLevel
    when 0 then 'None'
    when 1 then 'Asynchronous'
    when 2 then 'Synchronous'
end as [MirroringConfiguration]

A step too far? Should my application be validating it’s infrastructure and throwing it’s toys if it doesn’t like it? Not sure what the correct answer is, but it was fun to implement anyway…

No comments: