Skip to content

Commit 6dc804e

Browse files
committed
Merge branch 'develop'
2 parents 4887aa0 + 4f584c0 commit 6dc804e

6 files changed

Lines changed: 71 additions & 66 deletions

File tree

citus_dev/citus_dev

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,53 +21,57 @@ from docopt import docopt
2121
from subprocess import call
2222
from subprocess import Popen, PIPE
2323
import os
24+
import subprocess
2425
import sys
2526
import getpass
27+
import time
2628

2729

28-
def createNodeCommands(clustername, role, index=None, usessl=False, mx=False):
29-
cs = []
30+
def run(command, *args, **kwargs):
31+
print(command)
32+
result = subprocess.run(command, *args, check=True, shell=True, **kwargs)
33+
print()
34+
return result
35+
3036

37+
def createNodeCommands(clustername, role, index=None, usessl=False, mx=False):
3138
nodename = role
3239
if index != None:
3340
nodename += "%d" % index
3441

3542
dir = "%s/%s" % (clustername, nodename)
36-
cs.append("initdb -D %s" % dir)
37-
cs.append("echo \"shared_preload_libraries = 'citus'\" >> %s/postgresql.conf" % dir)
38-
cs.append('echo "wal_level = logical" >> %s/postgresql.conf' % dir)
43+
run("initdb -D %s" % dir)
44+
run("echo \"shared_preload_libraries = 'citus,pg_stat_statements'\" >> %s/postgresql.conf" % dir)
45+
run('echo "wal_level = logical" >> %s/postgresql.conf' % dir)
3946

