Repository navigation
Feature segmentedtp - #144
Conversation
di.torq.proc.discovery 0.1.0 repackages TorQ code/processes/discovery.q line for line (register, getservices, subs, the startup addw pass and autodiscovery push, .z.pc prune), publishing register/getservices at their legacy root names. di.torq.servers 0.3.0 -> 0.4.0 ports the client half of the protocol from code/handlers/trackservers.q at its legacy root names (.servers.*, .dotz.liveh*): addw, removerows, cleanup, retrydiscovery, autodiscovery, querydiscovery, registerfromdiscovery, addprocs, procupdate, startup and friends, with SERVERS (now carrying attributes) and the trackservers settings as root .servers.* globals. Exported API unchanged. servers.md lists each ported line, the conversions, what was not ported, and the behaviour changes. di.torq: discovery registered as a built-in; legacy STARTUP ported (torq.q l.673) so the hdb registers with discovery as legacy's does; settings/default.q carries legacy default.q's .servers values, settings/discovery.q legacy's discovery settings, settings/hdb.q startup:1b. Note: legacy defaults route every process's connections through discovery - a stack with no discovery process no longer dials process.csv peers directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legacy TorQ timer modes 0/1/2 schedule the next run from the scheduled start, the actual start and the finish (code/common/timer.q l.8-11); di.timer's 1h/2h/3h mean the same, so legacy mode n is di.timer mode n+1. d04d8d4 ported legacy's .timer.repeat (default mode 2, from finish) as di mode 2 (from actual start) for the discoveryretry and serversretry jobs. Both now use mode 3. The servers suite gains a row asserting mode 3 for both jobs; it fails against d04d8d4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… up during the wait With connections taken from discovery (the builtin default), a process started before discovery registers only a dead discovery row. waitfortype polled retry[], which skips discovery rows and never re-queries, so the rdb, wdb and feed each waited out tpwaittimeout (30s) and aborted init, left running but uninitialised. Reproduced on TorqX-POC with discovery1 last in process.csv. Each poll now calls startup ()!() (reconnect discovery, register, take the rows it names) and keeps retry[]. The servers suite gains a discovery stub that comes up after startup; the waitfortype row fails against 3c67d3c and passes here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
servers.q: the header, registered, init, opencon, timer, startup and waitfortype comments cut to one line each. servers.md: intro and init prose condensed; the .z.pc registration and conventions sections dropped (the conversions list covers the first); tests section listed. Test helper headers cut to one line. Comment and doc changes only; the servers (43), discovery (30) and di.torq (56) suites pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
discoveryregister and connectionsfromdiscovery default to 0b, so a process dials its process.csv peers directly unless the app turns discovery on. debug defaults to 0b. default.q regrouped into discovery, connections and server-record blocks with aligned one-line comments. servers.md updated to match. The di.torq suite gains a row asserting the cascaded defaults for a non-discovery proctype; it fails on the previous default.q. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- settings gains `enabled` -> .servers.enabled (1b), gating the discoveryretry and serversretry timer jobs (trackservers.q l.12, l.387). Lines are byte-identical to di.torq.servers 0.5.0, so feature-chainedtp inherits them. - test.csv: enabled defaults to 1b. - test.q: spawnpeer runs QBIN (the running q binary) instead of $QHOME/bin/q; QBIN is defined once in the fixture block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
di.torq.servers converts retry and discoveryretry from a timespan, a "0D00:00:10" string or a number of seconds. TOML has no timespan type, so these settings can now live in .toml files. New test rows fail on the previous code. The di.torq.servers half of c95ce2f from feature-torqx-poc-demo; the chainedtp half lives on feature-chainedtp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit f6788a9. Nothing in this repo sets retry or discoveryretry as a string or number, and it is outside this PR's scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chainedtp call At their legacy root names, as trackservers.q's own text in a \d .servers section: attributematch and the legacy 5-arg .servers.getservers (l.64-89), connectcustom (l.198, called from retryrows as l.184-185 does), reqprocsnotconn/reqprocnamesnotconn and startupdepcyclestypename/startupdepnamecycles (l.348-379). The exported 1-arg getservers is unchanged. enabled (l.12, default.q l.60) gates the discoveryretry/serversretry timer jobs as l.387 does. Conversions in startupdepcyclestypename: .servers.startup[] -> .servers.startup ()!(), .lg.e -> .z.m.logerr, .proc.procname -> init's identity, .os.sleep -> system "sleep ". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ackservers.q l.218) d04d8d4 inlined the result of getservers[`proctype;`discovery;()!();0b;0b] because the 5-arg function did not exist yet; 1a4ecfd ported it, so querydiscovery now makes legacy's own call (qualified as .servers.getservers - the bare name in the module is the exported 1-arg getservers). The matching deviation is dropped from servers.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legacy TorQ code/common/pubsub.q, as its own text in a \d .stpps section at the end of pubsub.q, at its root names: .stpps state, suball/subfiltered/add/errparse/addfiltered/selfiltered/pub, delhandle/delhandlef/closesub/extractschema/init (l.9-124), root .u.sub (l.134-141) and .ps.loaded/publish/subscribe/init/initialise (l.147-151). It keeps its own state; the existing di.pubsub API and behaviour are unchanged. init takes an optional deps carrying log, used for legacy's .lg.e calls; init[] is unchanged. l.129's .z.pc binding is left to the consumer (closesub via handlers), as for di.pubsub's own. Not ported: .stpps.endp/end/pubclear/attrstrip, .u.pub, .ps.subtable*, .ds.*. Processes that load di.pubsub now carry root .stpps/.ps and a legacy .u.sub until they set their own; the tickerplant and segmentedtp set theirs after use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…work di.subscriptions: TorQ code/common/subscriptions.q (l.5-166) as its own text in a \d .sub section at the end of subscriptions.q: SUBSCRIPTIONS, getsubscriptionhandles, updatesubscriptions, reducesubs, createtables, replay, subscribe (tptype handshake), replayupd, checksubscriptions, retrysubscription, autoreconnect, pc. The existing API is unchanged. init now requires timer and handlers, applies the autoreconnect/checksubscriptionperiod settings (default.q 0b / 0D00:00:10), and registers once per process, in every di.subscriptions user: .sub.pc on .z.pc and the checksubscriptions timer job. Deviations from TorQ's text: - .lg.o/.lg.e -> .z.m.log; .proc.cp[] -> .z.p. - .z.pc via handlers as the projection .sub.pc[::;] (an observer receives only the handle). - checksubscriptions: timespan period converted to seconds; TorQ mode 0 = di.timer mode 1. - the "timer not enabled" error branch is dropped (the timer is always injected). - once-only guard: a second init registers nothing, where TorQ's dupcheck throws. - deps.toml pins di.torq.servers 0.5.0 (.servers.getservers/enabled/connectcustom). Tests: a live check with a separate idle client and real handlers shows a peer's close marks the subscription inactive at once, with no checksubscriptions run; it fails if .sub.pc is registered bare. Comments: across servers, pubsub, discovery, settings and torq.q, comments are one line and no longer refer to TorQ sources or line numbers; test descriptions likewise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
torq.q runs .ps.initialise[] when .ps.loaded is set, directly before the STARTUP line, as TorQ's torq.q l.670-673 does. Processes that load di.pubsub (tickerplant, segmentedtp) now fill the .stpps state at startup; nothing in them reads it. settings/chainedtp.q: TorQ's config/settings/chainedtp.q as flat keys (tickerplantname, pubinterval, tpconnsleep, createlogfile, logdir, subscribeto, subscribesyms, replay, schema, clearlogonsubscription, tpcheckcycles, connections, startup). Its .hb/.usage lines are not carried: di has no heartbeat reader, and [querylog] is already off unless enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module is rebuilt from TorQ's code/processes/chainedtp.q, as its own text in TorQ's order: root tptype/tablelist/subdetails; the .ctp settings and state; clearlog, openlog, subscribe, writetolog, tickpub, batchpub, publishalltables, tableschemas, cleartables, createlogfilename, refreshtp, notpconnected, sub; and .u.end. init runs TorQ's load-time statements in order (l.155 .z.pc, l.160 .ctp.upd, l.194 root upd, l.197 .ps.initialise, l.200 startupdepnamecycles, l.203 subscribe, l.206 tableschemas, l.209 batch timer), after wiring di.pubsub, di.subscriptions and .stpps.closesub as TorQ's common-code loading does. The previous module and its integration tests are removed. Deviations from TorQ's text: - .lg.o/.lg.e -> .z.m.log; .proc.procname -> config's procname. - l.155 .dotz.set on .z.pc -> a handlers observer taking only the handle (logs, then exit 0). - l.194 root upd:.ctp.upd -> set[`upd;.ctp.upd]. - l.209 .timer.rep -> timer addjob, period in seconds, TorQ mode 1h = di.timer mode 2. TorQ's timer runs sub-second; di.timer's period is whole seconds, so a pubinterval that is not a whole number of seconds fails init rather than rounding. - the .ctp setting guards stay as written; init applies config values over them. Kept as TorQ has it: a corrupt own log is reported and opened anyway; upd is set only if absent; tpcheckcycles 0W waits for the upstream indefinitely; only .u.end is defined, so a segmented upstream (which sends endofday) never ends the day here; .u.icounts values are one-item lists after an all-syms subscribe. Tests: a real upstream (segmented surface, found through di.torq.servers) and a real downstream: subscribe and schema, tick-by-tick delivery, subdetails, tablelist, .u.end, the own log, batch publish, clearlogonsubscription, a corrupt log, and pubinterval validation. Live: discovery -> segmentedtp -> chainedtp -> a .sub subscriber; data reached the subscriber; .u.end, invoked by hand on the chainedtp (the segmented upstream never sends it), reached the subscriber and rolled the date; stopping the upstream made the chainedtp log and exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…protocol layer End of day follows the rdb/wdb convention: .u.end sends (`endofday;d) to subscribers rather than (`.u.end;d), and root endofday[d] calls .u.end d. This is the one change to the ported legacy text, made on request: there are no legacy subscribers, and the di rdb/wdb only answer endofday (their .u.end alias, @[`.;`.u.end;:;endofday], does not resolve once a .u namespace exists). Temporary compatibility block (between / compat begin and / compat end), so chainedtp sits between the di tickerplant and di rdb/wdb, which speak di.subscriptions' .u.subdetails protocol: - upstream: init calls .ctp.subscribedi[] instead of .ctp.subscribe[] (the only other changed line). Same handle lookup and refreshtp, then di.subscriptions subscribe, then .u.d from the reply. - downstream: root .u.subdetails[tabs;syms] subscribes the caller through .ctp.sub and returns tables/schemas/logfile/rowcount/date. It handles the single-table pair shape. Limits: logfile is ` and rowcount 0 (no replay from chainedtp); .u.icounts starts empty; .sub.SUBSCRIPTIONS is not filled on this path; unknown-table error pairs pass through. chainedtp.md lists the removal steps. Tests: a compat: group with a real di.subscriptions subscriber peer, and a fixture upstream that also answers .u.subdetails. The legacy .sub path is still exercised by an explicit .ctp.subscribe[] row. Test peers answer endofday. 63/63; di.torq 56/56. Verified live on a scratch POC: feed -> tickerplant1 -> chainedtp1 -> rdb1/wdb1 -> hdb/gateway. Counts matched at each hop, and the gateway count equalled rdb plus hdb. A forced endofday on the tickerplant saved the partition into the hdb and reloaded the hdb and rdb. This needs hdb and gateway started before wdb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With createlogfile on, subscribers replay chainedtp's log on connect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h QBIN - di.pubsub init errors unless deps is a dict with log, so .stpps errparse/init/sub always have a logger (a missing log no longer surfaces as a .z.m.log error). - di.torq.proc.tickerplant passes its log to di.pubsub init. - pubsub tests: init with a no-op log; init[] must error. - servers test.csv: the enabled:0b check runs QBIN, not $QHOME/bin/q. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The di.subscriptions subscribe and root .u.subdetails are now the only path, so the tests check them in place of .sub and the old subdetails, the test upstream drops its segmented-tickerplant surface, and the compat labels and the temporary-layer section in chainedtp.md go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt; di.pubsub 0.3.0
segmentedtp is rebuilt from scratch, one to one from TorQ's
code/segmentedtickerplant/{pubsub,sctp,stplog,stpmeta}.q and
code/processes/segmentedtickerplant.q. Each TorQ file is a file of the
same name in the module dir, except stpps.q for segmentedtickerplant/
pubsub.q (its .stpps.upd/.stpps.zts wrappers; the common/pubsub.q it
loads is di.pubsub) and segmentedtp.q for the process file. They load in
TorQ's order from init.q.
Ledger (the only deviations from TorQ's text):
1. .lg.o/.lg.e -> .z.m.log[`info]/[`error].
2. .proc.procname/proctype -> .z.m.procname/proctype.
3. .eodtime.* -> di.eodtime getd/setd/getnextroll/setnextroll/getdailyadj/
getroll. setnextroll returns ::, so dayrollover sets then reads.
di.eodtime differs from eodtime.q only across a DST change (getroll
re-resolves at p+1D; adjtime uses its argument, not .z.p); identical
with GMT settings. The os.q/timezone.q/eodtime.q loads are dropped.
4. .dotz.set of .z.pc/.z.exit -> di.torq.handlers observers (the original
runs last; TorQ's .z.exit replaces rather than chains). .dotz.set of
.z.ts -> direct set around the current .z.ts (di.querylog precedent).
5. schemafile from config via system "l " with TorQ's trap and exit 1;
customcsv is a setting (default null); kdbtplog keeps getenv`KDBTPLOG.
6. Load-time statements that read settings (stplog.q parent replaylog,
segmentedtickerplant.q multilogperiod and custom csv) run in init after
the settings are applied.
7. .os NT/Fex/pth/md from os.q:3-5,16, defined only if absent, in
stplog.q next to createdld, their only caller (no di.os dependency).
8. Settings: stplg and sctp sections with TorQ's names set onto .stplg/.sctp,
an eodtime section to di.eodtime init, flat createlogs and schemafile.
The segmentedtickerplant settings-file defaults live in stplog.q until
wired. Framework switches (.proc, .usage, .servers.enabled,
.timer.enabled, .hb, .subcut) and .proc.addinitlist are not ported.
9. Descriptive comments trimmed to one line.
10. Root init folded into the module init; the four TorQ lines
(segmentedtickerplant.q:78-87) are unchanged, only their caller moved.
The root setup/loadschemas/generateschemas are called as (`..name)[].
Kept quirks: seq 0 for a fresh day's logs; currperiod::nextperiod in
stpeoperiod; custom tables missing from the csv are not logged; period
replay is distinct flip; chained non-create loghandles becomes a dict of
::; the .z.exit flush only in memorybatch.
End of day/period stay TorQ's (`endofday;date;data) and
(`endofperiod;cur;next;data). di rdb/wdb can't consume segmentedtp until
they move onto .sub, and the endofday arity is undecided; both are
tracked for the subscriber-alignment branch. No compat layer.
di.pubsub 0.3.0 adds the rest of common/pubsub.q to the .stpps section,
verbatim bar .lg -> .z.m.log: endp, end, pubclear, attrstrip
(schemasnoattributes), .u.pub, .ps.subtable, .ps.subtablefiltered, .ds.*.
pubsub, chainedtp and tickerplant still pass.
Tests: five peers (defaultbatch/tabperiod, immediate/singular,
memorybatch/tabular, chained create, chained parent), the test process
subscribing through .sub.subscribe. Peers bind an OS-chosen port and write
it to a file (fixed ports clashed with TIME_WAIT). 66/66 on ten
consecutive runs in the development tree.
Based on feature-chainedtp, which carries the dependencies: di.pubsub (the
.stpps base, with log required at init; this commit adds only the Phase B
increment), di.subscriptions 0.2.0 (.sub), di.torq.servers 0.5.0
(startupdepnamecycles). On this base: segmentedtp 66/66 (x2), pubsub 121/121,
chainedtp 65/65, tickerplant 33/33, di.torq 57/57.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bwrite 0.2.0; di.tplog version tickerlogreplay is a one-to-one port of TorQ's code/processes/tickerlogreplay.q. It replays a plain tickerplant log, or a segmented tickerplant log directory (picked through stpmeta), into an hdb. tickerlogreplay.q holds the module init, then the TorQ helpers it calls that no di module provides, each defined if absent: the .os directory helpers (os.q:3-5,8,16), the .save section (dbwriteutils.q) and .merge.getextrapartitiontype (merge.q:8); then .replay. sort.csv is TorQ's config/sort.csv. Hard deps: di.tplog, di.merge, di.dbwrite. Ledger (the only deviations from TorQ's text): 1. .lg.o/.lg.e/.lg.w -> .z.m.log. 2. .err.ex/.err.exitifnull -> module-local ex/exitifnull: log TorQ's message, exit with TorQ's code. The usage text is not ported. 3. .tplog.check -> di.tplog check. 4. .sort.getsortcsv/sorttab -> di.dbwrite readcsv/sort; .gc.run -> di.dbwrite gc. With no sortcsv, init loads the shipped sort.csv (setconfig) in place of the config/sort.csv lookup. dbwrite rejects null tabname/column rows. 5. .merge.* -> di.merge, passing getextrapartitiontype[t] where TorQ passes the table name; .merge.partsizes -> trackpartition/getpartsizes; mergebybytelimit -> di.merge init config. getextrapartitiontype reads di.dbwrite getconfig[] for .sort.params. 6. .os helpers in the module, each guarded separately; no di.os. 7. .dotz.set of .z.zd -> set. 8. Settings: replay section onto .replay, merge section onto .merge and di.merge init. .replay.upd and the .save hooks are set before use. sortcsv from config. .proc switches not ported. 9. Load-time statements run in init, in TorQ's order: checks, schema load, the two realupd wrappers (fully qualified), sort csv, autoreplay. 10. Comments trimmed to one line. Kept quirks, tested: checklogfiles on a plain log replays <log>.good, whose name has no date, so tables land at the hdb root; the segmented-mode firstmessage/lastmessage check never exits (its .err.ex call has two args). di.dbwrite 0.2.0 exports its existing gc (TorQ's .gc.run); rdb/wdb need >=0.1.0. di.tplog gains a VERSION file and version export (0.1.0) so a deps.toml entry can be checked. di.torq registers tickerlogreplay as a builtin proctype; torq.md's registry example and two stale known-gap notes are corrected. Tests: each replay runs in a fresh q; the fixture writes a plain log and runs a real segmentedtp to write a segmented log directory. 89/89 (x3). dbwrite 165/169 (the four failing rows need kx.log, not installed here), tplog 16/16, merge 226/226, rdb 4/4, wdb 4/4, segmentedtp 66/66, di.torq 57/57. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TorQ's .sub.subscribe becomes the one way to subscribe: it handles every TorQ
tickerplant type by tptype and is the only path with auto-resubscribe.
Subscribers take TorQ's end-of-day entry points, .u.end[d] (classic tickerplant,
chainedtp) and endofday[d;data] plus endofperiod (segmented tickerplant).
- di.pubsub 0.4.0: callendofday sends (`.u.end;d).
- di.torq.proc.tickerplant 0.2.0: TorQ's classic surface (u.q/tickerplant.q),
read by .sub.subscribe: .u.w (table keys; the registry stays in di.pubsub),
.u.i (replaces .z.m.msgcount), .u.icounts, .u.L, .u.d. .u.sub returns
(table;schema), one pair per table for `, and flushes first in batched mode.
Needs di.pubsub 0.4.0.
- di.torq.proc.chainedtp 0.3.0: back to TorQ's text: .ctp.subscribe on
.sub.getsubscriptionhandles/.sub.subscribe, root subdetails restored
(chainedtp.q:10-14), .u.end sends (`.u.end;d) (chainedtp.q:188); the root
endofday bridge is removed. .u.subdetails stays until the old path is retired.
- di.torq.proc.rdb 0.4.0 / di.torq.proc.wdb 0.3.0, targeted lines only:
1. subscribe: .sub.subscribe[...;first .sub.getsubscriptionhandles[tpt;`;()!()]]
(TorQ rdb.q:163-169) replaces gethandlebytype + di subscribe; sd`date -> sd`d.
2. set[`.u.end;endofday] replaces @[`.;`.u.end;:;endofday], which made a root
key named .u.end.
3. root endofday:{[d;x] endofday d} feeds the existing one-argument logic.
4. root endofperiod: TorQ's log stub (rdb/endofperiod.q:2, wdb/writedown.q:52).
Minimums: di.subscriptions 0.2.0, di.torq.servers 0.5.0. No new mock-init suite
for rdb/wdb; the end-to-end run below is their check.
Verified end to end with real processes (a scratch copy of TorqX-POC):
tickerplant -> wdb and tickerplant -> chainedtp -> rdb subscribe via .sub, data
and end of day flow; segmentedtp -> rdb (endofperiod logged, two-argument
endofday saved the partition); with autoreconnect on, killing and restarting the
tickerplant and chainedtp resubscribes wdb and rdb and new trades arrive.
pubsub 121/121, tickerplant 39/39, chainedtp 67/67, subscriptions 45/45,
segmentedtp 66/66, tickerlogreplay 89/89, di.torq 72/72, rdb 4/4, wdb 4/4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r .ps.initialise Under di.torq a segmentedtp broke on its first timer tick: di.torq's .ps.initialise[] runs after the process module's init and registers every root table, currlog included; the defaultbatch timer's pubclear then reset currlog from a missing schemasnoattributes key (an empty copy of the first table), so the loghandles view failed and every update errored with 'handle. TorQ cannot hit this: segmentedtickerplant.q:90 queues its init with .proc.addinitlist, and torq.q runs the list (697) after .ps.initialise (671), so generateschemas always registers last. Confirmed against a real TorQ stp1 with FSP config: .stpps.t excludes currlog and currlog survives timer ticks. segmentedtickerplant.q is TorQ's only addinitlist user. - di.torq: .proc.initlist / .proc.addinitlist (torq.q:10-12), run after .ps.initialise and connections, then emptied (torq.q:693-697). Test rows: a queued function runs once; the list is emptied. - di.torq.proc.segmentedtp: queues generateschemas to run again under di.torq (guarded, so a direct start is unchanged). Ledger: one step re-run rather than TorQ's whole deferred init. Verified with segmentedtp started by torqx.sh: .stpps.t is the schema tables, currlog survives the timer, updates log, and a .sub rdb receives them. di.torq 74/74, segmentedtp 66/66. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- builtin `segmentedchainedtp -> di.torq.proc.segmentedtp: TorQ runs the chained
segmented tickerplant as its own proctype (segmentedchainedtickerplant,
-parentproctype segmentedtickerplant) so subscribers select it by type; di.torq
has no parentproctype tier, so it is a second builtin key for the same module.
- settings/segmentedchainedtp.q from TorQ config/settings/segmentedchainedtickerplant.q:
createlogs 0b; sctp section (chainedtp 1b, loggingmode none, tickerplantname stp1,
subscribeto/subscribesyms `, replay 0b, schema 1b); connections segmentedtp; the
clients/zpsignore lines of segmentedtp.q. .proc/.timer/.subcut switches not ported.
- torqx.sh: TorQ torq.sh's optional startwithall column (torq.sh:172-173); a bare
start / start all skips rows with 0, a row can still be started by name. Files
without the column behave as before; di.torq's ("SISS") process.csv read ignores it.
- torq.md notes; test row: the builtin map resolves segmentedchainedtp.
Verified in TorqX-POC (stp1 -> wdb1, stp1 -> sctp1 -> rdb1). di.torq 75/75,
segmentedtp 66/66.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A non-chained segmentedtp failed di.torq's post-load depcheck on every start
("di.subscriptions requires minimum version 0.2.0, not found"): deps.toml declares
di.subscriptions, but only .sctp.init (chained) loaded it. The raise at the end of
di.torq.init skipped runhook and left torqx_init.q's result unset (INITFAILED);
the process otherwise ran.
TorQ loads common/subscriptions.q in every process, the STP included, registering
.sub.pc on .z.pc and the checksubscriptions timer at load (subscriptions.q:168-172).
So init now calls di.subscriptions' init unconditionally, moved from .sctp.init.
Loading without init is not enough: di.subscriptions' own manifest declares
di.tplogmgr, which only its init loads. .z.m.deps (read only by the moved line)
dropped; segmentedtp.md init steps updated.
Verified: segmentedtp 66/66; qlint findings unchanged on both files; scratch stack
(clone + these files) cold start, sctp1 restart, and stp1 -> sctp1 restart all
depcheck-clean with resubscribe and data flow; live TorqX-POC stp1 now sets result.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…kerlogreplay TOML has no symbol or timespan type, so settings these modules use as symbols, paths or timespans could only live in .q files. Each module now converts the string form straight after init loads its section: - di.torq.servers (0.5.0 -> 0.6.0): retry and discoveryretry from a timespan, a "0D00:00:10" string or a number of seconds. - di.torq.proc.chainedtp: pubinterval the same way; logdir from a path string. - di.torq.proc.segmentedtp: sctp loggingmode, tickerplantname, subscribeto and subscribesyms from strings (subscribesyms also a list of strings). - di.torq.proc.tickerlogreplay: replay schemafile, hdbdir and tplogdir from strings. The servers and chainedtp halves are c95ce2f from feature-torqx-poc-demo (its servers half was ported in f6788a9 and reverted in 55caea0 as out of scope then). TorqX-POC main already relies on them (4979217). The segmentedtp parent-mode test peer now runs on string settings. Suites: servers 56/56, chainedtp 69/69, segmentedtp 67/67, tickerlogreplay 92/92, di.torq 75/75. Verified on a scratch TorqX-POC stack with every affected setting in .toml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…replay.<key> TorQ's tickerlogreplay is run with its settings on the command line (-.replay.tplogdir, -.replay.hdbdir, ...). Under di.torq those were silently skipped: di.torq.config's override layer only matched top-level settings, and tickerlogreplay's settings live in a replay section. - di.torq.config 0.1.0 -> 0.2.0: overrideconfig also takes a .section.key (or section.key) name for a key already in a dict-valued section, parsed by the same rules as a top-level setting. Top-level matching is unchanged. Internal helper settingpath; 4 test rows. - di/torq/settings/tickerlogreplay.q (new): a replay section declaring every basic-typed default, so each is overridable; a tickerlogreplay test checks it agrees with the module's defaults. - di.torq.proc.tickerlogreplay: string conversion covers every symbol setting (tplogfile, tablelist, partitiontype, sortcsv, tempdir, mergemethod as well), tablelist always a list, so a .toml replay section can carry them and a string override works. The usage text (-.replay.usage) is still not ported. An app replay section replaces the builtin one, so the app lists every key it wants overridable. Suites: tickerlogreplay 93/93, di.torq 75/75, di.torq.config new rows pass (run with private fixture paths: its /tmp/diconfigbuiltin is owned by another user here; the 8 kx.log rows fail the same on the previous commit, kx.log not installed). Scratch TorqX-POC: three replays driven only by -.replay.* switches, counts matching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The segmented-mode check called ex[id;message] with two of its three arguments, which only builds a projection: nothing was logged and init carried on, the trailing ;1 a dead statement. Segmented mode replays every log file with the same firstmessage/lastmessage, so a range such as -.replay.firstmessage 1000 silently skipped the first 1000 messages of every hourly segment. The exit code now goes inside the call, so init logs the reason and exits 1, like the checks around it. Deviation from TorQ: its code/processes/tickerlogreplay.q:94 has the same two-argument .err.ex call and never fires; the port copied it deliberately (feac8ab) and is now fixed instead. Tests: the row asserting no exit now expects exit 1; a lastmessage row and a logged-reason row added. tickerlogreplay 95/95; qlint unchanged; scratch run with -.replay.firstmessage 5 exits with the error, a default run still replays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…i.merge segmentedtp and tickerlogreplay: - Remove every \d. Namespace members are written in full (.stplg, .sctp, .stpm, .replay, .save). Names that subscribers and the framework reach at root (upd, tptype, subdetails, tablelist, currlog, createlogs, setup, loadschemas, generateschemas) are published with @[`.;...]. loghandles stays a root view. - Remove the .os helpers. Call sites run mkdir -p / rm -r directly. di.merge 0.2.0: - Add getextrapartitiontype[sortconfig;tablename]. In TorQ it lives in code/common/merge.q and reads .sort.params; here the caller passes the sort config in, so di.merge still reads no sort config itself. - Add getmergebybytelimit[] and getpartlimit[]. tickerlogreplay calls these through .z.m.merge, no longer writes .merge.*, and requires di.merge 0.2.0. Settings: - settings/segmentedtp.q declares the stplg defaults (except kdbtplog, which comes from the environment) and the sctp defaults, so -.stplg.<key> and -.sctp.<key> overrides now apply. - settings/tickerlogreplay.q declares the merge section. - The module defaults stay as fallbacks. New test rows assert that each settings section agrees with the module. Tests: di.merge 238, segmentedtp 69, tickerlogreplay 95, all pass. Scratch stack run: stp1 -> sctp1 -> rdb1 with data flowing; -.stplg.multilog tabular takes effect; a segmented clean + partandmerge replay matches the logged counts, with p# on sym. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- #141 (toml retry/pubinterval): already carried here; keep this branch's versions, plus main's servers.md wording. - torq.q builtin dict: main's sort/sortworker plus tickerlogreplay/segmentedchainedtp. - wdb.q: main's full port, with this branch's subscription path reapplied: .sub.subscribe via .sub.getsubscriptionhandles, fixpartition on sd`d (skipped on re-init, when .sub.subscribe returns ()), root endofday dyadic for the segmented tickerplant, triadic endofperiod stub, .u.end unchanged. - wdb tests: fake tickerplant answers as a segmented one, found through a real di.torq.servers; config merges settings/default.q; freshwdb clears .sub.SUBSCRIPTIONS; end of day driven through .u.end; endofperiodstub sends three arguments. No expected values changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DIReview Summary1 critical | 5 warning(s) | 3 suggestion(s)
Suggestions
|
There was a problem hiding this comment.
The namespace changes looks good, the comments also helped me to understand what changed, test cases all pass without issues too.
I asked Claude to help review this as well and got the below
- The stplg_customcsv default silently changed — custom multilog mode is broken out of the box.
This is the author's own flagged risk, and it did happen.
Legacy:
customcsv:hsym first .proc.getconfigfile["stpcustom.csv"]
PR settings/segmentedtp.q:10 sets it to the null symbol instead.
Traced and reproduced:
multilog = custom, customcsv =
-> segmentedtp.q:48 0: on the null symbol fails; error logged and swallowed
-> .stplg.custommode never defined
-> stplg.q:156 key .stplg.custommode -> 'THROWS: .stplg.custommode
Any app that sets custom multilog mode without also setting stplg_customcsv dies in init. Either restore a resolved default or validate it in init alongside the other required settings.
-
.os.md replaced by raw system"mkdir -p" (repo-wide question, not a PR defect).
stplog.q:15-16 and tickerlogreplay.q:261 use a raw shell mkdir where legacy used the platform-aware .os.md. Four other production files already do the same (pqx.q:392,413, logroll.q:92, tickerplant.q:178, torq.q:227), so this PR follows the repo's dominant convention — but the repo as a whole has silently dropped Windows directory creation while shipping di/os with a working platform-aware mkdir. Worth settling as a convention rather than patching here. The part that does belong to this PR: neither new call checks whether the mkdir succeeded, so a failure surfaces later as a confusing openlog error. -
The timer dependency is required but never used.
segmentedtp.q:8 hard-errors when the timer dep is missing, but nothing in the module ever calls it — the only deps lookup in the file is for handlers, and .z.m.timer never appears. The only timer work is system"t 1000", raw q.
Same shape as the bug that broke segmentedtp on main: #139 made di.pubsub.init require a deps dict and left the caller passing ::.
-
.u.w is a names-only stub, not the "full classic surface" the description claims.
tickerplant.q:161 sets it once at init to a dict of table names mapped to empty lists, and never maintains it, since di.pubsub owns registration.
Reading just the keys works, which is all subscriptions.q:153 needs. But the values stay empty, so the legacy handle/syms pair structure isn't there — and chainedtp.q:168 does read values to extract handles, which against a classic TP yields nothing. .u.j and .u.jcounts aren't defined at all on the classic TP (chainedtp and sctp define their own). Either maintain .u.w properly or soften the claim. -
tickerlogreplay: the .save guards are dead code.
Lines 87-98 set .save.savedownmanipulation and .save.postreplay only if absent — then lines 104-105 overwrite both unconditionally from the .replay.* equivalents. So a wrapper that pre-sets .save.savedownmanipulation (the extension point legacy's own usage text documents) has it silently discarded; it must set .replay.savedownmanipulation instead. .save.manipulate at line 90 has no later override and does take effect. Legacy had only the 104-105 form, so 87-98 is new and inert. -
rdb lacks the empty-subscribe guard that wdb has.
wdb.q:742 guards the call with a count check, commented "() when re-initialised: already subscribed". rdb.q:137-138 indexes the same result unguarded after the same call, which has the same empty-list return path. -
callendofperiod has an arity mismatch.
pubsub.q:81 sends the message with one argument, while rdb's and wdb's endofperiod are now triadic — applied to one argument a 3-arg function returns a projection whose body never runs. It has zero callers on the branch, so nothing is broken today; the live path is .stpps.endp, which sends three and matches correctly. Fix or delete it before someone wires it up. -
.z.ts is assigned directly in setup.
segmentedtp.q:107 assigns .z.ts by name, while .z.pc and .z.exit go through the injected handlers dep. That is consistent with the architecture — depcheck.q:447 documents that di.torq.handlers deliberately excludes .z.ts, and di.timer assigns it directly too — but it drops legacy's .dotz.getcommand chaining bookkeeping. Worth a comment saying it's deliberate, because it reads like an oversight. -
Four legacy STP settings aren't carried over
Legacy segmentedtickerplant.q disabled the TorQ timer, server tracking, heartbeating and usage logging. The STP owned the process timer outright, which is why stplog.q can safely call system"t 0" at three guard sites (lines 170, 193, 208 — character-identical to legacy 203/227/246).
In the module world segmentedtp requires di.timer, which binds .z.ts for every job in the process, so system"t 0" now stops everything, not just the TP.
- No subscriber-cutoff module exists.
Legacy segmentedchainedtickerplant.q enables .subcut. There is no di.subscribercutoff in the repo at all, so the new segmentedchainedtp proctype has no slow-subscriber protection. Pre-existing gap rather than a regression — flagging it because this PR is what makes that proctype reachable.
I dont think any of them are critical but it would be useful to address them to either ensure they have the same functionality as TorQ / standardised across module / documentation is updated
…cores from settings keys - segmentedtp: store the injected timer and run the batch timer and end checks as the 1s di.timer job stpzts instead of wrapping .z.ts. The end-of-period, end-of-day and more-than-one-day guards disable only that job instead of system"t 0", so other timer jobs (servers retry, subscription checks) keep running. - torqx_init.q: an init error logs "torqx: init failed: ..." and exits 3 rather than leaving a half-started process listening. - Settings keys lose their underscores: clients_* -> clients*, stplg_* -> stplg*, sctp_* -> sctp* (settings files, modules, docs, tests). Old names in app settings or -flag overrides are no longer read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…od, rdb guard - segmentedtp: stplgcustomcsv defaults to appconfig/stpcustom.csv under TORQXAPPHOME (TorQ's app config dir); an unreadable csv fails init with a clear message instead of a later 'custommode. - segmentedtp createdld and tickerlogreplay postreplaymerge make directories through di.os mkdir (TorQ's .os.md); di.os is used, not in deps.toml as it has no VERSION. - tickerlogreplay: drop the .save savedownmanipulation/postreplay guards that were always overwritten from .replay.*; .save.manipulate stays. - rdb: skip the subscribe log line when re-init returns nothing, as wdb does. - pubsub: callendofperiod sends (`endofperiod;currp;nextp;data), as TorQ's endp. - tickerplant: .u.w comment says it holds table names only. - segmentedtp.md: server tracking kept on for discovery; heartbeat/usage off; segmentedchainedtp has no subscriber cutoff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DIReview Summary0 critical | 1 warning(s) | 0 suggestion(s)
|
di.os gets a VERSION (0.1.0) and exports version. segmentedtp, tickerlogreplay, wdb and housekeeping declare it as a hard dependency; housekeeping gains a deps.toml. Drops the notes explaining why it was undeclared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
I checked each point against the code and TorQ, and the changes are in
I've still switched createdld and tickerlogreplay's postreplaymerge to di.os mkdir, to match TorQ's platform-aware .os.md. di.os now has a VERSION (0.1.0), and segmentedtp, tickerlogreplay, wdb and housekeeping list it in deps.toml as a hard dependency, so depcheck verifies it at startup. Their suites and di.os's pass, and a scratch stack started with no dependency-check failures. The other raw mkdirs in the repo (pqx, logroll, tickerplant, torq.q) are work for another PR.
Two related changes are also in
Tests: segmentedtp 76 (+3), pubsub 122 (+1), di.os 201 (+1). tickerlogreplay, rdb, tickerplant, chainedtp, di.torq, wdb and housekeeping are all unchanged and passing. |
|
The changes looks good, i think there's only one outstanding item on the stp side
I believe keeping the timer-job approach and adding the two changes gets you TorQ's behaviour on every row:
|
The stpzts job is added with disableonfail:0b, so an unrelated error in the tick is retried on the next one. The three end guards set .stplg.stopped, which .stpps.zts checks first, instead of calling disablejobs: di.timer's runandschedule writes its copy of the job row back after the run, so those calls never had a lasting effect and the stop only worked through disableonfail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DIReview Summary0 critical | 1 warning(s) | 0 suggestion(s)
|
Thanks, both changes are in (
One thing you should know, which matches TorQ ( Checked this on a scratch stack: a tick that throws keeps the job enabled and data keeps flowing; a guard trip stops the tick for good while the job itself stays enabled. |
Namespace cleanup + segmentedtp/tickerlogreplay rebuild, subscription-path unification
Summary
This branch covers three separate pieces of work that landed together because they touch overlapping modules:
1. di.torq.proc.segmentedtp rebuilt as a one-to-one repackaging of legacy TorQ’s segmented tickerplant, and di.torq.proc.tickerlogreplay added as a new module.
2. Namespace cleanup across di.torq.proc.chainedtp, di.subscriptions, di.pubsub, di.torq.servers, di.clienttracking: \d removed everywhere, every name audited individually against real external callers rather than mechanically converted, so considerably more went module-private.
3. One subscription path: di.torq.proc.rdb/.wdb now subscribe via .sub.subscribe/.sub.getsubscriptionhandles directly (the same path chainedtp and segmentedtp use) instead of di.subscriptions’ own separate wrapper, closing the gap where rdb/wdb couldn’t subscribe to segmentedtp and didn’t auto-resubscribe after a tickerplant restart.
Below is a per-module guide to what changed and why, since this is a 16-module branch, indicating what to check.
Module-by-module
di.torq.proc.segmentedtp
Rebuilt from a heavier draft into a near one-to-one legacy repackaging, split across stplog.q/stpmeta.q/stpps.q/sctp.q matching legacy’s own file layout; settings flattened to stplg_/sctp_-prefixed keys, all hard-required by init. Check: this is the one module worth a real side-by-side against legacy TorQ source rather than a diff skim; whether any flattened setting’s default silently changed from the old in-code defaults.
di.torq.proc.tickerlogreplay (new module)
Ports legacy tickerlogreplay.q, a maintenance/backfill replay utility, not a persistent service. Check: init’s required-settings list matches settings/tickerlogreplay.q exactly; one deliberate deviation from legacy is documented in tickerlogreplay.md rather than silently present - the firstmessage/lastmessage validation’s missing exit code (a real bug inherited from legacy) is fixed here, not preserved; di.merge/di.dbwrite are genuinely called (use’d and invoked), not stubbed.
di.torq.proc.chainedtp
Namespace cleanup (\d removed), tosym added so tickerplantname/subscribeto/subscribesyms accept TOML strings, plus a one-line fix normalising a bare-vs-.z.m.-qualified read in createlogfilename.
di.subscriptions
\d namespacing cleanup; .sub.SUBSCRIPTIONS/bare SUBSCRIPTIONS dual-table handling kept correctly separated; autoreconnect→resubscribe rename (the function clashed with the autoreconnect setting key). This is also where .sub.subscribe/.sub.getsubscriptionhandles (the methods rdb/wdb/chainedtp now call directly) live. Check: no stale caller of the old autoreconnect function name remains; the one real behavior change — a standalone (non-di.torq) caller used to get autoreconnect:1b by default, now must pass it explicitly (di.torq’s own callers already pass 0b, unaffected).
di.pubsub
\d namespacing cleanup and supporting code from torq's code/segmentedtickerplant/pubsub.q ported over.
di.torq.servers
\d namespacing cleanup
di.clienttracking
\d namespacing cleanup
di.merge
Added getextrapartitiontype (now takes a sort config as a parameter rather than reading .sort.params directly, so the no-di.sort-dependency guarantee holds), plus getmergebybytelimit/getpartlimit getters, relocating logic that tickerlogreplay/segmentedtp had each grown their own local copy of. Check: tickerlogreplay.q genuinely calls these via usedi.merge``
di.dbwrite
Added gc[] (wraps .Q.gc[] with before/after memory-stat logging), 0.1.0→0.2.0 - same relocation story as di.merge. Used by tickerlogreplay
di.tplog
Just a VERSION file and version export added, no behavior change. Lowest-risk item in this PR.
di.torq.proc.rdb
Switched from di.subscriptions’ old wrapper to .sub.subscribe/.sub.getsubscriptionhandles directly; added segmented-aware endofday/endofperiod entry points. Check: this isn’t a module we own, so confirm the diff really is minimal/targeted (it reads that way); that it still subscribes correctly against a classic, non-segmented tickerplant, not just the new segmented path.
di.torq.proc.wdb
Same as rdb: switched to .sub.subscribe directly, added segmented-aware EOD entry points, kept to minimal targeted lines. Check: same points as rdb above.
di.torq.proc.tickerplant
Reworked to expose the full classic .u.i/.u.icounts/.u.L/.u.d/.u.w surface (replacing its own .z.m.msgcount), so .sub.subscribe’s standard-tptype path can subscribe to it the same way it does to chainedtp/segmentedtp. sub also now flushes a batched table before registering a new subscriber. It fixes a double-delivery bug for a subscriber joining mid-batch; anything that depended (even accidentally) on the old double-delivery would now see different data. Check: there’s a test that actually exercises subscribe-during-an-active-batch, not just the steady-state case.
di.torq (torq.q, settings)
New tickerlogreplay/segmentedchainedtp builtin proctypes - the latter deliberately shares segmentedtp’s own settings tier rather than getting its own. New deferred-init mechanism (.proc.addinitlist): a process can register a function to run only after pubsub/connections are initialised, which is what segmentedtp’s currlog-corruption workaround now uses instead of its previous ad hoc fix. Settings files (default.q, segmentedtp.q, tickerplant.q, new tickerlogreplay.q) carry the clienttracking flattening plus tickerlogreplay’s own flat settings. Check: the proctype substitution doesn’t leak (segmentedchainedtp gets segmentedtp’s settings and nothing else); the deferred-init list is a no-op for every proctype that never calls addinitlist, so it shouldn’t silently reorder anything for discovery/rdb/wdb/etc.
di.torq.config
overrideconfig extended to resolve a nested -.section.key CLI override (helps tickerlogreplay running), originally needed for tickerlogreplay’s settings before they were flattened. Check: existing top-level -key overrides still behave identically (should be additive).
torqx.sh
New startwithall column/check so torqx.sh start all can skip a process (used so tickerlogreplay, a one-shot job, doesn’t launch alongside a live stack). Check: backward compatibility - an existing process.csv with no startwithall column at all shouldn’t break findprocno/getfield, since that file is user-maintained, not code this PR controls.
These changes can be tested against the respective feature branch of the POC, feature-segmentedtp-tickerlogreplay - https://github.com/DataIntellectTech/TorqX-POC/tree/feature-segmentedtp-tickerlogreplay
This version of the POC can be merged to main when this PR is approved and merged, and can be used to test these changes in a realistic app setting.