Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b484c2

Browse files
committed
Remove queries from calamity test which depend on num of entries in relcache.
Autovacuum blows out relcache, so it rarely fails if it is agressive enough.
1 parent c25ba92 commit 6b484c2

File tree

4 files changed

+99
-90
lines changed

4 files changed

+99
-90
lines changed

expected/pathman_calamity.out

+27-27
Original file line numberDiff line numberDiff line change
@@ -816,25 +816,25 @@ SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10
816816
10
817817
(1 row)
818818

819-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
819+
SELECT context, entries FROM pathman_cache_stats
820+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
820821
context | entries
821822
-------------------------+---------
822823
maintenance | 0
823824
partition bounds cache | 0
824825
partition parents cache | 0
825-
partition status cache | 2
826-
(4 rows)
826+
(3 rows)
827827

828828
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
829829
NOTICE: drop cascades to 11 other objects
830-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
830+
SELECT context, entries FROM pathman_cache_stats
831+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
831832
context | entries
832833
-------------------------+---------
833834
maintenance | 0
834835
partition bounds cache | 0
835836
partition parents cache | 0
836-
partition status cache | 2
837-
(4 rows)
837+
(3 rows)
838838

839839
/* Change this setting for code coverage */
840840
SET pg_pathman.enable_bounds_cache = false;
@@ -862,25 +862,25 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
862862
-> Seq Scan on test_pathman_cache_stats_10
863863
(11 rows)
864864

865-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
865+
SELECT context, entries FROM pathman_cache_stats
866+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
866867
context | entries
867868
-------------------------+---------
868869
maintenance | 0
869870
partition bounds cache | 0
870871
partition parents cache | 10
871-
partition status cache | 3
872-
(4 rows)
872+
(3 rows)
873873

874874
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
875875
NOTICE: drop cascades to 11 other objects
876-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
876+
SELECT context, entries FROM pathman_cache_stats
877+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
877878
context | entries
878879
-------------------------+---------
879880
maintenance | 0
880881
partition bounds cache | 0
881882
partition parents cache | 0
882-
partition status cache | 2
883-
(4 rows)
883+
(3 rows)
884884

885885
/* Restore this GUC */
886886
SET pg_pathman.enable_bounds_cache = true;
@@ -908,25 +908,25 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
908908
-> Seq Scan on test_pathman_cache_stats_10
909909
(11 rows)
910910

911-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
911+
SELECT context, entries FROM pathman_cache_stats
912+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
912913
context | entries
913914
-------------------------+---------
914915
maintenance | 0
915916
partition bounds cache | 10
916917
partition parents cache | 10
917-
partition status cache | 3
918-
(4 rows)
918+
(3 rows)
919919

920920
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
921921
NOTICE: drop cascades to 11 other objects
922-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
922+
SELECT context, entries FROM pathman_cache_stats
923+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
923924
context | entries
924925
-------------------------+---------
925926
maintenance | 0
926927
partition bounds cache | 0
927928
partition parents cache | 0
928-
partition status cache | 2
929-
(4 rows)
929+
(3 rows)
930930

931931
/* check that parents cache has been flushed after partition was dropped */
932932
CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
@@ -952,40 +952,40 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
952952
-> Seq Scan on test_pathman_cache_stats_10
953953
(11 rows)
954954

955-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
955+
SELECT context, entries FROM pathman_cache_stats
956+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
956957
context | entries
957958
-------------------------+---------
958959
maintenance | 0
959960
partition bounds cache | 10
960961
partition parents cache | 10
961-
partition status cache | 3
962-
(4 rows)
962+
(3 rows)
963963

964964
SELECT drop_range_partition('calamity.test_pathman_cache_stats_1');
965965
drop_range_partition
966966
-------------------------------------
967967
calamity.test_pathman_cache_stats_1
968968
(1 row)
969969

970-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
970+
SELECT context, entries FROM pathman_cache_stats
971+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
971972
context | entries
972973
-------------------------+---------
973974
maintenance | 0
974975
partition bounds cache | 9
975976
partition parents cache | 9
976-
partition status cache | 2
977-
(4 rows)
977+
(3 rows)
978978

979979
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
980980
NOTICE: drop cascades to 10 other objects
981-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
981+
SELECT context, entries FROM pathman_cache_stats
982+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
982983
context | entries
983984
-------------------------+---------
984985
maintenance | 0
985986
partition bounds cache | 0
986987
partition parents cache | 0
987-
partition status cache | 2
988-
(4 rows)
988+
(3 rows)
989989

