Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d04d8d4
Add di.torq.proc.discovery: one-to-one port of TorQ's discovery service
alowrydi Sep 25, 2026
3c67d3c
Fix di.torq.servers timer modes: legacy mode 2 is di.timer mode 3
alowrydi Sep 27, 2026
0660955
Fix di.torq.servers waitfortype: reach a discovery service that comes…
alowrydi Sep 28, 2026
3eadcbc
Trim di.torq.servers and discovery comments and docs to what, not why
alowrydi Sep 28, 2026
f198b57
di.torq settings: discovery off by default, debug off; tidy default.q
alowrydi Sep 28, 2026
4ee2727
di.torq.servers: add the enabled setting; tests spawn peers with QBIN
alowrydi Oct 1, 2026
f6788a9
Accept TOML-style retry and discoveryretry settings
alowrydi Oct 1, 2026
55caea0
Revert "Accept TOML-style retry and discoveryretry settings"
alowrydi Oct 1, 2026
48f48c7
di.torq.servers 0.5.0: port the trackservers.q lines legacy .sub and …
alowrydi Sep 27, 2026
0f2f141
di.torq.servers: querydiscovery calls the legacy 5-arg getservers (tr…
alowrydi Sep 27, 2026
67dd128
di.pubsub 0.2.0: port the legacy pubsub.q lines chainedtp uses
alowrydi Sep 27, 2026
1bb4af9
di.subscriptions 0.2.0: add .sub; trim comments across the chainedtp …
alowrydi Sep 28, 2026
ca1b0c2
di.torq: initialise pubsub at startup; chainedtp settings
alowrydi Sep 28, 2026
77594ad
di.torq.proc.chainedtp 0.2.0: rebuild as TorQ's chainedtp.q
alowrydi Sep 28, 2026
7cd2320
di.torq.proc.chainedtp 0.2.1: endofday convention and a temporary di-…
alowrydi Sep 28, 2026
b2c51ad
di.torq.proc.chainedtp: .u.subdetails reports the own log and its count
alowrydi Sep 29, 2026
81d07f4
di.pubsub: log is a required init dependency; servers test spawns wit…
alowrydi Oct 1, 2026
aff97ca
aligning subscription methods to the repo
alowrydi Sep 29, 2026
0c95f36
di.torq.proc.chainedtp: tests and docs for the di.subscriptions path
alowrydi Oct 1, 2026
aa22de2
di.torq.proc.segmentedtp 0.2.0: rebuild as TorQ's segmented tickerpla…
alowrydi Oct 1, 2026
feac8ab
di.torq.proc.tickerlogreplay 0.1.0: port TorQ's tickerlogreplay; di.d…
alowrydi Oct 1, 2026
95c9f66
merge main (#138/#139/#140) into feature-segmentedtp
alowrydi Oct 2, 2026
24afb71
One subscription path: rdb, wdb and chainedtp subscribe through .sub
alowrydi Oct 2, 2026
4aa911d
di.torq: deferred init list; segmentedtp re-registers its tables afte…
alowrydi Oct 2, 2026
e5c175b
di.torq: segmentedchainedtp proctype; torqx.sh honours startwithall
alowrydi Oct 2, 2026
e218a64
di.torq.proc.segmentedtp: initialise di.subscriptions in every mode
alowrydi Oct 7, 2026
7e7cb98
Accept TOML-style settings in servers, chainedtp, segmentedtp and tic…
alowrydi Oct 7, 2026
050b774
Command-line overrides for section settings; tickerlogreplay takes -.…
alowrydi Oct 7, 2026
937c217
di.torq.proc.tickerlogreplay: reject a message range in segmented mode
alowrydi Oct 8, 2026
bfc86db
segmentedtp, tickerlogreplay: no \d, no .os; .merge helpers move to d…
alowrydi Oct 13, 2026
d776cc1
Flat settings for segmentedtp and tickerlogreplay; module-private rep…
alowrydi Oct 13, 2026
1bcbf76
Underscore flat settings keys; segmentedchainedtp shares segmentedtp'…
alowrydi Oct 13, 2026
cd6b4b1
tickerlogreplay: no .replay namespace; settings only in the settings …
alowrydi Oct 13, 2026
386e6a5
tickerlogreplay: export only init and version
alowrydi Oct 13, 2026
67cb646
segmentedtp: settings only in the settings file
alowrydi Oct 13, 2026
5495e2e
Trim comments in the segmentedtp/tickerlogreplay/merge work
alowrydi Oct 13, 2026
fecb69a
Namespace cleanup: no \d in clienttracking, servers, chainedtp, subsc…
alowrydi Oct 14, 2026
6a03d87
chainedtp: tickerplantname, subscribeto and subscribesyms accept TOML…
alowrydi Oct 14, 2026
74eaa9a
chainedtp: read procname bare in createlogfilename
alowrydi Oct 14, 2026
5d8e788
Merge origin/main (#141, #137) into feature-segmentedtp
alowrydi Oct 14, 2026
2684505
Run the STP tick as a di.timer job, exit on init failure, drop unders…
alowrydi Oct 15, 2026
a4888b2
Address review: customcsv default, di.os mkdir, triadic callendofperi…
alowrydi Oct 15, 2026
d490797
Version di.os and declare it in deps.toml
alowrydi Oct 15, 2026
17c6702
segmentedtp: retry the tick on error; stop it via a flag
alowrydi Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions di/clienttracking/clienttracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,34 @@ queries they sent, how many failed and how many bytes they were sent.
| Name | What |
|---|---|
| `.clients.clients` | session table, keyed on `w`: `ipa u a k K c s o f pid port startp endp lastp hits errs sz` |
| `.clients.po[result;W]` / `.clients.wo[result;W]` | record a new connection / websocket |
| `.clients.pc[result;W]` | mark a closed connection: `w` becomes null, `endp` is set |
| `.clients.hit[x]` / `.clients.hite[x]` | count a query and its result bytes / count a failed query, then re-signal |
| `.clients.cleanup[]` | mark dead handles, close idle ones (`MAXIDLE`), purge old closed rows (`RETAIN`) |
| `.clients.addw[w]` | record handle `w` by hand |
| `.clients.unregistered[]` | see below |
| `.dotz.ipa` / `.dotz.liveh` / `.dotz.livehn` | host name lookup and live-handle checks, defined if absent |
| `.dotz.liveh` / `.dotz.livehn` / `.dotz.liveh0` | live-handle checks, defined if absent (di.torq.servers defines them too) |

Everything else is module-private: `po`/`wo` record a new connection/websocket, `pc` marks a closed one
(`w` null, `endp` set), `hit`/`hite` count a query and its result bytes / a failed query, `cleanup` marks
dead handles, closes idle ones and purges old closed rows, `addw[w]` records a handle by hand.

## Settings

A `clients` section of the process config, set onto `.clients.<name>`:
Required in `config`; `di/torq/settings/default.q` declares them all:

| Key | Default | Meaning |
|---|---|---|
| `enabled` | `1b` | track connections |
| `opencloseonly` | `0b` | track connections but not queries |
| `INTRUSIVE` | `0b` | ask each new kdb+ client for `k K c s o f pid port`; don't use with non-kdb+ clients |
| `AUTOCLEAN` | `1b` | not read |
| `RETAIN` | `` `long$0D02 `` | nanoseconds to keep a closed row |
| `MAXIDLE` | `` `long$0D `` | nanoseconds of idleness before a handle is closed; 0 means never |
| `clientsenabled` | `1b` | track connections |
| `clientsopencloseonly` | `0b` | track connections but not queries |
| `clientsintrusive` | `0b` | ask each new kdb+ client for `k K c s o f pid port`; don't use with non-kdb+ clients |
| `clientsautoclean` | `1b` | not read |
| `clientsretain` | `` `long$0D02 `` | nanoseconds to keep a closed row |
| `clientsmaxidle` | `` `long$0D `` | nanoseconds of idleness before a handle is closed; 0 means never |

## init[config;deps]

Requires `handlers` (`di.torq.handlers`). It:

1. applies the `clients` section;
2. registers `.clients.pc` on `.z.pc`, whether or not `enabled`;
3. when `enabled`, registers `.clients.po` on `.z.po`, `.clients.wo` on `.z.wo` and `.clients.pc` on `.z.wc`;
4. when `enabled` and not `opencloseonly`, wraps `.z.pg`, `.z.ps` and `.z.ws` directly (not through
`di.torq.handlers`) with `{.clients.hit[@[x;y;.clients.hite]]}` around the current handler.
1. signals if any setting is missing, then applies them;
2. registers `pc` on `.z.pc`, whether or not `enabled`;
3. when `clientsenabled`, registers `po` on `.z.po`, `wo` on `.z.wo` and `pc` on `.z.wc`;
4. when `clientsenabled` and not `clientsopencloseonly`, wraps `.z.pg`, `.z.ps` and `.z.ws` directly (not through
`di.torq.handlers`) with `{hit[@[x;y;hite]]}` around the current handler.
An unset `.z.pg`/`.z.ps` is taken as `value`, and an unset `.z.ws` as an echo.

Call `init` once: a second call wraps the query handlers again. An exec owner registered on those
Expand All @@ -48,9 +46,9 @@ events through `di.torq.handlers` afterwards replaces the wrap.
- `hits`, `errs` and `sz` count async (`.z.ps`) and websocket (`.z.ws`) messages too, including the
bytes of results that are never sent back.
- A closed row keeps its key with `w` set to null, so several closed rows share a null key.
- A handle closed by the `MAXIDLE` sweep still has a null `endp`, so the same sweep drops its row
- A handle closed by the `clientsmaxidle` sweep still has a null `endp`, so the same sweep drops its row
instead of marking it.
- `.clients.unregistered[]` reads a `CLIENTS` table that doesn't exist, and fails.
- The private `unregistered[]` reads a `CLIENTS` table that doesn't exist, and fails.
- `hits` and `errs` are ints.

## Testing
Expand All @@ -60,7 +58,8 @@ k4unit:use`di.k4unit
k4unit.moduletest`di.clienttracking
```

`test.q`/`test.csv` start four server peers (defaults, `opencloseonly`, disabled, and `INTRUSIVE`
with a one-second `MAXIDLE` and `RETAIN`) and connect to them. The tests cover the table and
defaults, connection rows, hits, bytes and errors, closing and `addw`, websocket rows, both
settings modes, the `INTRUSIVE` reply, idle closing and the `RETAIN` purge.
`test.q`/`test.csv` start four server peers, each configured from the settings file plus overrides
(defaults, `clientsopencloseonly`, disabled, and `clientsintrusive` with a one-second `clientsmaxidle`
and `clientsretain`), and connect to them. The tests cover the settings, the table, the init checks,
the stored settings, connection rows, hits, bytes and errors, closing and `addw`, websocket rows, both
settings modes, the intrusive reply, idle closing and the retain purge.
69 changes: 31 additions & 38 deletions di/clienttracking/clienttracking.q
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,56 @@

init:{[config;deps]
if[not `handlers in key deps;'"di.clienttracking: handlers dependency is required - see di.torq.handlers"];
{[s;k] set[` sv `.clients,k;s k]}[s] each key s:$[`clients in key config;config`clients;()!()];
/ all settings required
req:`clientsenabled`clientsopencloseonly`clientsintrusive`clientsautoclean`clientsretain`clientsmaxidle;
if[count m:req except key config;'"di.clienttracking: missing settings: ",", " sv string m];
.z.m.enabled:config`clientsenabled;
.z.m.opencloseonly:config`clientsopencloseonly;
.z.m.intrusive:config`clientsintrusive;
.z.m.autoclean:config`clientsautoclean;
.z.m.retain:config`clientsretain;
.z.m.maxidle:config`clientsmaxidle;
r:deps[`handlers]`register;
r[`.z.pc;`;`clients;0j;.clients.pc[::;]];
if[.clients.enabled;
r[`.z.po;`;`clients;0j;.clients.po[::;]];
r[`.z.wo;`;`clients;0j;.clients.wo[::;]];
r[`.z.wc;`;`clients;0j;.clients.pc[::;]];
if[not .clients.opencloseonly;
set[`.z.pg;{.clients.hit[@[x;y;.clients.hite]]}@[value;`.z.pg;{.:}]];
set[`.z.ps;{.clients.hit[@[x;y;.clients.hite]]}@[value;`.z.ps;{.:}]];
set[`.z.ws;{.clients.hit[@[x;y;.clients.hite]]}@[value;`.z.ws;{{neg[.z.w]x;}}]]]];
r[`.z.pc;`;`clients;0j;pc[::;]];
if[enabled;
r[`.z.po;`;`clients;0j;po[::;]];
r[`.z.wo;`;`clients;0j;wo[::;]];
r[`.z.wc;`;`clients;0j;pc[::;]];
if[not opencloseonly;
set[`.z.pg;{hit[@[x;y;hite]]}@[value;`.z.pg;{.:}]];
set[`.z.ps;{hit[@[x;y;hite]]}@[value;`.z.ps;{.:}]];
set[`.z.ws;{hit[@[x;y;hite]]}@[value;`.z.ws;{{neg[.z.w]x;}}]]]];
}

