Skip to content

Commit cf0d3d8

Browse files
committed
Merge branch 'PGPROEE9_6_MULTIMASTER' of https://gitlab.postgrespro.ru/pgpro-dev/postgrespro into PGPROEE9_6_MULTIMASTER
2 parents 445df4d + 731f8ea commit cf0d3d8

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

contrib/mmts/doc/configuration.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# `Configuration parameters`
2+
3+
```multimaster.node_id``` Multimaster node ID, unique number identifying this node. Nodes should be numbered by natural numbers starting from 1 without gaps (e.g. 1, 2, 3, ...). node_id is also used as an offset in ```multimaster.conn_strings```, thus i-th node's connection string expected to be on i-th position in ```multimaster.conn_strings```. Mandatory.
4+
5+
```multimaster.conn_strings``` Multimaster node connection strings separated by commas, i.e. 'dbname=mydb host=node1, dbname=mydb host=node2, dbname=mydb host=node3'. Order here is important and should be consistent with ```multimaster.node_id```. Multimaster allows to specify custom arbiter_port value for all connection strings. Also this parameter is expected to be identical on all nodes. Mandatory.
6+
7+
```multimaster.arbiter_port``` Port for arbiter process to listen on. Default to 5433.
8+
9+
```multimaster.heartbeat_send_timeout``` Period of broadcasting heartbeat messages by arbiter to all nodes. In milliseconds. Default to 1000.
10+
11+
```multimaster.heartbeat_recv_timeout``` If no heartbeat message is received from node within this period, it assumed to be dead. In milliseconds. Default to 10000.
12+
13+
```multimaster.min_recovery_lag``` Minimal lag of WAL-sender performing recovery after which cluster is locked until recovery is completed. When wal-sender almost catch-up WAL current position we need to stop 'Achilles tortile competition' and temporary stop commit of new transactions until node will be completely repared. In bytes. Default to 100000.
14+
15+
```multimaster.max_recovery_lag``` Maximal lag of replication slot of failed node after which this slot is dropped to avoid transaction log overflow. Dropping slot makes it not possible to recover node using logical replication mechanism, it will be necessary to completely copy content of some alive node using pg_basebackup or similar tool. Zero value of parameter disable slot dropping. In bytes. Default to 100000000.
16+
17+
```multimaster.ignore_tables_without_pk``` Do not replicate tables withpout primary key. Boolean.
18+
19+
20+
## Questionable
21+
22+
(probably we will delete that variables, most of them are useful only for development purposes --stas)
23+
24+
```multimaster.cluster_name``` Name of the cluster, desn't affect anything. Just in case.
25+
26+
```multimaster.min_2pc_timeout``` Minimal timeout between receiving PREPARED message from nodes participated in transaction to coordinator (milliseconds). Default = 2000, /* 2 seconds */.
27+
28+
```multimaster.max_2pc_ratio``` Maximal ratio (in percents) between prepare time at different nodes: if T is time of preparing transaction at some node, then transaction can be aborted if prepared responce was not received in T*MtmMax2PCRatio/100. default = 200, /* 2 times */
29+
30+
```multimaster.queue_size``` Multimaster queue size. default = 256*1024*1024,
31+
32+
```multimaster.vacuum_delay``` Minimal age of records which can be vacuumed (seconds). default = 1.
33+
34+
```multimaster.worker``` Number of multimaster executor workers. Default = 8. (use dynamic workers with some timeout to die?)
35+
36+
```multimaster.max_worker``` Maximal number of multimaster dynamic executor workers. (set this to max_conn?) Default = 100.
37+
38+
```multimaster.gc_period``` Number of distributed transactions after which garbage collection is started. Multimaster is building xid->csn hash map which has to be cleaned to avoid hash overflow. This parameter specifies interval of invoking garbage collector for this map. default = MTM_HASH_SIZE/10
39+
40+
```multimaster.max_node``` Maximal number of cluster nodes. This parameters allows to add new nodes to the cluster, default value 0 restricts number of nodes to one specified in multimaster.conn_strings (May be just set that to 64 and allow user to add node when trey need without restart?) default = 0
41+
42+
```multimaster.trans_spill_threshold``` Maximal size (Mb) of transaction after which transaction is written to the disk. Default = 1000, /* 1Gb */ (istm reorderbuffer also can do that, isn't it?)
43+
44+
```multimaster.node_disable_delay``` Minimal amount of time (msec) between node status change. This delay is used to avoid false detection of node failure and to prevent blinking of node status node. default = 2000. (We can just increase heartbeat_recv_timeout)
45+
46+
```multimaster.connect_timeout``` Multimaster nodes connect timeout. Interval in milliseconds for establishing connection with cluster node. default = 10000, /* 10 seconds */
47+
48+
```multimaster.reconnect_timeout``` Multimaster nodes reconnect timeout. Interval in milliseconds for establishing connection with cluster node. default = 5000, /* 5 seconds */
49+
50+
```multimaster.use_dtm``` Use distributed transaction manager.
51+
52+
```multimaster.preserve_commit_order``` Transactions from one node will be committed in same order al all nodes.
53+
54+
```multimaster.volkswagen_mode``` Pretend to be normal postgres. This means skip some NOTICE's and use local sequences. Default false.
55+
56+
57+
58+
59+

contrib/mmts/doc/functions.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# `Built-in functions and views`
2+
3+
## Cluster information functions
4+
5+
* `mtm.get_nodes_state()` — show status of nodes in cluster. Returns tuple of following values:
6+
* id, integer
7+
* disabled, bool
8+
* disconnected, bool
9+
* catchUp, bool
10+
* slotLag, bigint
11+
* avgTransDelay, bigint
12+
* lastStatusChange, timestamp
13+
* oldestSnapshot, bigint
14+
* SenderPid integer
15+
* SenderStartTime timestamp
16+
* ReceiverPid integer
17+
* ReceiverStartTime timestamp
18+
* connStr text
19+
* connectivityMask bigint
20+
21+
* `mtm.get_cluster_state()` -- show whole cluster status
22+
* status, text
23+
* disabledNodeMask, bigint
24+
* disconnectedNodeMask, bigint
25+
* catchUpNodeMask, bigint
26+
* liveNodes, integer
27+
* allNodes, integer
28+
* nActiveQueries, integer
29+
* nPendingQueries, integer
30+
* queueSize, bigint
31+
* transCount, bigint
32+
* timeShift, bigint
33+
* recoverySlot, integer
34+
* xidHashSize, bigint
35+
* gidHashSize, bigint
36+
* oldestXid, bigint
37+
* configChanges, integer
38+
39+
40+
## Node management functions
41+
42+
* `mtm.add_node(conn_str text)` -- add node to the cluster.
43+
* `mtm.drop_node(node integer, drop_slot bool default false)` -- exclude node from the cluster.
44+
* `mtm.poll_node(nodeId integer, noWait boolean default FALSE)` -- wait for node to become online.
45+
* `mtm.recover_node(node integer)` -- create replication slot for the node which was previously dropped together with it's slot.
46+
47+
## Data management functions
48+
49+
* `mtm.make_table_local(relation regclass)` -- stop replication for a given table
50+
51+
## Debug functions
52+
53+
* `mtm.get_cluster_info()` -- print some debug info
54+
* `mtm.inject_2pc_error`
55+
* `mtm.check_deadlock`
56+
* `mtm.start_replication`
57+
* `mtm.stop_replication`
58+
* `mtm.get_snapshot`
59+
* `mtm.get_csn`
60+
* `mtm.get_trans_by_gid`
61+
* `mtm.get_trans_by_xid`
62+
* `mtm.get_last_csn`
63+
* `mtm.dump_lock_graph`

0 commit comments

Comments
 (0)