Friday, March 9, 2012

EXACT sequence of events in sync mirroring

Hi
I need to know exactly the sequence of events in synchronous mirroring mode.
What im reading is this:
1. tranaction recved from a client by primary
2. primary writes trans to trans log
3. log written to dbase ie to disk from log on primary and concurrently
sends log to mirror.
4. Primary waits for response from mirror
5. Mirror writes log to disk
6. mirror returns acknowledgement to primary.
7. primary sends conf to client.
I need to know what happens if the mirror DOES NOT SEND THE ACK.
Q1. Does the primary roll the dabse back?
Q2. if so, the data goes back into the trans log awaiting response from
mirror and subsequent commitall on primary, correct?
Q2. Whats the timeout period for an ack from the mirror?
Question 1 is the most important. ive bought bloody standard verion with its
sync mirroring as oppoed to the laughably expensive Ent edition with its ASYN
nmirroring and im wondering if I can get away with it...
Thanks
Alastair
Methodology
This is the sequence
1) transaction received from a client by the primary
2) pages dirtied
3) transaction written to log buffer
4) transaction written to log buffer on mirror
5) transaction committed
6) log hardened to disk (written to transaction log) (5 and 6 can be
interchanged depending on the length of a transaction).
7) at checkpoint all dirty pages written to disk
referring to:
http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirror.mspx
in all SQL Server databases, data changes are recorded in the transaction
log before any changes to actual data pages are made. The transaction log
records are placed first in a database's log buffer in memory, and then
flushed to disk (or 'hardened') as quickly as possible. In database
mirroring, as the principal server writes the principal database's log
buffer to disk, it simultaneously sends that block of log records to the
mirror instance.
Answers to your questions I assume in this statement " Does the primary roll
the dabse back?" you mean "Does the primary roll the transaction back?"
1) The transaction is rolled back on the primary at the application level.
2) it may appear in the tlog, depending on whether it is hardened or not.
The commit or rollback will be in the transaction log so on recovery the
disk will be consistent.
3) the timeout is controlled by the app - it typically be default is 20 s.
Most apps using database mirroring or a HA technology will have retry logic
built in to minimize any data loss. The failover time once initiated it
typically less than 10 s. It may take some time for the witness to detect
that the principal or mirror is offline - this can be 10-20 seconds.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Methodology" <Methodology@.discussions.microsoft.com> wrote in message
news:FAAB3E4A-3F0B-4788-9DF9-3B66651A928A@.microsoft.com...
> Hi
> I need to know exactly the sequence of events in synchronous mirroring
> mode.
> What im reading is this:
> 1. tranaction recved from a client by primary
> 2. primary writes trans to trans log
> 3. log written to dbase ie to disk from log on primary and concurrently
> sends log to mirror.
> 4. Primary waits for response from mirror
> 5. Mirror writes log to disk
> 6. mirror returns acknowledgement to primary.
> 7. primary sends conf to client.
> I need to know what happens if the mirror DOES NOT SEND THE ACK.
> Q1. Does the primary roll the dabse back?
> Q2. if so, the data goes back into the trans log awaiting response from
> mirror and subsequent commitall on primary, correct?
> Q2. Whats the timeout period for an ack from the mirror?
> Question 1 is the most important. ive bought bloody standard verion with
> its
> sync mirroring as oppoed to the laughably expensive Ent edition with its
> ASYN
> nmirroring and im wondering if I can get away with it...
> Thanks
> Alastair
> Methodology

No comments:

Post a Comment