\d .dotz

if[not `IPA in key `.dotz;
IPA:(.z.a,.Q.addr`localhost)!.z.h,`localhost;
ipa:{$[`~r:IPA x;IPA[x]:$[`~r:.Q.host x;`$"."sv string"i"$0x0 vs x;r];r]}];
IPA:(.z.a,.Q.addr`localhost)!.z.h,`localhost;
ipa:{$[`~r:IPA x;.z.m.IPA[x]:$[`~r:.Q.host x;`$"."sv string"i"$0x0 vs x;r];r]};
livehx:{y in x,key .z.W};
/ live-handle checks, shared with di.torq.servers
if[not `liveh in key `.dotz;
livehx:{y in x,key .z.W}; liveh:livehx(); livehn:livehx 0Ni; liveh0:livehx 0i];

\d .clients

/ settings
enabled:1b
opencloseonly:0b
INTRUSIVE:0b
AUTOCLEAN:1b
RETAIN:`long$0D02
MAXIDLE:`long$0D
.dotz.liveh:livehx(); .dotz.livehn:livehx 0Ni; .dotz.liveh0:livehx 0i];

enabled:@[value;`enabled;1b]
opencloseonly:@[value;`opencloseonly;0b]

clients:@[value;`clients;([w:`int$()]ipa:`symbol$();u:`symbol$();a:`int$();k:`date$();K:`float$();c:`int$();s:`int$();o:`symbol$();f:`symbol$();pid:`int$();port:`int$();startp:`timestamp$();endp:`timestamp$();lastp:`timestamp$();hits:`int$();errs:`int$();sz:`long$())]
/ root: queried remotely
.clients.clients:@[value;`.clients.clients;([w:`int$()]ipa:`symbol$();u:`symbol$();a:`int$();k:`date$();K:`float$();c:`int$();s:`int$();o:`symbol$();f:`symbol$();pid:`int$();port:`int$();startp:`timestamp$();endp:`timestamp$();lastp:`timestamp$();hits:`int$();errs:`int$();sz:`long$())];

