Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4792314

Browse files
committed
Merge branch 'rel_future_beta' into rel_future_ri
2 parents 0554fb7 + 1dc3612 commit 4792314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+7213
-2868
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ regression.out
1010
*.gcno
1111
*.gcov
1212
pg_pathman--*.sql
13+
tags
14+
cscope*

LICENSE

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Copyright (c) 2015-2016, Postgres Professional
2-
3-
Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
1+
pg_pathman is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
42

3+
Copyright (c) 2015-2017, Postgres Professional
4+
Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
55
Portions Copyright (c) 1994, The Regents of the University of California
66

77
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
88

9-
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9+
IN NO EVENT SHALL POSTGRES PROFESSIONAL BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF POSTGRES PROFESSIONAL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1010

11-
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
11+
POSTGRES PROFESSIONAL SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND POSTGRES PROFESSIONAL HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

META.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "pg_pathman",
3+
"abstract": "Partitioning tool",
4+
"description": "The `pg_pathman` module provides optimized partitioning mechanism and functions to manage partitions.",
5+
"version": "1.3.1",
6+
"maintainer": [
7+
"Ildar Musin <i.musin@postgrespro.ru>",
8+
"Dmitry Ivanov <d.ivanov@postgrespro.ru>",
9+
"Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>"
10+
],
11+
"license": "postgresql",
12+
"resources": {
13+
"bugtracker": {
14+
"web": "https://github.com/postgrespro/pg_pathman/issues"
15+
},
16+
"repository": {
17+
"url": "git://github.com:postgrespro/pg_pathman.git",
18+
"web": "https://github.com/postgrespro/pg_pathman",
19+
"type": "git"
20+
}
21+
},
22+
"generated_by": "Ildar Musin",
23+
"provides": {
24+
"pg_pathman": {
25+
"file": "pg_pathman--1.3.sql",
26+
"docfile": "README.md",
27+
"version": "1.3.1",
28+
"abstract": "Partitioning tool"
29+
}
30+
},
31+
"meta-spec": {
32+
"version": "1.0.0",
33+
"url": "http://pgxn.org/meta/spec.txt"
34+
},
35+
"tags": [
36+
"partitioning",
37+
"partition",
38+
"optimization"
39+
]
40+
}

Makefile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,38 @@ PG_CPPFLAGS = -I$(CURDIR)/src/include
1414

1515
EXTENSION = pg_pathman
1616

17-
EXTVERSION = 1.3
17+
EXTVERSION = 1.4
1818

1919
DATA_built = pg_pathman--$(EXTVERSION).sql
2020

2121
DATA = pg_pathman--1.0--1.1.sql \
2222
pg_pathman--1.1--1.2.sql \
2323
pg_pathman--1.2--1.3.sql
2424

25-
PGFILEDESC = "pg_pathman - partitioning tool"
25+
PGFILEDESC = "pg_pathman - partitioning tool for PostgreSQL"
2626

2727
REGRESS = pathman_basic \
28-
pathman_only \
29-
pathman_cte \
3028
pathman_bgw \
31-
pathman_inserts \
32-
pathman_updates \
33-
pathman_domains \
34-
pathman_interval \
29+
pathman_calamity \
3530
pathman_callbacks \
31+
pathman_column_type \
32+
pathman_cte \
33+
pathman_domains \
3634
pathman_foreign_keys \
35+
pathman_inserts \
36+
pathman_interval \
37+
pathman_join_clause \
38+
pathman_lateral \
39+
pathman_only \
3740
pathman_permissions \
3841
pathman_rowmarks \
3942
pathman_runtime_nodes \
43+
pathman_update_trigger \
44+
pathman_updates \
4045
pathman_utility_stmt \
4146
pathman_calamity \
42-
pathman_ri
47+
pathman_ri \
48+
pathman_expressions
4349

4450
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
4551

@@ -70,3 +76,5 @@ isolationcheck: | submake-isolation
7076
--temp-config=$(top_srcdir)/$(subdir)/conf.add \
7177
--outputdir=./isolation_output \
7278
$(ISOLATIONCHECKS)
79+
partitioning_tests:
80+
$(MAKE) -C tests/python partitioning_tests

