RAIB: Unterschied zwischen den Versionen

Aus OrgaMon Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: Redundant Array of Independent tant Databases)
 
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
Redundant Array of Independent tant Databases
redundant array of independent databases
 
== 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.
 
== Heart-Beat-Ticker ==
 
A Database has a counter (the Heart-Beat-Ticker = HBT) that is incremented after each statement commit doing something 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.

Version vom 23. Mai 2007, 11:57 Uhr

redundant array of independent databases

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.

Heart-Beat-Ticker

A Database has a counter (the Heart-Beat-Ticker = HBT) that is incremented after each statement commit doing something 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

  1. the master do not accept W Statements any more. (Try again in 2 Minutes!)
  2. the master ensures that one spare is ready to take over (master.HTB=spare.HTB)
  3. the master switch to "spare" Mode
  4. 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.