[mb-devel] Database replication?
Steve Wyles
steve at inhouse.co.uk
Sat Jul 22 03:12:11 UTC 2006
On Sat, 22 Jul 2006, Elliot Chance wrote:
> Ahhh thats makes sense. Few more questions
>
> 1. So in the Pending, the first id matches with the data in PendingData, but
> does that id have any bearing on the table?
Taking Pending first
Rowid
tablename the changes are for
type (u,d,i)
Transaction sequence
Now PendingData
rowid
boolean IsKey
packed data in key/value pairs (the code in dbmirror.pm deals with this)
>
> 2. What is the second id in Pending for?
>
The transaction sequence. For any changes to the data on the main server a
begin transaction, process changes, commit transaction procedure is
followed. The transaction number is incremented each time a new
transaction is started. Within a transaction there can be any number of
related DB changes. If one change fails, the whole transaction up to that
point is reversed.
An overview of the replication packet processing is:
download and untar the next replication packet
check the replication sequence and database schema version
load the Pending and PendingData files into the Pending and PendingData
db tables
process through the data by transaction id taking each record within the
transaction.
Delete all records for that transaction from Pending/PendingData (this is
so if replication fails, it can restart from the point it left off)
get next transaction and associated records
when no more tranactions are left, see if another replication packet is
available. If not, exit
> 3. In PendingData, what does the 't' and 'f' represent?
>
true and false whether it refers to a db key, it is used to order the
select of the records from PendingData
Steve
More information about the MusicBrainz-devel
mailing list