summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-01-27 16:35:21 +0100
committerLinus Nordberg <linus@nordu.net>2017-01-30 09:54:08 +0100
commit2e54755b9afacdb2d001b7ad4a81a8a23b6f43e0 (patch)
treeb258faa94aaf6115dda8dc5117c443b2d5e8d6df /tools
parent6df4a9012f03af16779ae4172831367881b4090b (diff)
Parallelised merge, distribution phase.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/compileconfig.py59
-rwxr-xr-xtools/merge2
-rwxr-xr-xtools/merge_fetch.py2
-rwxr-xr-xtools/testcase1.py5
4 files changed, 46 insertions, 22 deletions
diff --git a/tools/compileconfig.py b/tools/compileconfig.py
index f8d1d39..d6f9271 100755
--- a/tools/compileconfig.py
+++ b/tools/compileconfig.py
@@ -132,24 +132,24 @@ def gen_http_servers(nodetype, nodeconfig, bind_addresses, bind_publicaddress, b
return (http_servers,
https_servers)
-def allowed_clients_frontend(mergenodenames, primarymergenode):
+def allowed_clients_frontend(mergenodenames, primarymergenodename):
return [
("/plop/v1/frontend/sendentry", mergenodenames),
("/plop/v1/frontend/sendlog", mergenodenames),
- ("/plop/v1/frontend/publish-sth", [primarymergenode]),
- ("/plop/v1/frontend/verify-entries", [primarymergenode]),
+ ("/plop/v1/frontend/publish-sth", [primarymergenodename]),
+ ("/plop/v1/frontend/verify-entries", [primarymergenodename]),
("/plop/v1/frontend/currentposition", mergenodenames),
("/plop/v1/frontend/missingentries", mergenodenames),
]
-def allowed_clients_mergesecondary(primarymergenode):
+def allowed_clients_mergesecondary(primarymergenodename):
return [
- ("/plop/v1/merge/sendentry", [primarymergenode]),
- ("/plop/v1/merge/sendlog", [primarymergenode]),
- ("/plop/v1/merge/verifyroot", [primarymergenode]),
- ("/plop/v1/merge/verifiedsize", [primarymergenode]),
- ("/plop/v1/merge/setverifiedsize", [primarymergenode]),
- ("/plop/v1/merge/missingentries", [primarymergenode]),
+ ("/plop/v1/merge/sendentry", [primarymergenodename]),
+ ("/plop/v1/merge/sendlog", [primarymergenodename]),
+ ("/plop/v1/merge/verifyroot", [primarymergenodename]),
+ ("/plop/v1/merge/verifiedsize", [primarymergenodename]),
+ ("/plop/v1/merge/setverifiedsize", [primarymergenodename]),
+ ("/plop/v1/merge/missingentries", [primarymergenodename]),
]
def allowed_clients_public():
@@ -165,10 +165,10 @@ def allowed_clients_public():
("/ct/v1/get-roots", noauth),
]
-def allowed_clients_signing(frontendnodenames, primarymergenode):
+def allowed_clients_signing(frontendnodenames, primarymergenodename):
return [
("/plop/v1/signing/sct", frontendnodenames),
- ("/plop/v1/signing/sth", [primarymergenode]),
+ ("/plop/v1/signing/sth", [primarymergenodename]),
]
def allowed_clients_storage(frontendnodenames, mergenodenames):
@@ -186,6 +186,14 @@ def allowed_servers_frontend(signingnodenames, storagenodenames):
("/plop/v1/signing/sct", signingnodenames),
]
+def allowed_servers_primarymerge(frontendnodenames):
+ return [
+ ("/plop/v1/frontend/verify-entries", frontendnodenames),
+ ("/plop/v1/frontend/sendlog", frontendnodenames),
+ ("/plop/v1/frontend/sendentry", frontendnodenames),
+ ("/plop/v1/frontend/publish-sth", frontendnodenames),
+ ]
+
def parse_ratelimit_expression(expression):
if expression == "none":
return Symbol("none")
@@ -241,8 +249,6 @@ def gen_config(nodename, config, localconfig):
(Symbol("http_servers"), http_servers),
(Symbol("https_certfile"), paths["https_certfile"]),
(Symbol("https_keyfile"), paths["https_keyfile"]),
- (Symbol("https_cacertfile"), paths["https_cacertfile"]),
- (Symbol("https_cacert_fingerprint"), Binary(base64.b16decode(config["cafingerprint"]))),
]
catlfishconfig.append((Symbol("mmd"), config["mmd"]))
@@ -256,6 +262,11 @@ def gen_config(nodename, config, localconfig):
])
]
+ plopconfig += [
+ (Symbol("https_cacertfile"), paths["https_cacertfile"]),
+ (Symbol("https_cacert_fingerprint"), Binary(base64.b16decode(config["cafingerprint"]))),
+ ]
+
if "dbbackend" in localconfig:
dbbackend = localconfig["dbbackend"]
if dbbackend not in ("fsdb", "permdb"):
@@ -268,7 +279,7 @@ def gen_config(nodename, config, localconfig):
print >>sys.stderr, "When using permdb, all services have to be in the same node"
sys.exit(1)
- print "nodetype", ", ".join(nodetype)
+ #print "nodetype", ", ".join(nodetype)
if nodetype & set(["frontendnodes", "storagenodes"]):
plopconfig += [
(Symbol("entry_root_path"), paths["db"] + "certentries"),
@@ -306,6 +317,7 @@ def gen_config(nodename, config, localconfig):
primarymergenodename = config["primarymergenode"]
storagenodeaddresses = ["https://%s/plop/v1/storage/" % node["address"] for node in config["storagenodes"]]
frontendnodenames = [node["name"] for node in config["frontendnodes"]]
+ frontendnodeaddresses = ["https://%s/plop/v1/frontend/" % node["address"] for node in config["frontendnodes"]]
allowed_clients = []
allowed_servers = []
@@ -328,7 +340,17 @@ def gen_config(nodename, config, localconfig):
plopconfig.append((Symbol("storage_nodes"), storagenodeaddresses))
plopconfig.append((Symbol("storage_nodes_quorum"), config["storage-quorum-size"]))
services.add(Symbol("ht"))
- allowed_clients += allowed_clients_mergesecondary(primarymergenodename)
+ if nodename == primarymergenodename:
+ merge = localconfig["merge"]
+ plopconfig.append((Symbol("merge_delay"), merge["min-delay"]))
+ plopconfig.append((Symbol("merge_dist_winsize"), merge["dist-window-size"]))
+ plopconfig.append((Symbol("merge_dist_sendlog_chunksize"), merge["dist-sendlog-chunksize"]))
+ plopconfig.append((Symbol("merge_dist_sendentries_chunksize"), merge["dist-sendentries-chunksize"]))
+ plopconfig.append((Symbol("frontend_nodes"), frontendnodeaddresses))
+ plopconfig.append((Symbol("sth_path"), paths["mergedb"] + "/sth"))
+ allowed_servers += allowed_servers_primarymerge(frontendnodenames)
+ else:
+ allowed_clients += allowed_clients_mergesecondary(primarymergenodename)
plopconfig += [
(Symbol("publickey_path"), paths["publickeys"]),
@@ -375,8 +397,7 @@ def gen_testmakefile(config, testmakefile, machines, shellvars=False):
storagenodenames = set([node["name"] for node in config["storagenodes"]])
signingnodenames = set([node["name"] for node in config["signingnodes"]])
mergenodenames = set([node["name"] for node in config["mergenodes"]])
- erlangnodenames = frontendnodenames | storagenodenames | signingnodenames | \
- set(filter(lambda name: name != config["primarymergenode"], mergenodenames))
+ erlangnodenames_and_apps = ['%s:%s' % (nn, 'catlfish' if nn != config["primarymergenode"] else "merge") for nn in frontendnodenames | storagenodenames | signingnodenames | mergenodenames]
frontendnodeaddresses = [node["publicaddress"] for node in config["frontendnodes"]]
storagenodeaddresses = [node["address"] for node in config["storagenodes"]]
@@ -386,7 +407,7 @@ def gen_testmakefile(config, testmakefile, machines, shellvars=False):
delimiter = '"' if shellvars else ''
print >>configfile, "NODES=" + delimiter + " ".join(frontendnodenames|storagenodenames|signingnodenames|mergenodenames) + delimiter
- print >>configfile, "ERLANGNODES=" + delimiter + " ".join(erlangnodenames) + delimiter
+ print >>configfile, "ERLANGNODES=" + delimiter + " ".join(erlangnodenames_and_apps) + delimiter
print >>configfile, "MACHINES=" + delimiter + " ".join([str(e) for e in range(1, machines+1)]) + delimiter
print >>configfile, "TESTURLS=" + delimiter + " ".join(frontendnodeaddresses+storagenodeaddresses+signingnodeaddresses+mergenodeaddresses) + delimiter
print >>configfile, "BASEURL=" + delimiter + config["baseurl"] + delimiter
diff --git a/tools/merge b/tools/merge
index b5a50d5..0d3f36c 100755
--- a/tools/merge
+++ b/tools/merge
@@ -7,4 +7,4 @@ BINDIR=$(dirname $0)
$BINDIR/merge_fetch.py "$@"
$BINDIR/merge_backup.py "$@"
$BINDIR/merge_sth.py "$@"
-$BINDIR/merge_dist.py "$@"
+#$BINDIR/merge_dist.py "$@"
diff --git a/tools/merge_fetch.py b/tools/merge_fetch.py
index 8f94aed..42a3089 100755
--- a/tools/merge_fetch.py
+++ b/tools/merge_fetch.py
@@ -59,7 +59,7 @@ def merge_fetch(args, config, localconfig):
break
verifycert = subprocess.Popen(
- [paths["verifycert_bin"], paths["known_roots"]],
+ [paths["verifycert_bin"], paths["knownroots"]],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
added_entries = 0
diff --git a/tools/testcase1.py b/tools/testcase1.py
index dbafe7a..5192074 100755
--- a/tools/testcase1.py
+++ b/tools/testcase1.py
@@ -13,6 +13,7 @@ import struct
import hashlib
import itertools
import os.path
+from time import sleep
from certtools import *
baseurls = [sys.argv[1]]
@@ -148,8 +149,10 @@ def get_and_check_entry(timestamp, chain, leaf_index, baseurl):
len(submittedcertchain))
def merge():
- return subprocess.call([toolsdir + "/merge", "--config", testdir + "/catlfish-test.cfg",
+ rv = subprocess.call([toolsdir + "/merge", "--config", testdir + "/catlfish-test.cfg",
"--localconfig", testdir + "/catlfish-test-local-merge.cfg"])
+ sleep(5) # FIXME: Just wait for dist instead.
+ return rv
mergeresult = merge()
assert_equal(mergeresult, 0, "merge", quiet=True, fatal=True)