Skip to content

Commit 69afe5a

Browse files
committed
Merge branch 'master' into coveralls_support
2 parents 8e55a89 + 41e1e7a commit 69afe5a

Some content is hidden

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

68 files changed

+12863
-3331
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ regression.out
88
*.pyc
99
*.gcda
1010
*.gcno
11-
pg_pathman--1.1.sql
11+
pg_pathman--1.2.sql

LICENSE

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright (c) 2015-2016, Postgres Professional
2+
3+
Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
4+
5+
Portions Copyright (c) 1994, The Regents of the University of California
6+
7+
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.
8+
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.
10+
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.

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ MODULE_big = pg_pathman
44
OBJS = src/init.o src/relation_info.o src/utils.o src/partition_filter.o \
55
src/runtimeappend.o src/runtime_merge_append.o src/pg_pathman.o src/rangeset.o \
66
src/pl_funcs.o src/pl_range_funcs.o src/pl_hash_funcs.o src/pathman_workers.o \
7-
src/hooks.o src/nodes_common.o src/xact_handling.o src/copy_stmt_hooking.o \
8-
src/pg_compat.o $(WIN32RES)
7+
src/hooks.o src/nodes_common.o src/xact_handling.o src/utility_stmt_hooking.o \
8+
src/planner_tree_modification.o src/debug_print.o src/pg_compat.o \
9+
src/partition_creation.o $(WIN32RES)
910

1011
EXTENSION = pg_pathman
11-
EXTVERSION = 1.1
12+
EXTVERSION = 1.2
1213
DATA_built = pg_pathman--$(EXTVERSION).sql
13-
DATA = pg_pathman--1.0.sql pg_pathman--1.0--1.1.sql
14+
DATA = pg_pathman--1.0.sql \
15+
pg_pathman--1.0--1.1.sql \
16+
pg_pathman--1.1.sql \
17+
pg_pathman--1.1--1.2.sql
1418
PGFILEDESC = "pg_pathman - partitioning tool"
1519

1620
REGRESS = pathman_basic \
@@ -20,7 +24,7 @@ REGRESS = pathman_basic \
2024
pathman_foreign_keys \
2125
pathman_permissions \
2226
pathman_rowmarks \
23-
pathman_copy_stmt_hooking \
27+
pathman_utility_stmt_hooking \
2428
pathman_calamity
2529
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
2630
EXTRA_CLEAN = pg_pathman--$(EXTVERSION).sql ./isolation_output

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ Done! Now it's time to setup your partitioning schemes.
8484
create_hash_partitions(relation REGCLASS,
8585
attribute TEXT,
8686
partitions_count INTEGER,
87-
partition_name TEXT DEFAULT NULL,
8887
partition_data BOOLEAN DEFAULT TRUE)
8988
```
90-
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_part_init_callback()`).
89+
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()`).
9190

9291
```plpgsql
9392
create_range_partitions(relation REGCLASS,
@@ -148,6 +147,14 @@ create_range_update_trigger(parent REGCLASS)
148147
Same as above, but for a RANGE-partitioned table.
149148

150149
### Post-creation partition management
150+
```plpgsql
151+
replace_hash_partition(old_partition REGCLASS,
152+
new_partition REGCLASS,
153+
lock_parent BOOL DEFAULT TRUE)
154+
```
155+
Replaces specified partition of HASH-partitioned table with another table. The `lock_parent` parameter will prevent any INSERT/UPDATE/ALTER TABLE queries to parent table.
156+
157+
151158
```plpgsql
152159
split_range_partition(partition REGCLASS,
153160
split_value ANYELEMENT,
@@ -247,6 +254,11 @@ Set partition creation callback to be invoked for each attached or created parti
247254
}
248255
```
249256

257+
```plpgsql
258+
set_set_spawn_using_bgw(relation REGCLASS, value BOOLEAN)
259+
```
260+
When INSERTing new data beyond the partitioning range, use SpawnPartitionsWorker to create new partitions in a separate transaction.
261+
250262
## Views and tables
251263

252264
#### `pathman_config` --- main config storage
@@ -255,19 +267,18 @@ CREATE TABLE IF NOT EXISTS pathman_config (
255267
partrel REGCLASS NOT NULL PRIMARY KEY,
256268
attname TEXT NOT NULL,
257269
parttype INTEGER NOT NULL,
258-
range_interval TEXT,
259-
260-
CHECK (parttype IN (1, 2)) /* check for allowed part types */ );
270+
range_interval TEXT);
261271
```
262272
This table stores a list of partitioned tables.
263273

264274
#### `pathman_config_params` --- optional parameters
265275
```plpgsql
266276
CREATE TABLE IF NOT EXISTS pathman_config_params (
267-
partrel REGCLASS NOT NULL PRIMARY KEY,
268-
enable_parent BOOLEAN NOT NULL DEFAULT TRUE,
269-
auto BOOLEAN NOT NULL DEFAULT TRUE,
270-
init_callback REGPROCEDURE NOT NULL DEFAULT 0);
277+
partrel REGCLASS NOT NULL PRIMARY KEY,
278+
enable_parent BOOLEAN NOT NULL DEFAULT TRUE,
279+
auto BOOLEAN NOT NULL DEFAULT TRUE,
280+
init_callback REGPROCEDURE NOT NULL DEFAULT 0,
281+
spawn_using_bgw BOOLEAN NOT NULL DEFAULT FALSE);
271282
```
272283
This table stores optional parameters which override standard behavior.
273284

0 commit comments

Comments
 (0)