4047
if usessl:
41-
cs.append('echo "ssl = on" >> %s/postgresql.conf' % dir)
42-
cs.append(
48+
run('echo "ssl = on" >> %s/postgresql.conf' % dir)
49+
run(
4350
"echo \"citus.node_conninfo = 'sslmode=require'\" >> %s/postgresql.conf"
4451
% dir
4552
)
46-
cs.append(
53+
run(
4754
"openssl req -new -x509 -days 365 -nodes -text -out %s/server.crt -keyout %s/server.key -subj '/CN=%s'"
4855
% (dir, dir, nodename)
4956
)
50-
cs.append("chmod 0600 %s/server.key" % dir)
57+
run("chmod 0600 %s/server.key" % dir)
5158

5259
if mx:
53-
cs.append(
60+
run(
5461
"echo \"citus.replication_model = 'streaming'\" >> %s/postgresql.conf" % dir
5562
)
5663

57-
return cs
58-
5964

6065
def main(arguments):
6166
print(arguments)
6267
if arguments["make"]:
63-
cs = []
6468
if arguments['--destroy']:
6569
name = arguments["<name>"]
6670
for role in getRoles(name):
67-
cs.append("pg_ctl stop -D %s/%s" % (name, role))
68-
cs.append('rm -rf %s' % (name))
71+
run("pg_ctl stop -D %s/%s || true" % (name, role))
72+
run('rm -rf %s' % (name))
6973

70-
cs += createNodeCommands(
74+
createNodeCommands(
7175
arguments["<name>"],
7276
"coordinator",
7377
usessl=arguments["--use-ssl"],
@@ -77,7 +81,7 @@ def main(arguments):
7781
size = int(arguments["--size"])
7882

7983
for i in range(size):
80-
cs += createNodeCommands(
84+
createNodeCommands(
8185
arguments["<name>"],
8286
"worker",
8387
i,
@@ -89,15 +93,17 @@ def main(arguments):
8993

9094
cport = port
9195
role = "coordinator"
92-
cs.append(
96+
run(
9397
'pg_ctl -D %s/%s -o "-p %d" -l %s_logfile start'
9498
% (arguments["<name>"], role, cport, role)
9599
)
96100
port += 1
97101

102+
worker_ports = []
98103
for i in range(size):
99104
role = "worker%d" % i
100-
cs.append(
105+
worker_ports.append(port)
106+
run(
101107
'pg_ctl start -D %s/%s -o "-p %d" -l %s_logfile'
102108
% (arguments["<name>"], role, port, role)
103109
)
@@ -106,93 +112,73 @@ def main(arguments):
106112

107113
if getpass.getuser() != 'postgres' and not os.getenv('PGDATABASE'):
108114
for i in range(size + 1):
109-
cs.append('createdb -p %d' % (port + i))
115+
run('createdb -p %d' % (port + i))
110116

111117
if not arguments["--no-extension"]:
112118
for i in range(size + 1):
113-
cs.append('psql -p %d -c "CREATE EXTENSION citus;"' % (port + i))
119+
run('psql -p %d -c "CREATE EXTENSION citus;"' % (port + i))
114120

115121
# If the cluster size is 0 we add the coordinator as the only node, otherwise we will add all other nodes
116122
if size == 0:
117-
cs.append(
123+
run(
118124
"psql -p %d -c \"SELECT * from master_add_node('localhost', %d);\""
119125
% (port, port)
120126
)
121127
else:
122128
for i in range(size):
123-
cs.append(
129+
run(
124130
"psql -p %d -c \"SELECT * from master_add_node('localhost', %d);\""
125131
% (port, port + 1 + i)
126132
)
127133
if arguments["--mx"]:
128-
cs.append(
134+
run(
129135
"psql -p %d -c \"SELECT start_metadata_sync_to_node('localhost', %d);\""
130136
% (port, port + 1 + i)
131137
)
132138

133-
cs.append(
139+
run(
134140
'psql -p %d -c "SELECT * from master_get_active_worker_nodes();"'
135141
% (port)
136142
)
137143
if arguments['--init-with']:
138-
cs.append('psql -p %d -f %s' % (cport, arguments['--init-with']))
139-
140-
for c in cs:
141-
print(c)
142-
os.system(c)
143-
print("")
144+
run('psql -p %d -f %s -v ON_ERROR_STOP=1' % (cport, arguments['--init-with']))
144145

145146
elif arguments["stop"]:
146-
cs = []
147147
name = arguments["<name>"]
148148
for role in getRoles(name):
149-
cs.append("pg_ctl stop -D %s/%s" % (name, role))
149+
run("pg_ctl stop -D %s/%s" % (name, role))
150150

151-
for c in cs:
152-
print(c)
153-
os.system(c)
154-
print("")
155151

156152
elif arguments["start"]:
157-
cs = []
158153
name = arguments["<name>"]
159154
port = int(arguments["--port"])
160155
cport = port
161156
for role in getRoles(name):
162-
cs.append(
157+
run(
163158
'pg_ctl start -D %s/%s -o "-p %d" -l %s_logfile'
164159
% (name, role, cport, role)
165160
)
166161
cport += 1
167162

168-
for c in cs:
169-
print(c)
170-
os.system(c)
171-
print("")
172163

173164
elif arguments["restart"]:
174-
cs = []
175165
name = arguments["<name>"]
176166
port = int(arguments["--port"])
177167
if arguments["--watch"]:
178-
cs.append(
168+
run(
179169
"fswatch -0 '%s' | xargs -0 -n 1 -I{} citus_dev restart %s --port=%d"
180170
% (citus_so(), name, port)
181171
)
182172

183173
else:
184174
cport = port
185175
for role in getRoles(name):
186-
cs.append(
176+
run(
187177
'pg_ctl restart -D %s/%s -o "-p %d" -l %s_logfile'
188178
% (name, role, cport, role)
189179
)
190180
cport += 1
191181

192-
for c in cs:
193-
print(c)
194-
os.system(c)
195-
print("")
196182

197183
else:
198184
print("unknown command")

dashboard/pkg.jq

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
def stripdebuginfo:
44
map(
55
select(
6-
.name |
7-
endswith("debuginfo") |
6+
(.name | endswith("debuginfo")) or
7+
(.name | endswith("dbgsym")) or
8+
(.name | startswith("citus-ha-")) or
9+
(.name | startswith("pg-auto-failover-cli")) |
810
not
911
)
1012
)
@@ -47,7 +49,7 @@ def pkgnameandpgversion(name):
4749
($parts[:-1] | join("_") | # name portion (before PG version)
4850
sub("\\d{2}$"; "") | # replace fancy version portion
4951
sub("^pg_cron$"; "pgcron")), # normalize pg_cron to pgcron
50-
$parts[-1][0:1] + "." + $parts[-1][1:2] # PG version portion
52+
$parts[-1][:2] | sub("^9"; "9.") # PG version portion
5153
]
5254
end
5355
;
@@ -58,11 +60,11 @@ def gittag(r):
5860
r.version | rtrimstr(".citus") as $version |
5961
if ($version | contains("~")) then
6062
$version | sub("~"; "-")
61-
elif (r.release | startswith("rc")) then # hack for bad deb version 1.0.0-rc.1
63+
elif (r.release // "" | startswith("rc")) then # hack for bad deb version 1.0.0-rc.1
6264
$version + "-" + r.release
63-
elif (r.release | contains("rc")) then
65+
elif (r.release // "" | contains("rc")) then
6466
$version + "-" +
65-
(r.release | split(".") | .[2] + "." + .[3])
67+
(r.release // "" | split(".") | .[2] + "." + .[3])
6668
else
6769
$version
6870
end
@@ -80,7 +82,8 @@ def makerow(r):
8082
(?<m>\\d{2}) # month
8183
(?<d>\\d{2})Z$ # day";
8284
"\(.y)-\(.m)-\(.d)"; "ix")),
83-
.value
85+
.value,
86+
"PackageCloud"
8487
] |
8588
flatten
8689
;
@@ -104,7 +107,8 @@ def makeclonerows(name):
104107
null,
105108
"HEAD",
106109
( .timestamp | split("T")[0]),
107-
.count
110+
.count,
111+
"GitHub"
108112
]
109113
;
110114

@@ -115,7 +119,8 @@ def filterbuilds(since):
115119
failed: null,
116120
errored: null,
117121
canceled: null})) and
118-
((.number | tonumber) > since)
122+
((.number | tonumber) > since) and
123+
.started_at
119124
)
120125
;
121126

@@ -142,7 +147,8 @@ def makegemrows(name):
142147
null,
143148
.number,
144149
$today,
145-
.downloads_count
150+
.downloads_count,
151+
"RubyGems"
146152
]
147153
)
148154
;
@@ -157,7 +163,8 @@ def makepullrow(name):
157163
null,
158164
"all",
159165
((now - 86400) | strftime("%Y-%m-%d")),
160-
.pull_count
166+
.pull_count,
167+
"Docker Hub"
161168
]
162169
;
163170

@@ -192,6 +199,7 @@ def makebrewrows(name):
192199
null,
193200
$version,
194201
brewdate(.[0]),
195-
.[1]])
202+
.[1],
203+
"Homebrew"])
196204
) | flatten(1)
197205
;

dashboard/schema.ddl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ CREATE TABLE download_stats
66
pg_version decimal,
77
version text NOT NULL,
88
"date" date NOT NULL,
9-
downloads integer NOT NULL
9+
downloads integer NOT NULL,
10+
source text
1011
);
1112
CREATE INDEX ON download_stats ("date");
1213

@@ -18,7 +19,8 @@ CREATE TABLE download_levels
1819
pg_version decimal,
1920
version text NOT NULL,
2021
"date" date NOT NULL,
21-
total_downloads integer NOT NULL
22+
total_downloads integer NOT NULL,
23+
source text
2224
);
2325
CREATE INDEX ON download_levels ("date");
2426

