RAIB: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
<h1> | <h1> | ||
<b><u>R</u></b>edundant <b><u>A</u></b>rray of <b><u>I</u></b>ndependent data<b><u>B</u></b>ases | |||
</h1> | </h1><br> | ||
on my way implementing this with the famous firebird sql server 2.0+ | |||
== Concepts == | == Concepts == | ||
Version vom 23. Mai 2007, 11:06 Uhr
Redundant Array of Independent dataBases
on my way implementing this with the famous firebird sql server 2.0+
Concepts
The goal of RAIB is to increase the availability of a firebird database. This is done by fail-over servers that are in (delayed) sync with the master server. If the master fails, a spare can be used to do further transactions. This is NOT done by Replication-Technologies, but by Statement-Log-Packets for each "Write" Operation to the Database.
Heart-Beat-Ticker
A Database has a internal GENERATOR (the Heart-Beat-Ticker = HBT) that is incremented after each statement commit doing some change to data or metadata. A read-Only Statement should not incrememt the HBT.
Cluster Table
inside the database is the information about the spares and the master.
IP Role last-HBT 192.168.115.192 master 192.168.115.196 spare 192.168.115.80 spare 30.23.12.3 spare
planned switiching the role from master to spare
- the master do not accept W Statements any more. (Try again in 2 Minutes!)
- the master ensures that one spare is ready to take over (master.HTB=spare.HTB)
- the master switch to "spare" Mode
- the spare switch to "master" Mode
Database in master mode
Database in spare mode
- the LOG-Receive Thread
the master initiates communication to a spare and post LOG Packets to the spare. Alle Packets are flushed into memory - if CRC is ok, the spare sends a ACK to the master. The master do NOT wait until the spare executes the statement because the master already prooved that the statement is executable.
- the Worker-Thread
read the LOG-Packets, and execute it against the own Database.
- LOG-missed
if the spare was offline a time, she sees that local.HBT <> LOG.HBT+1. Before it can execute actual LOG-Packets she MUST ask the master (or other spares) for the missing LOG Packets. After doing the old stuff it can start to do execute the actual receiced LOG-Packtes. While this time, the log-Receive thread isnt stopping filling the LOG-Buffer.
New Database "Shutdown" Modes
work normal but refuse "W" Statement with a special error message. They may redirekted to a master.
Statement LOG
the master database server must log all the information wich was needed to do a change to the database. This information is transmitted to one or more spares. This information is also stored in the Database itself for a time. At least until its prooven that a n.fabk is available. After the Log-DataBlock must succsessfully
1 - Do the Statement, detect while doing it, if it is harmfull to the Database (W oder R) 2 - if W: compile a log-block with the name GEN_ID(HBT,1);
if R: break
3 - Send the LOG over the line.
Client: DROP TABLE CLUB$2873
Server: W,928372
Client: SELECT CURRENT_TIMESTAMP from RDB$DATABASE Server: R
Content of a LOG-Packet
- the Statement
- the Server context: used 'NOW'- and 'RND'- Values.
- the HBT-Tick after the statement is executed.
detecting the failure
==
Positive Side Effekts
if a client assumes that a special statement is read only AND HBT of a spare is the HBT of the master she can post this statement to a spare to take load away from the master.
and the Statement is Read-Only it can be used as a
Communication master<->spare
if a spare comes up (on connection request of a master), a spare can ask the master how
Good to have several spares
it enough fore the master to have one responding spare. If a connection to a spare fails it it retried every 20 Seconds.