use strict; use DBI; { my $dbh1 = DBI->connect('dbi:mysql:'); $dbh1->do("CREATE DATABASE IF NOT EXISTS test"); $dbh1->do("USE test"); $dbh1->do("CREATE TABLE IF NOT EXISTS t1_eng1 (f1 integer not null auto_increment, blob1 mediumblob, primary key (f1)) ENGINE = Falcon;"); $dbh1->do("CREATE TABLE IF NOT EXISTS t2_eng2 (f2 integer not null auto_increment, blob2 mediumblob, primary key (f2)) ENGINE = Falcon;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v1_eng1 (f1,blob1) AS SELECT * FROM t1_eng1;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v2_eng2 (f2,blob2) AS SELECT * FROM t2_eng2;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v12 (f1, blob1, f2, blob2) AS SELECT * FROM t1_eng1 LEFT JOIN t2_eng2 ON (f1 = f2) ORDER BY f2 DESC;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v21 (f1, blob1, f2, blob2) AS SELECT * FROM t2_eng2 LEFT JOIN t1_eng1 ON (f2 = f1) ORDER BY f1 DESC;"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Merge VIEW v1221 (f1, blob1, f2, blob2) AS SELECT v12.f1, v12.blob1, v21.f2, v21.blob2 FROM v12 LEFT JOIN v21 ON (v12.f1 = v21.f2);"); $dbh1->do("CREATE OR REPLACE ALGORITHM = Temptable VIEW v2112 (f2, blob2, f1, blob1) AS SELECT v21.f2, v21.blob2, v12.f1, v12.blob1 FROM v21, v12;"); $dbh1->disconnect(); } fork(); fork(); use strict; use DBI; my $dbh2 = DBI->connect('dbi:mysql:'); foreach my $i (1..1000) { $dbh2->do("USE test"); $dbh2->do("INSERT IGNORE INTO t1_eng1 (f1, blob1) VALUES (1, REPEAT ('A', 32)), (2, REPEAT('B', 32)), (3, REPEAT('C', 32));"); $dbh2->do("INSERT IGNORE INTO t1_eng1 (f1, blob1) VALUES (4, REPEAT ('A', 32)), (5, REPEAT('B', 32)), (6, REPEAT('C', 32));"); $dbh2->do("INSERT IGNORE INTO t1_eng1 (f1, blob1) VALUES (7, REPEAT ('A', 32)), (8, REPEAT('B', 32)), (9, REPEAT('C', 32));"); $dbh2->do("INSERT IGNORE INTO t2_eng2 (f2, blob2) VALUES (1, REPEAT ('X', 32)), (2, REPEAT('Y', 32)), (3, REPEAT('Z', 32));"); $dbh2->do("UPDATE v1221 SET f2 = (SELECT MAX(f2) FROM v2112) + 20 ORDER BY f2 DESC LIMIT 1;"); $dbh2->do("UPDATE v21 AS a LEFT JOIN v12 AS b ON (a.f1 = b.f1) SET a.f1 = a.f1 + 20, b.blob1 = REPEAT('A', a.f1 + 20);"); }