unregistered:{except[key .z.W;exec w from`CLIENTS]}
cleanup:{
if[count w0:exec w from`.clients.clients where not .dotz.livehn w;
update endp:.z.p,w:0Ni from`.clients.clients where w in w0];
if[.clients.MAXIDLE>0;
hclose each exec w from`.clients.clients where .dotz.liveh w,lastp<.z.p-.clients.MAXIDLE];
delete from`.clients.clients where not .dotz.liveh w,endp<.z.p-.clients.RETAIN;}
if[maxidle>0;
hclose each exec w from`.clients.clients where .dotz.liveh w,lastp<.z.p-.z.m.maxidle];
delete from`.clients.clients where not .dotz.liveh w,endp<.z.p-.z.m.retain;}
hit:{update lastp:.z.p,hits:hits+1i,sz:sz+-22!x from`.clients.clients where w=.z.w;x}
hite:{update lastp:.z.p,hits:hits+1i,errs:errs+1i from`.clients.clients where w=.z.w;'x}
po:{[result;W]
cleanup[];
`.clients.clients upsert(W;.dotz.ipa .z.a;.z.u;.z.a;0Nd;0n;0Ni;0Ni;(`);(`);0Ni;0Ni;zp;0Np;zp:.z.p;0i;0i;0j);
if[INTRUSIVE;
`.clients.clients upsert(W;ipa .z.a;.z.u;.z.a;0Nd;0n;0Ni;0Ni;(`);(`);0Ni;0Ni;zp;0Np;zp:.z.p;0i;0i;0j);
if[intrusive;
neg[W]"neg[.z.w]\"update k:\",(string .z.k),\",K:\",(-3!.z.K),\",c:\",(-3!.z.c),\",s:\",(-3!system\"s\"),\",o:\",(-3!.z.o),\",f:\",(-3!.z.f),\",pid:\",(-3!.z.i),\",port:\",(-3!system\"p\"),\" from`.clients.clients where w=.z.w\""];
result}
addw:{po[x;x]}
pc:{[result;W] update w:0Ni,endp:.z.p from`.clients.clients where w=W;cleanup[];result}

wo:{[result;W]
cleanup[];
`.clients.clients upsert(W;.dotz.ipa .z.a;.z.u;.z.a;0Nd;0n;0Ni;0Ni;(`);(`);0Ni;0Ni;zp;0Np;zp:.z.p;0i;0i;0j);
`.clients.clients upsert(W;ipa .z.a;.z.u;.z.a;0Nd;0n;0Ni;0Ni;(`);(`);0Ni;0Ni;zp;0Np;zp:.z.p;0i;0i;0j);
result}

\d .
21 changes: 12 additions & 9 deletions di/clienttracking/test.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ before,0,0,q,system "l di/clienttracking/test.q",1,,load fixture helpers
before,0,0,q,setupfixture[],1,,start the server peers

comment,,,,,,,settings and table
true,0,0,q,"(1b;0b;0b;1b)~.clients`enabled`opencloseonly`INTRUSIVE`AUTOCLEAN",1,,boolean defaults
true,0,0,q,"(`long$0D02;0)~.clients`RETAIN`MAXIDLE",1,,RETAIN two hours and MAXIDLE off
run,0,0,q,"S:(use`di.torq.config)[`parsefile] SETTINGS",1,,read the settings file
true,0,0,q,"(1b;0b;0b;1b)~S`clientsenabled`clientsopencloseonly`clientsintrusive`clientsautoclean",1,,boolean defaults
true,0,0,q,"(`long$0D02;0)~S`clientsretain`clientsmaxidle",1,,retain two hours and maxidle off
true,0,0,q,"(enlist`w)~keys .clients.clients",1,,table keyed on w
true,0,0,q,"`ipa`u`a`k`K`c`s`o`f`pid`port`startp`endp`lastp`hits`errs`sz~cols value .clients.clients",1,,table columns
true,0,0,q,"""iij""~exec t from meta .clients.clients where c in `hits`errs`sz",1,,hits and errs int; sz long
fail,0,0,q,"ct.init[()!();()!()]",1,,init without handlers must error
fail,0,0,q,"ct.init[()!();enlist[`handlers]!enlist()!()]",1,,init without settings must error

comment,,,,,,,connection lifecycle
run,0,0,q,ha:peer PORTS`a,1,,connect to the default peer
true,0,0,q,"1=ha""count select from .clients.clients where w=.z.w""",1,,a connection adds a row
true,0,0,q,"(.z.u;`localhost;`int$.Q.addr`localhost)~(mine[ha;""u""];mine[ha;""ipa""];mine[ha;""a""])",1,,row records user and address
true,0,0,q,"(mine[ha;""startp""]<=mine[ha;""lastp""]) and null mine[ha;""endp""]",1,,startp and lastp set; endp null while open
true,0,0,q,"ha""all {`clients in exec name from h.list x} each `.z.po`.z.pc`.z.wo`.z.wc""",1,,open and close observers registered
true,0,0,q,"(S`clientsenabled`clientsopencloseonly`clientsintrusive`clientsautoclean`clientsretain`clientsmaxidle)~ha"".m.di.0clienttracking`enabled`opencloseonly`intrusive`autoclean`retain`maxidle""",1,,init stores the settings