README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![Build Status](https://travis-ci.org/postgrespro/pg_pathman.svg?branch=master)](https://travis-ci.org/postgrespro/pg_pathman)
22
[![PGXN version](https://badge.fury.io/pg/pg_pathman.svg)](https://badge.fury.io/pg/pg_pathman)
33
[![codecov](https://codecov.io/gh/postgrespro/pg_pathman/branch/master/graph/badge.svg)](https://codecov.io/gh/postgrespro/pg_pathman)
4+
[![GitHub license](https://img.shields.io/badge/license-PostgreSQL-blue.svg)](https://raw.githubusercontent.com/postgrespro/pg_pathman/master/LICENSE)
45

56
# pg_pathman
67

@@ -67,7 +68,7 @@ Modify the **`shared_preload_libraries`** parameter in `postgresql.conf` as foll
6768
```
6869
shared_preload_libraries = 'pg_pathman'
6970
```
70-
> **Important:** `pg_pathman` may have conflicts with some other extensions which uses the same hook functions. For example, `pg_pathman` uses `ProcessUtility_hook` hook to handle COPY queries for partitioned tables. And it could sometimes interfere with `pg_stat_statements` extension which uses the same hook. In this case try to list libraries in certain order: `shared_preload_libraries = 'pg_pathman, pg_stat_statements'`
71+
> **Important:** `pg_pathman` may cause conflicts with some other extensions that use the same hook functions. For example, `pg_pathman` uses `ProcessUtility_hook` to handle COPY queries for partitioned tables, which means it may interfere with `pg_stat_statements` from time to time. In this case, try listing libraries in certain order: `shared_preload_libraries = 'pg_stat_statements, pg_pathman'`.
7172
7273
It is essential to restart the PostgreSQL instance. After that, execute the following query in psql:
7374
```plpgsql
@@ -99,8 +100,8 @@ create_hash_partitions(relation REGCLASS,
99100
attribute TEXT,
100101
partitions_count INTEGER,
101102
partition_data BOOLEAN DEFAULT TRUE,
102-
partition_names TEXT[] DEFAULT NULL,
103-
tablespaces TEXT[] DEFAULT NULL)
103+
partition_names TEXT[] DEFAULT NULL,
104+
tablespaces TEXT[] DEFAULT NULL)
104105
```
105106
Performs HASH partitioning for `relation` by integer key `attribute`. The `partitions_count` parameter specifies the number of partitions to create; it cannot be changed afterwards. If `partition_data` is `true` then all the data will be automatically copied from the parent table to partitions. Note that data migration may took a while to finish and the table will be locked until transaction commits. See `partition_table_concurrently()` for a lock-free way to migrate data. Partition creation callback is invoked for each partition if set beforehand (see `set_init_callback()`).
106107

@@ -266,21 +267,21 @@ Set partition creation callback to be invoked for each attached or created parti
266267
```json
267268
/* RANGE-partitioned table abc (child abc_4) */
268269
{
269-
"parent": "abc",
270-
"parent_schema": "public",
271-
"parttype": "2",
272-
"partition": "abc_4",
270+
"parent": "abc",
271+
"parent_schema": "public",
272+
"parttype": "2",
273+
"partition": "abc_4",
273274
"partition_schema": "public",
274-
"range_max": "401",
275-
"range_min": "301"
275+
"range_max": "401",
276+
"range_min": "301"
276277
}
277278

278279
/* HASH-partitioned table abc (child abc_0) */
279280
{
280-
"parent": "abc",
281-
"parent_schema": "public",
282-
"parttype": "1",
283-
"partition": "abc_0"
281+
"parent": "abc",
282+
"parent_schema": "public",
283+
"parttype": "1",
284+
"partition": "abc_0",
284285
"partition_schema": "public"
285286
}
286287
```
@@ -317,7 +318,7 @@ CREATE TABLE IF NOT EXISTS pathman_config_params (
317318
enable_parent BOOLEAN NOT NULL DEFAULT TRUE,
318319
auto BOOLEAN NOT NULL DEFAULT TRUE,
319320
init_callback REGPROCEDURE NOT NULL DEFAULT 0,
320-
spawn_using_bgw BOOLEAN NOT NULL DEFAULT FALSE);
321+
spawn_using_bgw BOOLEAN NOT NULL DEFAULT FALSE);
321322
```
322323
This table stores optional parameters which override standard behavior.
323324

@@ -664,6 +665,7 @@ There are several user-accessible [GUC](https://www.postgresql.org/docs/9.5/stat
664665
- `pg_pathman.enable_runtimemergeappend` --- toggle `RuntimeMergeAppend` custom node on\off
665666
- `pg_pathman.enable_partitionfilter` --- toggle `PartitionFilter` custom node on\off
666667
- `pg_pathman.enable_auto_partition` --- toggle automatic partition creation on\off (per session)
668+
- `pg_pathman.enable_bounds_cache` --- toggle bounds cache on\off (faster updates of partitioning scheme)
667669
- `pg_pathman.insert_into_fdw` --- allow INSERTs into various FDWs `(disabled | postgres | any_fdw)`
668670
- `pg_pathman.override_copy` --- toggle COPY statement hooking on\off
669671

@@ -673,11 +675,12 @@ SELECT disable_pathman_for('range_rel');
673675
```
674676
All sections and data will remain unchanged and will be handled by the standard PostgreSQL inheritance mechanism.
675677

676-
##Feedback
678+
## Feedback
677679
Do not hesitate to post your issues, questions and new ideas at the [issues](https://github.com/postgrespro/pg_pathman/issues) page.
678680

679681
## Authors
680-
Ildar Musin <i.musin@postgrespro.ru> Postgres Professional Ltd., Russia
681-
Alexander Korotkov <a.korotkov@postgrespro.ru> Postgres Professional Ltd., Russia
682-
Dmitry Ivanov <d.ivanov@postgrespro.ru> Postgres Professional Ltd., Russia
683-
682+
Ildar Musin <i.musin(at)postgrespro.ru> Postgres Professional Ltd., Russia
683+
Alexander Korotkov <a.korotkov(at)postgrespro.ru> Postgres Professional Ltd., Russia
684+
Dmitry Ivanov <d.ivanov(at)postgrespro.ru> Postgres Professional Ltd., Russia
685+
Maksim Milyutin <m.milyutin(at)postgrespro.ru> Postgres Professional Ltd., Russia
686+
Ildus Kurbangaliev <i.kurbangaliev(at)postgrespro.ru> Postgres Professional Ltd., Russia

expected/insert_nodes.out

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,123 @@
11
Parsed test spec with 2 sessions
22

33
starting permutation: s1b s1_insert_150 s1r s1_show_partitions s2b s2_insert_150 s2c s2_show_partitions
4-
create_range_partitions
4+
set_spawn_using_bgw
55

6-
1
6+
77
step s1b: BEGIN;
8-
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
8+
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
99
step s1r: ROLLBACK;
10-
step s1_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
10+
step s1_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
11+
ON c.conrelid = i.inhrelid
12+
WHERE i.inhparent = 'range_rel'::regclass
13+
ORDER BY c.oid;
1114
consrc
1215

16+
1317
((id >= 1) AND (id < 101))
18+
1419
((id >= 101) AND (id < 201))
1520
step s2b: BEGIN;
16-
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
21+
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
1722
step s2c: COMMIT;
18-
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
23+
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
24+
ON c.conrelid = i.inhrelid
25+
WHERE i.inhparent = 'range_rel'::regclass
26+
ORDER BY c.oid;
1927
consrc
2028

29+
2130
((id >= 1) AND (id < 101))
31+
2232
((id >= 101) AND (id < 201))
2333

2434
starting permutation: s1b s1_insert_150 s1r s1_show_partitions s2b s2_insert_300 s2c s2_show_partitions
25-
create_range_partitions
35+
set_spawn_using_bgw
2636

27-
1
37+
2838
step s1b: BEGIN;
29-
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
39+
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
3040
step s1r: ROLLBACK;
31-
step s1_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
41+
step s1_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
42+
ON c.conrelid = i.inhrelid
43+
WHERE i.inhparent = 'range_rel'::regclass
44+
ORDER BY c.oid;
3245
consrc
3346

47+
3448
((id >= 1) AND (id < 101))
49+
3550
((id >= 101) AND (id < 201))
3651
step s2b: BEGIN;
3752
step s2_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
3853
step s2c: COMMIT;
39-
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
54+
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
55+
ON c.conrelid = i.inhrelid
56+
WHERE i.inhparent = 'range_rel'::regclass
57+
ORDER BY c.oid;
4058
consrc
4159

60+
4261
((id >= 1) AND (id < 101))
62+
4363
((id >= 101) AND (id < 201))
64+
4465
((id >= 201) AND (id < 301))
4566

4667
starting permutation: s1b s1_insert_300 s1r s1_show_partitions s2b s2_insert_150 s2c s2_show_partitions
47-
create_range_partitions
68+
set_spawn_using_bgw
4869

49-
1
70+
5071
step s1b: BEGIN;
5172
step s1_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
5273
step s1r: ROLLBACK;
53-
step s1_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
74+
step s1_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
75+
ON c.conrelid = i.inhrelid
76+
WHERE i.inhparent = 'range_rel'::regclass
77+
ORDER BY c.oid;
5478
consrc
5579

80+
5681
((id >= 1) AND (id < 101))
82+
5783
((id >= 101) AND (id < 201))
84+
5885
((id >= 201) AND (id < 301))
5986
step s2b: BEGIN;
60-
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
87+
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
6188
step s2c: COMMIT;
62-
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
89+
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
90+
ON c.conrelid = i.inhrelid
91+
WHERE i.inhparent = 'range_rel'::regclass
92+
ORDER BY c.oid;
6393
consrc
6494

95+
6596
((id >= 1) AND (id < 101))
97+
6698
((id >= 101) AND (id < 201))
99+
67100
((id >= 201) AND (id < 301))
68101

69102
starting permutation: s1b s1_insert_150 s2b s2_insert_300 s1r s2r s2_show_partitions
70-
create_range_partitions
103+
set_spawn_using_bgw
71104

72-
1
105+
73106
step s1b: BEGIN;
74-
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
107+
step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
75108
step s2b: BEGIN;
76109
step s2_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
77110
step s1r: ROLLBACK;
78111
step s2r: ROLLBACK;
79-
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c ON c.conrelid = i.inhrelid AND c.consrc IS NOT NULL WHERE i.inhparent = 'range_rel'::regclass::oid ORDER BY c.oid;
112+
step s2_show_partitions: SELECT c.consrc FROM pg_inherits i LEFT JOIN pg_constraint c
113+
ON c.conrelid = i.inhrelid
114+
WHERE i.inhparent = 'range_rel'::regclass
115+
ORDER BY c.oid;
80116
consrc
81117

118+
82119
((id >= 1) AND (id < 101))
120+
83121
((id >= 101) AND (id < 201))
122+
84123
((id >= 201) AND (id < 301))

0 commit comments

Comments
 (0)