990990
DROP SCHEMA calamity CASCADE;
991991
DROP EXTENSION pg_pathman;

expected/pathman_calamity_1.out

+27-27
Original file line numberDiff line numberDiff line change
@@ -816,25 +816,25 @@ SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10
816816
10
817817
(1 row)
818818

819-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
819+
SELECT context, entries FROM pathman_cache_stats
820+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
820821
context | entries
821822
-------------------------+---------
822823
maintenance | 0
823824
partition bounds cache | 0
824825
partition parents cache | 0
825-
partition status cache | 2
826-
(4 rows)
826+
(3 rows)
827827

828828
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
829829
NOTICE: drop cascades to 11 other objects
830-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
830+
SELECT context, entries FROM pathman_cache_stats
831+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
831832
context | entries
832833
-------------------------+---------
833834
maintenance | 0
834835
partition bounds cache | 0
835836
partition parents cache | 0
836-
partition status cache | 2
837-
(4 rows)
837+
(3 rows)
838838

839839
/* Change this setting for code coverage */
840840
SET pg_pathman.enable_bounds_cache = false;
@@ -862,25 +862,25 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
862862
-> Seq Scan on test_pathman_cache_stats_10
863863
(11 rows)
864864

865-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
865+
SELECT context, entries FROM pathman_cache_stats
866+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
866867
context | entries
867868
-------------------------+---------
868869
maintenance | 0
869870
partition bounds cache | 0
870871
partition parents cache | 10
871-
partition status cache | 3
872-
(4 rows)
872+
(3 rows)
873873

874874
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
875875
NOTICE: drop cascades to 11 other objects
876-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
876+
SELECT context, entries FROM pathman_cache_stats
877+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
877878
context | entries
878879
-------------------------+---------
879880
maintenance | 0
880881
partition bounds cache | 0
881882
partition parents cache | 0
882-
partition status cache | 2
883-
(4 rows)
883+
(3 rows)
884884

885885
/* Restore this GUC */
886886
SET pg_pathman.enable_bounds_cache = true;
@@ -908,25 +908,25 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
908908
-> Seq Scan on test_pathman_cache_stats_10
909909
(11 rows)
910910

911-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
911+
SELECT context, entries FROM pathman_cache_stats
912+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
912913
context | entries
913914
-------------------------+---------
914915
maintenance | 0
915916
partition bounds cache | 10
916917
partition parents cache | 10
917-
partition status cache | 3
918-
(4 rows)
918+
(3 rows)
919919

920920
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
921921
NOTICE: drop cascades to 11 other objects
922-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
922+
SELECT context, entries FROM pathman_cache_stats
923+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
923924
context | entries
924925
-------------------------+---------
925926
maintenance | 0
926927
partition bounds cache | 0
927928
partition parents cache | 0
928-
partition status cache | 2
929-
(4 rows)
929+
(3 rows)
930930

931931
/* check that parents cache has been flushed after partition was dropped */
932932
CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
@@ -952,40 +952,40 @@ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
952952
-> Seq Scan on test_pathman_cache_stats_10
953953
(11 rows)
954954

955-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
955+
SELECT context, entries FROM pathman_cache_stats
956+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
956957
context | entries
957958
-------------------------+---------
958959
maintenance | 0
959960
partition bounds cache | 10
960961
partition parents cache | 10
961-
partition status cache | 3
962-
(4 rows)
962+
(3 rows)
963963

964964
SELECT drop_range_partition('calamity.test_pathman_cache_stats_1');
965965
drop_range_partition
966966
-------------------------------------
967967
calamity.test_pathman_cache_stats_1
968968
(1 row)
969969

970-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
970+
SELECT context, entries FROM pathman_cache_stats
971+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
971972
context | entries
972973
-------------------------+---------
973974
maintenance | 0
974975
partition bounds cache | 9
975976
partition parents cache | 9
976-
partition status cache | 2
977-
(4 rows)
977+
(3 rows)
978978

979979
DROP TABLE calamity.test_pathman_cache_stats CASCADE;
980980
NOTICE: drop cascades to 10 other objects
981-
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
981+
SELECT context, entries FROM pathman_cache_stats
982+
WHERE context != 'partition status cache' ORDER BY context; /* OK */
982983
context | entries
983984
-------------------------+---------
984985
maintenance | 0
985986
partition bounds cache | 0
986987
partition parents cache | 0
987-
partition status cache | 2
988-
(4 rows)
988+
(3 rows)
989989

990990
DROP SCHEMA calamity CASCADE;
991991
DROP EXTENSION pg_pathman;

0 commit comments

Comments
 (0)