Vladimír Čunát [Thu, 12 Nov 2020 13:13:49 +0000 (14:13 +0100)]
xdp: warn when using XDP emulation
For simplicity we bump Knot version that's required for using XDP.
Syntax: I found no better way to split the line;
alternative: backslash in meson >= 0.50.
Vladimír Čunát [Fri, 13 Nov 2020 13:16:32 +0000 (14:16 +0100)]
fix map() command on 32-bit platforms; regressed in 5.2.0
LuaJIT FFI was using opendir() (etc.) variants with 32-bit inodes
but the C parts was using them as 64-bit inode variants.
Consequently the `struct dirent` layout didn't match and we were getting
filenames shifted by eight bytes.
Now the whole dir-listing lua function is written in C.
Vladimír Čunát [Wed, 4 Nov 2020 09:07:40 +0000 (10:07 +0100)]
modules: fix issues with dropped answers - resolve()
Well... practically it still can't happen that an internal request
gets its answer dropped, but ATM my understanding of the API is that
it is allowed to happen already, and the crashes during tests were
bothering me (simulating drops).
This may become more relevant in future, e.g. if we allow dropping
as a policy action; policy authors may not care about the request being
internal.
Vladimír Čunát [Tue, 3 Nov 2020 11:34:04 +0000 (12:34 +0100)]
daemon/worker: allow dropping even on non-XDP
During testing it was sending me SERVFAIL, which was weird.
There's no use case so far, but if it was decided to drop the answer,
it should really happen regardless of the transport.
Vladimír Čunát [Wed, 21 Oct 2020 15:25:18 +0000 (17:25 +0200)]
XDP: add backend parts
Logging strings: I originally wanted to have four chars inside [],
but it doesn't really matter in these cases where logs don't happen
within a request, so "[xdp]" won due to uniformity and simplicity.
Petr Špaček [Mon, 26 Oct 2020 17:38:29 +0000 (18:38 +0100)]
tty: do not print extra newline after empty messages
In case nothing (not even nil) is returned then do not print newline
after the zero-length message. This avoids unambiguous empty line in
output (is it an empty string which got printed?).
Petr Špaček [Mon, 20 Jul 2020 07:46:10 +0000 (09:46 +0200)]
replace sandbox table_print with new pretty printer
This slightly changes table_print() output format.
table_print() output is not intended for machine consumption,
use krprint.serialize_lua() or JSON for that purpose.
Output from table_print is now a valid Lua expression
if the input contains only serializable data types
(number, string, bool, nil, table), which is nice for copy&pasting.
Functions etc. are also pretty-printed but cannot be deserialized.
Numbers are pretty-printed as well so their precision is reduced (as
compared to krprint.serialize_lua).
Petr Špaček [Fri, 23 Oct 2020 13:31:28 +0000 (15:31 +0200)]
http: adapt Prometheus to changes in map()
We don't have leader instance anymore, so any instance can provide
Prometheus statistics.
For performance reasons an instance does not store past statistics
when no client is connected to HTTP socket. As a consequence chart in
web interface is empty when client loads the page and then gradually
chart fills up.
Petr Špaček [Wed, 14 Oct 2020 09:08:43 +0000 (11:08 +0200)]
map: rework result handling
map() command on leader instance now:
- detects call errors on followers
- detects unsupported number of return values
- detects unsupported data types which cannot be serialized
- keeps nil return values (signaled by table counter "n")
Petr Špaček [Tue, 13 Oct 2020 10:54:16 +0000 (12:54 +0200)]
tests: adapt config tests to new map()
map() now depends on presence of control sockets, and by default config
tests are executed with KRESD_NO_LISTEN=1 env var which prevents control
sockets from being created. Tests for features which depend on map() now
explicitly create their own control socket.
Petr Špaček [Tue, 13 Oct 2020 10:53:07 +0000 (12:53 +0200)]
tests: improve process cleanup after config tests
Previously exit trap executed command "kill -9" even if there were no
leftover processes and this lead to clutter in logs because kill
complained about missing arguments.
As a bonus the cleanup routine now prints information about leftover
processes.
map: use control sockets instead of pipe from parent process
This change allows map() to work with systemd integration.
As a bonus the new client implementation is based on Lua cqueues
allows caller to wrap map() in worker.corroutine() and get
asynchronous execution/avoid blocking main loop.
Currently socket communication does not employ timeouts so a hang
instance will lead to hang map() call. This does not affect query
processing _if_ map() is being run in worker.corroutine.