comment,,,,,,,usage
run,0,0,q,"n0:mine[ha;""hits""]; ha""1+1""; n1:mine[ha;""hits""]",1,,two sync queries
Expand All @@ -31,10 +34,10 @@ comment,,,,,,,close and manual add
run,0,0,q,"c0:ha""count select from .clients.clients where null w,not null endp""; hclose ha; hb:peer PORTS`a",1,,close and reconnect
true,0,0,q,"(c0+1)=hb""count select from .clients.clients where null w,not null endp""",1,,a close nulls w and sets endp
true,0,0,q,"1=hb""count select from .clients.clients where w=.z.w""",1,,the new connection has its own row
true,0,0,q,"0i=hb"".clients.addw .z.w; exec first hits from .clients.clients where w=.z.w""",1,,addw records the handle afresh
fail,0,0,q,"hb"".clients.unregistered[]""",1,,unregistered reads a CLIENTS table that does not exist
true,0,0,q,"hb"".clients.wo[::;999i]; 1=count select from .clients.clients where w=999i""",1,,a websocket open adds a row
true,0,0,q,"hb"".clients.pc[::;999i]; 0=count select from .clients.clients where w=999i""",1,,a websocket close nulls w
true,0,0,q,"0i=hb"".m.di.0clienttracking.addw .z.w; exec first hits from .clients.clients where w=.z.w""",1,,addw records the handle afresh
fail,0,0,q,"hb"".m.di.0clienttracking.unregistered[]""",1,,unregistered reads a CLIENTS table that does not exist
true,0,0,q,"hb"".m.di.0clienttracking.wo[::;999i]; 1=count select from .clients.clients where w=999i""",1,,a websocket open adds a row
true,0,0,q,"hb"".m.di.0clienttracking.pc[::;999i]; 0=count select from .clients.clients where w=999i""",1,,a websocket close nulls w

