43. Locking
Transaktion 1 Transaktion 2
Begin Begin
Update t where id=10 ... Update t where id=10 ...
...
Commit Wartet auf Tx1
43
44. Optimistic Locking
Transaktion 1 Transaktion 2
Begin
Begin
Update t where id=10 ...
Update t where id=10 ...
...
...
Commit
Commit
Fehler wegen
Row Conflict
44
45. Das schwächste Glied in der Kette
bestimmt die Schreibperformance
Bild: Duff Axsom / Flickr 45
46. Das schwächste Glied in der Kette
Write in Write in
Confirm out Confirm out
write Write out
Confirms in
all confirmed
46
66. CREATE TABLE customer (id INT NOT NULL,
PRIMARY KEY (id));
CREATE TABLE phone (id INT NOT NULL,
customer_id INT NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (customer_id)
REFERENCES customer(id)
);
66
68. delete from customer where id=5;
Cannot delete or update a parent row:
a foreign key constraint fails
68
69. WTF?
[ERROR] Slave SQL: Could not execute Delete_rows event on
table somedb.some_table; Can't find record in 'some_table',
Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;
[ERROR] WSREP: Failed to apply trx: source:
1337a766-b992-11e1-0800-185c16a204a2 version: 2 local: 0 state:
CERTIFYING flags: 1 conn_id: 52899913 trx_id: 3397040790
[ERROR] WSREP: Failed to apply app buffer: ...
[ERROR] WSREP: Node consistency compromized, aborting...
69
70. delete from customer where id=5;
Cannot delete or update a parent row:
a foreign key constraint fails
Aborting
70
71. delete from customer where id=5;
Cannot delete or update a parent row:
a foreign key constraint fails
Aborting
Aborting
71
72. delete from customer where id=5;
Cannot delete or update a parent row:
a foreign key constraint fails
Aborting
Aborting Aborting
72
73. delete from customer where id=5;
Cannot delete or update a parent row:
a foreign key constraint fails
?
? Aborting
?
? Aborting Aborting
73
74. delete from customer where id=5;
Cannot delete or update a parent row:
a foreign key constraint fails
Aborting
Disconnected
Aborting Aborting
74
75. Ich will‘s selber testen
http://www.mysqlperformanceblog.com
z.B. http://www.mysqlperformanceblog.com/2012/06/20/percona-xtradb-cluster-reference-architecture-with-haproxy/
75
78. Noch gute Fragen?
http://joind.in/7339
Florian Pfeiffer
Engineer gutefrage.net GmbH
Ein Unternehmen der
Tel +49 89 5151 46-122 Verlagsgruppe Georg von Holtzbrinck
Fax +49 89 5151 46-214 Sonnenstrasse 14
Mail florian.pfeiffer@gutefrage.net 80331 München
Hinweis der Redaktion
\n
\n
\n
\n
\n
\n
Chef / Varnish / ...\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Zeitspanne nach Commit, in dem die Nodes die Daten zwar bestätigt, aber noch nicht auf Platte geschrieben haben\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
haproxy als tutorial\n\n
\n
Keepalive\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
warum haben wir gewechselt... MMM Master Drop database... Umzug ein master/RZ\nperformanter\n\n