v4-0002-Test-case-to-test-streaming-with-concurrent-empty.patch
application/octet-stream
Filename: v4-0002-Test-case-to-test-streaming-with-concurrent-empty.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch v4-0002
Subject: Test case to test streaming with concurrent empty-xact
| File | + | − |
|---|---|---|
| contrib/test_decoding/expected/concurrent_stream_empty_txn.out | 19 | 0 |
| contrib/test_decoding/Makefile | 1 | 1 |
| contrib/test_decoding/specs/concurrent_stream_empty_txn.spec | 33 | 0 |
From c163dd25c51416e2911d7d92fa690e18b1374918 Mon Sep 17 00:00:00 2001
From: Dilip Kumar <dilipkumar@localhost.localdomain>
Date: Thu, 10 Sep 2020 15:48:35 +0530
Subject: [PATCH v4 2/2] Test case to test streaming with concurrent empty-xact
---
contrib/test_decoding/Makefile | 2 +-
.../expected/concurrent_stream_empty_txn.out | 19 +++++++++++++
.../specs/concurrent_stream_empty_txn.spec | 33 ++++++++++++++++++++++
3 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 contrib/test_decoding/expected/concurrent_stream_empty_txn.out
create mode 100644 contrib/test_decoding/specs/concurrent_stream_empty_txn.spec
diff --git a/contrib/test_decoding/Makefile b/contrib/test_decoding/Makefile
index ed9a3d6..f6b1bfb 100644
--- a/contrib/test_decoding/Makefile
+++ b/contrib/test_decoding/Makefile
@@ -7,7 +7,7 @@ REGRESS = ddl xact rewrite toast permissions decoding_in_xact \
decoding_into_rel binary prepared replorigin time messages \
spill slot truncate stream
ISOLATION = mxact delayed_startup ondisk_startup concurrent_ddl_dml \
- oldest_xmin snapshot_transfer subxact_without_top
+ oldest_xmin snapshot_transfer subxact_without_top concurrent_stream_empty_txn
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf
ISOLATION_OPTS = --temp-config $(top_srcdir)/contrib/test_decoding/logical.conf
diff --git a/contrib/test_decoding/expected/concurrent_stream_empty_txn.out b/contrib/test_decoding/expected/concurrent_stream_empty_txn.out
new file mode 100644
index 0000000..e731d13
--- /dev/null
+++ b/contrib/test_decoding/expected/concurrent_stream_empty_txn.out
@@ -0,0 +1,19 @@
+Parsed test spec with 2 sessions
+
+starting permutation: s0_begin s0_ddl s1_ddl s1_begin s1_toast_insert s1_commit s1_get_stream_changes
+step s0_begin: BEGIN;
+step s0_ddl: CREATE TABLE stream_test1(data text);
+step s1_ddl: CREATE TABLE stream_test(data text);
+step s1_begin: BEGIN;
+step s1_toast_insert: INSERT INTO stream_test SELECT large_val();
+step s1_commit: COMMIT;
+step s1_get_stream_changes: SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL,NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');
+data
+
+opening a streamed block for transaction
+streaming change for transaction
+closing a streamed block for transaction
+committing streamed transaction
+?column?
+
+stop
diff --git a/contrib/test_decoding/specs/concurrent_stream_empty_txn.spec b/contrib/test_decoding/specs/concurrent_stream_empty_txn.spec
new file mode 100644
index 0000000..0fcd742
--- /dev/null
+++ b/contrib/test_decoding/specs/concurrent_stream_empty_txn.spec
@@ -0,0 +1,33 @@
+# Test decoding of transaction with subtransaction. And concurrent empty transactions
+# with ddl operations.
+
+
+setup
+{
+ SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding');
+
+ -- consume DDL
+ SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
+ CREATE OR REPLACE FUNCTION large_val() RETURNS TEXT LANGUAGE SQL AS 'select array_agg(md5(g::text))::text from generate_series(1, 80000) g';
+}
+
+teardown
+{
+ DROP TABLE IF EXISTS stream_test;
+ DROP TABLE IF EXISTS stream_test1;
+ SELECT 'stop' FROM pg_drop_replication_slot('isolation_slot');
+}
+
+session "s0"
+setup { SET synchronous_commit=on; }
+step "s0_begin" { BEGIN; }
+step "s0_ddl" {CREATE TABLE stream_test1(data text);}
+
+session "s1"
+setup { SET synchronous_commit=on; }
+step "s1_ddl" { CREATE TABLE stream_test(data text); }
+step "s1_begin" { BEGIN; }
+step "s1_toast_insert" {INSERT INTO stream_test SELECT large_val();}
+step "s1_commit" { COMMIT; }
+step "s1_get_stream_changes" { SELECT data FROM pg_logical_slot_get_changes('isolation_slot', NULL,NULL, 'include-xids', '0', 'skip-empty-xacts', '1', 'stream-changes', '1');}
+permutation "s0_begin" "s0_ddl" "s1_ddl" "s1_begin" "s1_toast_insert" "s1_commit" "s1_get_stream_changes"
--
1.8.3.1