comment,,,,,,,opencloseonly
run,0,0,q,"hbb:peer PORTS`b; hbb""1+1""; hbb""1+1""",1,,connect and query the opencloseonly peer
Expand All @@ -46,12 +49,12 @@ run,0,0,q,hc:peer PORTS`c,1,,connect to the disabled peer
true,0,0,q,"0=hc""count .clients.clients""",1,,connections are not recorded
true,0,0,q,"hc""(`clients in exec name from h.list`.z.pc) and not `clients in exec name from h.list`.z.po""",1,,.z.pc is still wired when disabled

comment,,,,,,,INTRUSIVE and settings section
comment,,,,,,,intrusive and settings overrides
run,0,0,q,"hd:peer PORTS`d; hd""1""; hd""1""",1,,connect to the INTRUSIVE peer and let the reply arrive
true,0,0,q,"(.z.i;.z.k;system""p"")~(mine[hd;""pid""];mine[hd;""k""];mine[hd;""port""])",1,,the client reported its pid and version and port
true,0,0,q,"(`long$0D00:00:01)~hd"".clients.MAXIDLE""",1,,a clients section overrides the defaults
true,0,0,q,"(`long$0D00:00:01)~hd"".m.di.0clienttracking.maxidle""",1,,settings override the defaults

comment,,,,,,,MAXIDLE and RETAIN
comment,,,,,,,maxidle and retain
run,0,0,q,"hd2:peer PORTS`d; system ""sleep 1.5""; hd3:peer PORTS`d",1,,leave two connections idle past MAXIDLE then connect again
true,0,0,q,"`closed~@[hd2;""1"";{`closed}]",1,,an idle connection is closed
true,0,0,q,"1=hd3""count .clients.clients""",1,,closed idle connections and expired rows are dropped
Expand Down
7 changes: 5 additions & 2 deletions di/clienttracking/test.q
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ peer:{[p] hopen `$":localhost:",string p}
PORTS:`a`b`c`d!4#0N

/ a: defaults; b: opencloseonly; c: disabled; d: INTRUSIVE with a 1s MAXIDLE and RETAIN
CFGS:`a`b`c`d!("()!()";"enlist[`opencloseonly]!enlist 1b";"enlist[`enabled]!enlist 0b";"`INTRUSIVE`MAXIDLE`RETAIN!(1b;`long$0D00:00:01;`long$0D00:00:01)")
CFGS:`a`b`c`d!("()!()";"enlist[`clientsopencloseonly]!enlist 1b";"enlist[`clientsenabled]!enlist 0b";"`clientsintrusive`clientsmaxidle`clientsretain!(1b;`long$0D00:00:01;`long$0D00:00:01)")

/ the settings file, the base of every peer's config
SETTINGS:"di/torq/settings/default.q"

setupfixture:{[]
system "rm -rf ",FIXDIR; system "mkdir -p ",FIXDIR;
{[n;c] (`$":",FIXDIR,"/",string[n],".q") 0: (
"h:use`di.torq.handlers";
"h.init enlist[`log]!enlist `info`warn`error!3#{[c;m]}";
"ct:use`di.clienttracking";
"ct.init[enlist[`clients]!enlist ",c,";enlist[`handlers]!enlist `register`remove`list#h]")}'[key CFGS;value CFGS];
"ct.init[((use`di.torq.config)[`parsefile] \"",SETTINGS,"\"),",c,";enlist[`handlers]!enlist `register`remove`list#h]")}'[key CFGS;value CFGS];
p:40000+(`int$.z.i mod 20000)+til 500; p:p where isfree each p;
PORTS::key[PORTS]!4#p;
{system QBIN," ",FIXDIR,"/",string[x],".q -p ",(string y)," -q </dev/null >/dev/null 2>&1 &"}'[key PORTS;value PORTS];
Expand Down
2 changes: 1 addition & 1 deletion di/dbwrite/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
3 changes: 2 additions & 1 deletion di/dbwrite/dbwrite.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ default,,time,1
| `savedown[dir;part;tabname;data]` | Write an in-memory table to an HDB partition, sort it, then run gc |
| `appenddown[dir;part;tabname;data]` | Append rows to an existing partition (no sort) |
| `applyattr[dloc;colname;att]` | Apply a single kdb+ attribute to an on-disk column |
| `gc[]` | Run `.Q.gc[]` and log memory stats before and after |

---

Expand Down Expand Up @@ -207,5 +208,5 @@ The suite injects binary mock loggers (`{[c;m] ...}`): a no-op logger, and a cap
## Exported symbols

```q
export:([init;readcsv;setconfig;getconfig;sort;applyattr;savedown;appenddown])
export:([init;readcsv;setconfig;getconfig;sort;applyattr;savedown;appenddown;gc])
```
2 changes: 1 addition & 1 deletion di/dbwrite/init.q
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
/ BOTH the file (pre-load manifest walk) and this export (post-load session audit).
version:first read0`:::VERSION

export:([init;readcsv;setconfig;getconfig;sort;applyattr;savedown;appenddown;version])
export:([init;readcsv;setconfig;getconfig;sort;applyattr;savedown;appenddown;gc;version])
5 changes: 5 additions & 0 deletions di/dbwrite/test.csv
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ true,0,0,q,"any caplog[`msg] like ""*read 3 sort config*""",1,1,readcsv logs the
true,0,0,q,all not null (select from caplog where fn=`info)[`ctx],1,1,readcsv logs are tagged with a context symbol
true,0,0,q,not any caplog[`fn]=`error,1,1,readcsv logs no errors on success

comment,,,,,,,log call verification - gc
run,0,0,q,caplog:0#caplog,1,1,reset log capture
run,0,0,q,dbwrite.gc[],1,1,gc runs
true,0,0,q,2=count select from caplog where ctx=`gc,1,1,gc logs before and after

comment,,,,,,,log call verification - readcsv error logging on file read failure
run,0,0,q,caplog:0#caplog,1,1,reset log capture
run,0,0,q,@[dbwrite.readcsv;`:nonexistent_file.csv;{x}],1,1,trigger file read error
Expand Down
2 changes: 1 addition & 1 deletion di/merge/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
3 changes: 2 additions & 1 deletion di/merge/init.q
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ if[0=count version;'"di.merge: VERSION file is empty"];
/ public api - only the functions intended to be called externally are exported
export:([init;checkpartitiontype;checkenumerabletype;getextrapartitions;getfirstcharpartitions;
getpartchunks;mergebypart;mergebycol;mergehybrid;trackpartition;clearpartsizes;
getpartsizes;syncpartsizes;version;getapimeta])
getpartsizes;syncpartsizes;getmergebybytelimit;getpartlimit;getextrapartitiontype;
version;getapimeta])
Loading