packaging/citus_package

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ foreach my $platform (@platforms) {
369369
"$filesubdir:/buildfiles:ro",
370370
'-e',
371371
"GITHUB_TOKEN",
372+
'-e',
373+
"PACKAGE_ENCRYPTION_KEY",
372374
"citus/packaging:$docker_platform-$pg",
373375
$build_type
374376
);

uncrustify/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Getting Started
66

7-
`citus_indent` requires `uncrustify` v0.60 or greater.
7+
`citus_indent` requires `uncrustify` v0.68 or greater.
88

99
`make install` to install the script, the Citus style configuration file, and a man page. `man citus_indent` for more details.
1010

uncrustify/citus_indent

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ my @files_to_format = ();
2929
my @formatter_args = qw(-c /usr/local/etc/citustools/citus-style.cfg);
3030

3131
push @formatter_args, '-q' if $quiet;
32-
push @formatter_args, ($check ? '--check' : '--no-backup');
32+
if ($check)
33+
{
34+
push @formatter_args, '--check';
35+
}
36+
else
37+
{
38+
push @formatter_args, '--no-backup', '--replace';
39+
}
3340

3441
while(my ($filename, $attrname, $attrvalue) = splice(@flattened_triples, 0, 3)) {
3542
next unless $attrvalue eq 'set';

0 commit comments

Comments
 (0)