bdr: test cases for cluster-internal drop replication and common conflicts
authorChristian Kruse <cjk@defunct.ch>
Wed, 14 May 2014 08:08:16 +0000 (10:08 +0200)
committerAndres Freund <andres@anarazel.de>
Thu, 3 Jul 2014 15:55:35 +0000 (17:55 +0200)
common_conflicts.spec: Generate the common conflicts
cluster-internal-drop.spec: Test case failing for a DROP bug in
cluster-internal replication

src/test/isolation/specs/bdr/cluster-internal-drop.spec [new file with mode: 0644]
src/test/isolation/specs/bdr/common_conflicts.spec [new file with mode: 0644]

diff --git a/src/test/isolation/specs/bdr/cluster-internal-drop.spec b/src/test/isolation/specs/bdr/cluster-internal-drop.spec
new file mode 100644 (file)
index 0000000..9540dd9
--- /dev/null
@@ -0,0 +1,14 @@
+conninfo "d1" "port=5433 dbname=test_db"
+
+session "sess1"
+connection "d1"
+step "s1_create_table" { CREATE TABLE test(pk int primary key, col1 text); }
+step "s1_create_index" { CREATE INDEX test_idx ON test(pk, col1); }
+
+step "s1_drop_index" { DROP INDEX test_idx; }
+step "s1_drop_col" { ALTER TABLE test DROP COLUMN col1; }
+step "s1_drop_table" { DROP TABLE test; }
+
+permutation "s1_create_table" "s1_drop_table"
+permutation "s1_create_table" "s1_create_index" "s1_drop_index" "s1_drop_table"
+permutation "s1_create_table" "s1_create_index" "s1_drop_index" "s1_drop_col" "s1_drop_table"
diff --git a/src/test/isolation/specs/bdr/common_conflicts.spec b/src/test/isolation/specs/bdr/common_conflicts.spec
new file mode 100644 (file)
index 0000000..8101517
--- /dev/null
@@ -0,0 +1,40 @@
+conninfo "d1" "port=5433 dbname=postgres"
+conninfo "d2" "port=5434 dbname=postgres"
+
+session "sess1"
+connection "conn1"
+setup { DROP TABLE IF EXISTS t1; CREATE TABLE t1(pk integer primary key, col1 text); }
+
+step "s1_insert_pk1" { INSERT INTO t1 (pk, col1) VALUES (1, 'test'); }
+step "s1_insert_pk2" { INSERT INTO t1 (pk, col1) VALUES (2, 'testval'); }
+step "s1_update" { UPDATE t1 SET col1 = 'test1' WHERE pk = 1; }
+step "s1_update_to_pk2" { UPDATE t1 SET pk = 2 WHERE pk = 1; }
+step "s1_delete" { DELETE FROM t1 WHERE pk = 1; }
+
+step "s1_sleep7" { SELECT pg_sleep(7); }
+step "s1_wait_repl" { SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location()::text, pid) FROM pg_stat_replication; }
+
+session "sess2"
+connection "conn2"
+
+step "s2_insert_pk1" { INSERT INTO t1 (pk, col1) VALUES (1, 'testval'); }
+step "s2_insert_pk2" { INSERT INTO t1 (pk, col1) VALUES (2, 'testval'); }
+step "s2_update" { UPDATE t1 SET col1 = 'test2' WHERE pk = 1; }
+step "s2_update_to_pk2" { UPDATE t1 SET pk = 2 WHERE pk = 1; }
+step "s2_delete" { DELETE FROM t1 WHERE pk = 1; }
+
+# INSERT vs INSERT
+permutation "s1_wait_repl" "s2_insert_pk1" "s1_insert_pk1" "s1_sleep7"
+
+# UPDATE vs UPDATE
+permutation "s1_wait_repl" "s1_insert_pk1" "s1_wait_repl" "s2_update" "s1_update" "s1_sleep7"
+
+# UPDATE vs DELETE
+# TODO crashing
+permutation "s1_wait_repl" "s1_insert_pk1" "s1_wait_repl" "s2_delete" "s1_update" "s1_sleep7"
+permutation "s1_wait_repl" "s1_insert_pk1" "s1_wait_repl" "s2_update" "s1_delete" "s1_sleep7"
+
+# INSERT vs UPDATE
+# TODO Crashing
+permutation "s1_wait_repl" "s1_insert_pk1" "s1_wait_repl" "s2_insert_pk2" "s1_update_to_pk2" "s1_sleep7"
+permutation "s1_wait_repl" "s1_insert_pk1" "s1_wait_repl" "s2_update_to_pk2" "s1_insert_pk2" "s1_sleep7"