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

Commit 079ddab

Browse files
committed
Some formatting.
1 parent f394590 commit 079ddab

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pg_shardman--1.0.sql

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,12 @@ CREATE FUNCTION get_node_partitions_count(node int) returns bigint AS $$
702702
SELECT count(*) from shardman.partitions WHERE node_id=node;
703703
$$ LANGUAGE sql;
704704

705-
-- Rebalance partitions between nodes. This function tries to evenly redistribute partition between all nodes of replication groups.
705+
-- Rebalance partitions between nodes. This function tries to evenly
706+
-- redistribute partitions of tables which names match LIKE 'pattern'
707+
-- between all nodes of replication groups.
706708
-- It is not able to move partition between replication groups.
707-
-- This function intentionally move one partition per time to minimize influence on system performance.
709+
-- This function intentionally moves one partition per time to minimize
710+
-- influence on system performance.
708711
CREATE FUNCTION rebalance(table_pattern text = '%') RETURNS void AS $$
709712
DECLARE
710713
dst_node int;
@@ -726,7 +729,7 @@ BEGIN
726729
FOR repl_group IN SELECT DISTINCT replication_group FROM shardman.nodes
727730
LOOP
728731
-- Select node in this group with minimal number of partitions
729-
SELECT node_id, count(*) n_parts INTO dst_node,min_count
732+
SELECT node_id, count(*) n_parts INTO dst_node, min_count
730733
FROM shardman.partitions p JOIN shardman.nodes n ON p.node_id=n.id
731734
WHERE n.replication_group=repl_group AND p.relation LIKE table_pattern
732735
GROUP BY node_id
@@ -737,7 +740,8 @@ BEGIN
737740
WHERE n.replication_group=repl_group AND p.relation LIKE table_pattern
738741
GROUP BY node_id
739742
ORDER BY n_parts DESC LIMIT 1;
740-
-- If difference of number of partitions on this nodes is greater than 1, then move random partition
743+
-- If difference of number of partitions on this nodes is greater
744+
-- than 1, then move random partition
741745
IF max_count - min_count > 1 THEN
742746
SELECT p.part_name INTO mv_part_name
743747
FROM shardman.partitions p
@@ -897,7 +901,7 @@ BEGIN
897901

898902
RAISE DEBUG 'Replication lag %', lag;
899903
IF locked THEN
900-
IF lag<=0 THEN
904+
IF lag <= 0 THEN
901905
RETURN;
902906
END IF;
903907
ELSIF lag < caughtup_threshold THEN

0 commit comments

Comments
 (0)