Skip to content

Latest commit

 

History

History
106 lines (93 loc) · 7.52 KB

TODO.md

File metadata and controls

106 lines (93 loc) · 7.52 KB

TODO items


Evaluate the use of compression (various algorithms - zstd/lz4/zlib) for on-disk storage to reduce disk footprint and improve I/O throughput. What are the pros and cons of each algorithm in terms of compression ratio, speed, and resource usage? How does compression affect the performance of read/write operations, especially for large datasets and very I/O heavy clients? Consider implementing a configurable option to enable/disable compression based on administrator preference or workload characteristics.


  • CoW storage needs to expose the on-disk format version, such that we can identify old stores on newer pace-kv versions with a newer on-disk format (to gracefully bail, or migrate)
  • Add valgrind memcheck CI job to ensure no memory issues on clang release build
  • Github CI should create a static pace-kv binary and provide it as artifact.
  • Add pace-kv stats command to show in-process stats of the currently running instance (assuming we auto-detect it via config file)
  • Add pace-kv live-stats command to show in-process stats live on the terminal (using Sixels, if supported by the connected terminal, otherwise Unicode or ASCII art)
  • Reactor UpdateInterest swallows real kevent/epoll_ctl failures — surface them instead of stalling. See risk note below. Done — and the hazard was not hypothetical: KqueueReactor::UpdateInterest submitted both filter changes in one kevent() changelist with no eventlist, so the benign ENOENT on the EVFILT_READ delete aborted the batch before the EVFILT_WRITE add was applied. Every reply too large for the socket send buffer parked forever. Fixed with EV_RECEIPT (per-change results, no early abort); park sites now fail the awaitable instead of suspending when arming fails. Regression tests in Net/KqueueSocket_test.cpp.
  • Data-driven ConfigMerge (review follow-up — Group D #12). The current Merge() in src/Pace/Config/ConfigMerge.cpp is 25 hand-rolled if-branches; adding a Config field requires touching Config + CliResult bit + CliParser + YamlReader + Merge, and the lruRecency / cpuAffinity silent-drop bug from the transactions-keyspace-dual-listener review was the predictable consequence. Replace the if-ladder with a descriptor table ({explicit-bit-getter, src-field-getter, dst-field-setter, mode}, where mode is one of ExplicitWins / NonDefaultWins) and a coverage test that asserts every CliResult::*Explicit bit is referenced by exactly one descriptor — that guard fails fast the next time someone adds a field without wiring it into Merge.
  • Startup-failure log on partial bind (review follow-up — Group D #14). RunMultiReactorPosix in src/Pace/Server/ReactorServerLoop.cpp binds reactorCount × binds listeners. When one bind fails mid-loop, the function logs a generic "cannot bind A:P on reactor R" and returns; the storage chain and reloader thread are already running. Add an OnBindFailure log path that names which (reactorIndex, bindIndex) pair failed and surfaces the kernel errno verbatim, so the operator can distinguish "port already in use on reactor 0" from "fd-table exhaustion on reactor 14". Inject a fake listener factory in ReactorServerLoop_test.cpp (create if absent) that succeeds for the first N calls then fails, assert the message names the offending pair.
  • HTTP/1.1 + JSON REST wire protocol (extra-clients survey, option B). Add an HTTP/1.1 listener that speaks JSON for GET /v1/keys/:k, PUT /v1/keys/:k, DELETE /v1/keys/:k, HEAD /v1/keys/:k (TTL), PATCH /v1/keys/:k (CAS), POST /v1/batch, GET /stats, GET /healthz. Unlocks curl, browser fetch, serverless platforms that ban raw TCP, k8s sidecars, Prometheus-style scrapers. Architecture: new HttpRest IProtocolHandler under src/Pace/Protocol/ — verb routing must be data-driven (descriptor table of {method, path-shape, engine-call}, not a hand-rolled if/switch ladder). Listener selection: introduce BindConfig::protocol (enum auto | http | resp | memcached-text | memcached-binary) so HTTP gets its own port and the ProtocolAutodetect one-byte peek stays unambiguous (HTTP method letters collide with Memcached text verbs). Future hook (out of scope for the first cut): WebSocket upgrade on the same listener gives browsers a bidirectional channel for the existing keyspace notifier — reuses IPubSubRegistry, no engine change.
  • Add support for Tracy (via CMake variable, off by default)
  • disk storage should be btrfs-like copy-on-write to allow O(1) blocking disk saves

Risk note: ignoring Attach/UpdateInterest return values in the socket layer

Resolved. Kept for the reasoning, which turned out to under-state the problem. The note assumed a false return was unreachable in practice; the actual failure needed no error at all, just kqueue's documented changelist semantics — an ENOENT on the first change silently dropped the second. See the closed item at the top of this file.

Context. KqueueSocket.cpp / EpollSocket.cpp call the reactor's [[nodiscard]] bool Attach(...) and bool UpdateInterest(...) at fire-and-forget sites and discard the result with std::ignore. Adding the macOS CI job surfaced this on the kqueue side (-Werror,-Wunused-result); the epoll side already did it.

Is ignoring the return safe? Mostly yes, today — but it hides a stability hazard.

  • Both methods return false only on precondition violations (handler == nullptr, fd < 0, dead reactor _kq/epfd < 0). At every ignore site the fd was just created/accepted and is known-valid, so false is unreachable in practice. Ignoring a value that is always true is harmless.
  • The genuinely risky part is inside UpdateInterest: the real ::kevent(...) (resp. epoll_ctl) result is itself (void)-discarded, so a true return does not mean the kernel accepted the interest change. The discard is intentional for the benign ENOENT-on-EV_DELETE case, but it also swallows every other failure (EINVAL, ENOMEM, EMFILE/fd-table pressure, etc.).

Stability impact. If an interest-arming call fails for a non-benign reason, the reactor silently stops delivering readiness for that fd. The owning connection coroutine then suspends and never resumes — a silent, permanent per-connection stall with a leaked fd, rather than a clean error the client can observe and retry. For a long-lived daemon whose primary goal is stability, a silent hang is a worse failure mode than a reported error. This affects Linux and macOS equally.

Recommendation (not blocking; tracked above).

  1. Distinguish benign ENOENT-on-delete from real failures inside UpdateInterest; on a real arming failure, propagate it so the pending IoAwaitable is completed with an error (clean connection teardown) instead of stalling. Apply symmetrically to EpollReactor and KqueueReactor.
  2. Once failures are reportable, reconsider the call-site contract: either keep std::ignore only where the return is provably non-actionable, or assert() the precondition-only sites to catch misuse in debug builds.
  3. Leaving std::ignore in place for now is an acceptable interim state — it matches the existing epoll behaviour and does not regress anything — but the silent-failure swallow in (1) is the real fix for the stated stability goal.