public inbox for [email protected]help / color / mirror / Atom feed
[GSOC][weekly report 4] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions 24+ messages / 3 participants [nested] [flat]
* [GSOC][weekly report 4] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions @ 2017-06-29 03:36 Mengxing Liu <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Mengxing Liu @ 2017-06-29 03:36 UTC (permalink / raw) To: kgrittn <[email protected]>; Alvaro Herrera <[email protected]>; +Cc: pgsql-hackers In the last week: I added a tpcb benchmark and refactored the test code. It likes a framework now. We can add other benchmarks easily if necessary. https://github.com/liumx10/pg-bench Analyzed the code acquiring SerializableFinishedListLock and provided a new proposal to improve it. My proposal is as below. As I reported in previous emails, lots of backend were blocked by SerializableFinishedListLock in heavy contention. There are only three functions acquiring this lock: SummarizeOldestCommittedSxact: After transforming the conflict information into SLRU format, we need to release this SerailizableXact object. The lock protects the release operation and removing it from the finished list. ReleasePredicateLocks: After releasing the predicate locks of the current transaction, if the transaction is rolled back, we need to release the SerializableXact object; if the transaction is committed, we should insert it to the finished list. The lock protects the release operation or insert operation. ClearOldPredicateLocks: Look through the finished transaction list to find if any transaction object can be released. Thus the lock protects looking through the list, releasing transaction objects, and removing objects from the list. As we can see, the lock protects two things: 1) the finished transaction list 2) releasing serializable transaction objects. Using a single global lock to protect all will cause a lot of contentions. So I decoupled the lock's duty into two parts: protecting the finished transaction list and protecting releasing a single serializable transaction objects. The SerializableFinishedListLock is reserved to protect the finished transaction list. Thus the function SummarizeOldestCommittedSxact and ReleasePredicateLocks are not changed. For function ClearOldPredicateLocks, I scan the list and pick up the transactions which could be released first, but not release these objects directly. After releasing the SerializableFinishedListLock, invoking ReleaseOneSerializableXact to release them. At first, I want to use a partition lock or spinlock in each SerailizableXact object to protect ReleaseOneSerializableXact. But I found it is not necessary to add new locks. in ReleaseOneSerializableXact, firstly, it released all predicate locks, which is protected by SerializablePredicateLockListLock; Then, it released all conflicts, which is protected by SerializableXactHashLock. So I didn't change the function ReleaseOneSerializableXact. I have implemented this idea. But unfortunately, it didn't improve the performance or reduce the contention on SerializableFinishedListLock. I'll try to find out why in the next days. But I'm really looking forward to your advice for my proposal. We can't be too careful to modify the code related to locks. -- Sincerely Mengxing Liu ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: Re: Give me more details of some bits in infomask!! @ 2023-02-26 15:44 David G. Johnston <[email protected]> 0 siblings, 0 replies; 24+ messages in thread From: David G. Johnston @ 2023-02-26 15:44 UTC (permalink / raw) To: [email protected] <[email protected]>; +Cc: Tomas Vondra <[email protected]>; pgsql-hackers <[email protected]> On Sun, Feb 26, 2023 at 8:36 AM [email protected] <[email protected]> wrote: > > CID means "command ID" i.e. sequential ID assigned to commands in a > > single session (for visibility checks, so that a query doesn't see data > > deleted by earlier commands in the same session). See > > src/backend/utils/time/combocid.c for basic explanation of what "combo > > CID" is. > I think if cid is used for visibility checks in one session, that's > meaingless, beacause we can use the t_xmin and t_xmax to > get this goal. Is tis > > I think the word "session" is wrong. It should be "transaction". IIUC, it is what is changed when one issues CommandCounterIncrement within a transaction. And you need somewhere to save which CCI step deletes rows, in particular due to the savepoint feature. David J. ^ permalink raw reply [nested|flat] 24+ messages in thread
end of thread, other threads:[~2023-02-26 15:44 UTC | newest] Thread overview: 24+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2017-06-29 03:36 [GSOC][weekly report 4] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions Mengxing Liu <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2023-02-26 15:44 Re: Re: Give me more details of some bits in infomask!! David G. Johnston <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox