Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion code/processes/rdb.q
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ notpconnected:{[]

/-resets timeout to 0 before EOD writedown
timeoutreset:{.rdb.timeout:system"T";system"T 0"};
restoretimeout:{system["T ", string .rdb.timeout]};
/-(only where timeoutreset has run: an end of day which the timer above did not prepare, such as one forced on the
/-tickerplant, leaves the timeout as it is, and without the check the end of day stopped here on an undefined variable)
restoretimeout:{if[`timeout in key `.rdb;system["T ", string .rdb.timeout]]};
\d .

/- make sure that the process will make a connection to each of the gateways and hdb types
Expand Down
12 changes: 4 additions & 8 deletions code/processes/wdb.q
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,8 @@ endofdaymerge:{[dir;pt;tablist;mergelimits;hdbsettings;mergemethod;writedownmode
$[tempfix2 and ((system "s")<0);
[.lg.o[`merge;"merging on worker"];
{(neg x)(`.wdb.reloadsymfile;y);(neg x)(::)}[;.Q.dd[hdbsettings `hdbdir;`sym]] each .z.pd[];
/-upsert .merge.partsize data to sort workers, only needed for part and hybrid method
if[(mergemode~`hybrid)or(mergemode~`part);
{(neg x)(upsert;`.merge.partsizes;y);(neg x)(::)}[;.merge.partsizes] each .z.pd[];
];
/-upsert .merge.partsize data to sort workers, whatever the merge method: merge only merges the partitions listed there
{(neg x)(upsert;`.merge.partsizes;y);(neg x)(::)}[;.merge.partsizes] each .z.pd[];
merge[dir;pt;;mergelimits;hdbsettings;mergemethod;writedownmode] peach flip (key tablist;value tablist);
/-clear out in memory table, .merge.partsizes, and call sort worker processes to do the same
.lg.o[`eod;"Delete from partsizes"];
Expand Down Expand Up @@ -513,10 +511,8 @@ informgateway:{[message]
informsortandreload:{[dir;pt;tablist;writedownmode;mergelimits;hdbsettings;mergemethod]
.lg.o[`informsortandreload;"attempting to contact sort process to initiate data ",$[writedownmode~`default;"sort";"merge"]];
$[count sortprocs:.servers.getservers[`proctype;sorttypes;()!();1b;0b];
[if[(mergemode~`hybrid)or(mergemode~`part);
// for part and hybrid method sort procs need access to partsizes table data - upsert data tp sort procs
{(neg x)(upsert;`.merge.partsizes;y);(neg x)(::)}[;.merge.partsizes] each exec w from sortprocs;
];
// sort procs need the partsizes table data whatever the merge method: merge only merges the partitions listed there
[{(neg x)(upsert;`.merge.partsizes;y);(neg x)(::)}[;.merge.partsizes] each exec w from sortprocs;
{.[{neg[y]@x;neg[y][]};(x;y);{.lg.e[`informsortandreload;"unable to run command on sort and reload process"];'x}]}[(`.wdb.endofdaysort;dir;pt;tablist;writedownmode;mergelimits;hdbsettings;mergemethod);] each exec w from sortprocs;
];
[.lg.e[`informsortandreload;"can't connect to the sortandreload - no sortandreload process detected"];
Expand Down
35 changes: 24 additions & 11 deletions code/segmentedtickerplant/stplog.q
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ currlog:([tbl:`symbol$()]logname:`symbol$();handle:`int$())

// View of log file handles for faster lookups
loghandles::exec tbl!handle from currlog
// Re-establish the view above. A chained tickerplant which is not creating logs replaces it with a dictionary of
// no-ops (see init); without this, switching that process to create its own logs opened them but wrote nothing
restoreloghandles:{value "loghandles::exec tbl!handle from currlog"};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this run through value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already done in chainedrecovery testing: it sends that line to the sctp as a string before changing mode.

before,0,0,q,sctpHandle"loghandles::exec tbl!handle from currlog",1,,"resetting loghandles definition for change of mode"

q)currlog:([tbl:`symbol$()]logname:`symbol$();handle:`int$())
q)loghandles::exec tbl!handle from currlog
q)views[]
,`loghandles
q)`..loghandles set `trade`quote!2#enlist(::);      / what init does on an sctp that creates no logs
q)views[]
`symbol$()
q){loghandles::exec tbl!handle from currlog}[];     / the same line inside a function: still not a view
q)views[]
`symbol$()
q){value "loghandles::exec tbl!handle from currlog"}[]
q)views[]
,`loghandles

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably just use set instead of ::?
`loghandles set exec tbl!handle from currlog
Better practice for setting globals and should get around it not setting within the function


\d .stplg

// Name of error log file
errorlogname:@[value;`.stplg.errorlogname;`segmentederrorlogfile]

// Whether this process writes logs of its own: a tickerplant with createlogs on, or a chained tickerplant creating its
// own (loggingmode create). init opens them; dayrollover and .z.exit close them only where init opened them
haslogs:{(value `..createlogs) or .sctp.loggingmode=`create};

// Create stp log directory
// Log structure `:stplogs/date/tabname_time
createdld:{[name;date]
Expand Down Expand Up @@ -184,18 +191,20 @@ endofdaydata:@[value;`.stplg.endofdaydata;{ {`proctype`procname`tables!(.proc.pr
// passes on eop messages to subscribers and rolls logs
endofperiod:{[currentpd;nextpd;data]
.lg.o[`endofperiod;"flushing remaining data to subscribers and clearing tables"];
.stpps.pubclear[.stplg.t];
// the published tables only: pubclear resets a table from the publish schemas, which have no entry for logmsg
.stpps.pubclear[.stpps.t];
.lg.o[`endofperiod;"executing end of period for ",.Q.s1 `currentperiod`nextperiod!(currentpd;nextpd)];
.stpps.endp[currentpd;nextpd;data]; // sends endofperiod message to subscribers
currperiod::nextpd; // increments current period
nextperiod::nextpd+nextpd-currentpd; // and the next one: the SCTP rolls when its parent does
if[.sctp.loggingmode=`create;periodrollover[data]] // logs only rolled if in create mode
};

// stp runs function to send out end of period messages and roll logs
// eop log roll is stopped if eod is also going to be triggered (roll is not stopped in SCTP)
stpeoperiod:{[currentpd;nextpd;data;rolllogs]
.lg.o[`endofperiod;"flushing remaining data to subscribers and clearing tables"];
.stpps.pubclear[.stplg.t];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we double check these changes from .stplg.t to .stpps.t - double confirm the old one is wrong (these feels a bit like something that should've bitten us before now)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.stplg.t is every table in the process except currlog

t::tables[`.]except `currlog;
so it includes logmsg. .stpps.t is the list of published tables, and since #638 it leaves logmsg out (https://github.com/DataIntellectTech/TorQ/pull/638/changes#diff-da8abe6e04ad1dd510c60b90806a4e4c94d7ff7ea63c4622066a87cf7b866297R36). Before #638 the two lists were the same, so these three calls were right when they were written. They have been wrong ever since.

pubclear publishes each table it is given and then resets it from the publish schemas.

pubclear:{
.stpps.pub'[x;value each x,:()];
@[`.;x;:;.stpps.schemasnoattributes[x]];
}
Those schemas have no entry for logmsg, and a dictionary of tables returns an empty copy of its first table for a key it does not have. So at every end of period and end of day the tickerplant's logmsg is replaced by an empty table with the columns of the first published table.

/ after: with PR
q)h:hopen `::6500:admin:admin
q)h"cols logmsg"
`time`sym`proctype`host`loglevel`id`message
q)h".stpps.pubclear[.stpps.t]"
q)h"cols logmsg"
`time`sym`proctype`host`loglevel`id`message
q)h"`logmsg insert (.z.p;`stp1;`segmentedtickerplant;.z.h;`ERR;`test;\"a log message\")"
,0

/ before: master
q)h".stpps.pubclear[.stplg.t]"
q)h"cols logmsg"
`time`sym`src`dest`srcport`destport`seq`ack`win`tsval`tsecr`flags`protocol`length`len`data
q)h"`logmsg insert (.z.p;`stp1;`segmentedtickerplant;.z.h;`ERR;`test;\"a log message\")"
'length
  [0]  h"`logmsg insert (.z.p;`stp1;`segmentedtickerplant;.z.h;`ERR;`test;\"a log message\")"

.stpps.pubclear[.stpps.t];
.lg.o[`stpeoperiod;"passing on endofperiod message to subscribers"];
.stpps.endp[currentpd;nextpd;data]; // sends endofperiod message to subscribers
currperiod::nextperiod; // increments current period
Expand All @@ -215,7 +224,7 @@ periodrollover:{[data]
// common eod for STP and SCTP to send out eod messages and roll logs
endofday:{[date;data]
.lg.o[`endofday;"flushing remaining data to subscribers and clearing tables"];
.stpps.pubclear[.stplg.t];
.stpps.pubclear[.stpps.t];
.lg.o[`endofday;"executing end of day for ",.Q.s1 .eodtime.d];
.stpps.end[date;data]; // sends endofday message to subscribers
dayrollover[data];
Expand All @@ -227,9 +236,12 @@ dayrollover:{[data]
system"t 0";'"next roll is in the past"]; // timer off
getnextendUTC[]; // grabs next end time
.eodtime.d+:1; // increment current day
.stpm.updmeta[multilog][`close;logtabs;(data`p)+.eodtime.dailyadj]; // update meta tables
.stpm.metatable:0#.stpm.metatable;
closelog each logtabs; // close current day logs
// only a process with logs of its own has logs to close: a chained tickerplant in loggingmode none or parent has no
// log directory (.stplg.dldir), and closing failed there before the process was reinitialised
if[haslogs[];
.stpm.updmeta[multilog][`close;logtabs;(data`p)+.eodtime.dailyadj]; // update meta tables
.stpm.metatable:0#.stpm.metatable;
closelog each logtabs]; // close current day logs
init[string .proc.procname]; // reinitialise process
.lg.o[`dayrollover;"end of day complete, new value for date is ",.Q.s1 .eodtime.d];
}
Expand Down Expand Up @@ -258,7 +270,8 @@ init:{[dbname]
i::1;
seqnum::0;

if[(value `..createlogs) or .sctp.loggingmode=`create;
if[haslogs[];
if[.sctp.chainedtp;`.[`restoreloghandles][]];
createdld[dbname;.eodtime.d];
openlog[multilog;dldir;;.z.p+.eodtime.dailyadj]each logtabs;
// If appropriate, roll error log
Expand Down Expand Up @@ -291,9 +304,9 @@ init:{[dbname]
.lg.o[`stpexit; "Complete!"]
];

// exit before logs are touched if process is an sctp NOT in create mode
if[.sctp.chainedtp and not .sctp.loggingmode=`create; :()];
// exit before logs are touched if the process has none (an sctp NOT in create mode, or an stp with createlogs off)
if[not .stplg.haslogs[]; :()];
.lg.o[`stpexit;"Closing off log files"];
.stpm.updmeta[.stplg.multilog][`close;.stpps.t;.z.p];
.stplg.closelog each .stpps.t;
.stpm.updmeta[.stplg.multilog][`close;.stplg.logtabs;.z.p];
.stplg.closelog each .stplg.logtabs;
}]
14 changes: 13 additions & 1 deletion tests/helperfunctions.q
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ isalive:{[proc] any "q" in' @[system;"pgrep -lf ",proc," -u $USER";" "]};

// Have slightly more fluid handle opening mechanic - update: force it to open a new handle each time
gethandle:{[name]
.z.pc exec first w from .servers.SERVERS where procname=name;
.z.pc h:exec first w from .servers.SERVERS where procname=name;
// close the old handle as well: .z.pc only marks it closed, and a process can run out of connections
if[not null h;@[hclose;h;()]];
exec first w from .servers.getservers[`procname;name;()!();1b;1b]
};

// Wait up to 30 seconds for a process to accept a connection, and return its handle (null if it never did): a fixed
// sleep after starting several processes at once is not always long enough
waitforhandle:{[name] t:.z.p+0D00:00:30; while[(null h:gethandle name) and .z.p<t; system "sleep 0.5"]; h};

// Wait up to 30 seconds until a gateway has as many active connections to each server type as given (type!count)
waitforgateway:{[gwh;need] t:.z.p+0D00:00:30;
while[(not all need<=0^(count each group gwh"exec servertype from .gw.servers where active")key need) and .z.p<t;
system "sleep 0.5"];
};
4 changes: 3 additions & 1 deletion tests/merge/tplogreplay/settings.q
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hdbdir:getenv[`KDBTESTS],"/merge/tplogreplay/testhdb"
schemafile:getenv[`KDBTESTS],"/merge/tplogreplay/database.q"
tplogdir:getenv[`KDBTESTS],"/merge/tplogreplay/testlogs"
processfile:getenv[`KDBCODE],"/processes/tickerlogreplay.q"
testconfig:getenv[`KDBTESTS],"/merge/tplogreplay/treplaysettings.q"
testconfig:getenv[`KDBTESTS],"/merge/tplogreplay/tpreplaysettings.q"

// system commands to run tickerlogreplay script with different merge methods
colreplay:{system"q torq.q -debug -load ",processfile," ",testconfig," -.replay.tplogdir ",tplogdir," -.replay.hdbdir ",hdbdir," -.replay.schemafile ", schemafile," -.replay.mergemethod col -proctype tickerlogreplay -procname tplogreplay1"};
Expand All @@ -20,6 +20,8 @@ hybridreplay:{system"q torq.q -debug -load ",processfile," ",testconfig," -.repl
.replay.autoreplay:0b
.replay.tplogdir: `$tplogdir
.replay.hdbdir: `$hdbdir
// the checks look at .replay.tempdir here, so point it at the temp directory tpreplaysettings.q gives the replay
.replay.tempdir:hsym `$tempdir
.replay.schemafile: `$schemafile
//dropping the tables that are not replayed by log files needed to get use function for names of stp logs
.replay.tablestoreplay:3_tables[]
12 changes: 6 additions & 6 deletions tests/merge/wdb/config/process.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ host,port,proctype,procname,U,localtime,g,T,w,load,startwithall,extras,qcmd
localhost,{KDBBASEPORT}+101,discovery,discovery1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/discovery.q,1,,
localhost,{KDBBASEPORT}+100,segmentedtickerplant,stptestpartby,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${KDBTESTS}/merge/wdb//xdaily.q,
localhost,{KDBBASEPORT}+103,hdb,hdb1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,60,4000,${KDBTESTS}/merge/wdb/testhdb,1,,
localhost,{KDBBASEPORT}+104,wdb,wdbcol,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBTESTS}/merge/wdb/mockdata.q,1,,
localhost,{KDBBASEPORT}+105,wdb,wdbhybrid,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBTESTS}/merge/wdb/mockdata.q,1,,
localhost,{KDBBASEPORT}+106,wdb,wdbpart,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBTESTS}/merge/wdb/mockdata.q,1,,
localhost,{KDBBASEPORT}+109,sort,sort1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/config/wdbsettings.q,1,-s -2,
localhost,{KDBBASEPORT}+110,sortworker,sortworker1,,1,1,,,${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/config/wdbsettings.q,1,,
localhost,{KDBBASEPORT}+111,sortworker,sortworker2,,1,1,,,${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/config/wdbsettings.q,1,,
localhost,{KDBBASEPORT}+104,wdb,wdbcol,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/mockdata.q,1,,
localhost,{KDBBASEPORT}+105,wdb,wdbhybrid,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/mockdata.q,1,,
localhost,{KDBBASEPORT}+106,wdb,wdbpart,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBCODE}/processes/wdb.q ${KDBTESTS}/merge/wdb/mockdata.q,1,,
localhost,{KDBBASEPORT}+109,sort,sort1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBCODE}/processes/wdb.q,1,-s -2,
localhost,{KDBBASEPORT}+110,sortworker,sortworker1,,1,1,,,${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBCODE}/processes/wdb.q,1,,
localhost,{KDBBASEPORT}+111,sortworker,sortworker2,,1,1,,,${KDBTESTS}/merge/wdb/config/wdbsettings.q ${KDBCODE}/processes/wdb.q,1,,
6 changes: 6 additions & 0 deletions tests/schemas/database.q
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Schema for this suite: the Starter Pack's three tables and the two _iex tables the checks expect, whatever the application's own schema file defines
quote:([]time:`timestamp$(); sym:`g#`symbol$(); bid:`float$(); ask:`float$(); bsize:`long$(); asize:`long$(); mode:`char$(); ex:`char$(); src:`symbol$())
trade:([]time:`timestamp$(); sym:`g#`symbol$(); price:`float$(); size:`int$(); stop:`boolean$(); cond:`char$(); ex:`char$();side:`symbol$())
packets:([] time:`timestamp$(); sym:`symbol$(); src:`symbol$(); dest:`symbol$(); srcport:`long$(); destport:`long$(); seq:`long$(); ack:`long$(); win:`long$(); tsval:`long$(); tsecr:`long$(); flags:(); protocol:`symbol$(); length:`long$(); len:`long$(); data:())
quote_iex:([]time:`timestamp$(); sym:`g#`symbol$(); bid:`float$(); ask:`float$(); bsize:`long$(); asize:`long$(); mode:`char$(); ex:`char$(); srctime:`timestamp$())
trade_iex:([]time:`timestamp$(); sym:`g#`symbol$(); price:`float$(); size:`int$(); stop:`boolean$(); cond:`char$(); ex:`char$(); srctime:`timestamp$())
6 changes: 3 additions & 3 deletions tests/schemas/process.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
host,port,proctype,procname,U,localtime,g,T,w,load,startwithall,extras,qcmd
localhost,{KDBBASEPORT}+100,discovery,discovery1,,1,0,,,${KDBCODE}/processes/discovery.q,1,,q
localhost,{KDBBASEPORT}+101,segmentedtickerplant,stp1,,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${TORQHOME}/database.q,q
localhost,{KDBBASEPORT}+101,segmentedtickerplant,stp1,,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${KDBTESTS}/schemas/database.q,q
localhost,{KDBBASEPORT}+103,rdb,rdb1,,1,1,180,,${KDBCODE}/processes/rdb.q,1,,q
localhost,{KDBBASEPORT}+104,hdb,hdb1,,1,1,180,,${TORQHOME}/hdb,1,,q
localhost,{KDBBASEPORT}+105,wdb,wdb1,,1,1,180,,${KDBCODE}/processes/wdb.q,1,,q
localhost,{KDBBASEPORT}+104,hdb,hdb1,,1,1,180,,${KDBTESTS}/schemas/temphdb,1,,q
localhost,{KDBBASEPORT}+105,wdb,wdb1,,1,1,180,,${KDBCODE}/processes/wdb.q,1,-.wdb.savedir ${KDBTESTS}/schemas/tempwdb/ -.wdb.hdbdir ${KDBTESTS}/schemas/temphdb/,q
8 changes: 8 additions & 0 deletions tests/schemas/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ source $KDBTESTS/flagparse.sh
#path to test directory
testpath=${KDBTESTS}/schemas

#the suite writes its own HDB: the Starter Pack's sample HDB has partitions without the suite's tables
rm -rf ${testpath}/temphdb ${testpath}/tempwdb; mkdir -p ${testpath}/temphdb

#start procs
${TORQHOME}/torq.sh start discovery1 rdb1 stp1 hdb1 wdb1 -csv ${testpath}/process.csv
${TORQHOME}/torq.sh summary -csv ${testpath}/process.csv
Expand All @@ -18,6 +21,8 @@ ${TORQHOME}/torq.sh summary -csv ${testpath}/process.csv
-procfile ${testpath}/process.csv -quiet

${TORQHOME}/torq.sh stop all -csv ${testpath}/process.csv
#wait until they have stopped (10 seconds at most): torq.sh start skips a process that is still running
for i in $(seq 50); do ${TORQHOME}/torq.sh summary -csv ${testpath}/process.csv | grep -q " up " || break; sleep 0.2; done

# Do the tests
#start procs
Expand All @@ -32,3 +37,6 @@ ${TORQHOME}/torq.sh start discovery1 rdb1 stp1 hdb1 wdb1 -csv ${testpath}/proces

#Shut down procs
${TORQHOME}/torq.sh stop all -csv ${testpath}/process.csv

#Remove the HDB and WDB data the suite wrote
rm -rf ${testpath}/temphdb ${testpath}/tempwdb
1 change: 1 addition & 0 deletions tests/stp/batching/defbatch.csv
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ run,0,0,q,![-11;] each logs,1,,"Replay logs locally"
true,0,0,q,(l1+11)~l2:count trade,1,,"Check logs contain both batches"
true,0,0,q,(c1+10)~c2:rdbHandle"count trade",1,,"Check first batch was successfully replayed from log"
run,0,0,q,stpHandle".z.ts[]",1,,"Resume publication"
run,0,0,q,system "sleep 1",1,,"Give data a chance to publish"
true,0,0,q,(c2+1)~rdbHandle"count trade",1,,"Check second batch gets published"
after,0,0,q,delete from `trade,1,,"Clear local trade table"
2 changes: 1 addition & 1 deletion tests/stp/chainedeod/eodroutine.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ true,0,0,q,1=counttplogs[`stptest1],1,,"Should be 1 log directory for STP"
true,0,0,q,1=counttplogs[`sctptest1],1,,"Should be 1 log directory for SCTP"
run,0,0,q,now:.z.p,1,,"Get current time"
run,0,0,q,data:stpHandle".stplg.endofdaydata[]",1,,"get data"
run,0,0,q,"stpHandle(`.stplg.stpeod;.eodtime.d;data,(enlist `p)!enlist now)",1,,"Run EoD function on STP"
run,0,0,q,"stpHandle(`.stplg.endofday;.eodtime.d;data,(enlist `p)!enlist now)",1,,"Run EoD function on STP"
true,0,0,q,all 0 = sctpHandle"count each `. .stpps.t",1,,"Check tables have been flushed"
run,0,0,q,meta2:get .Q.dd[sctpDir1;`stpmeta],1,,"Get meta table from disk"
run,0,0,q,stpEod2:stpHandle".eodtime.d",1,,"Get new date on STP"
Expand Down
4 changes: 2 additions & 2 deletions tests/stp/chainedeod/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ ${TORQHOME}/torq.sh start discovery1 stptest1 sctptest1 rdb1 -csv ${testpath}/pr
-proctype test -procname test1 \
-test ${testpath} \
-load ${KDBTESTS}/helperfunctions.q ${testpath}/settings.q \
-results ${KDBTESTS}/stp/results/ \
-testresults ${KDBTESTS}/stp/results/ \
-procfile ${testpath}/process.csv \
-runtime $run \
$debug $stop $quiet
$debug $stop $write $quiet

# Shut down procs
${TORQHOME}/torq.sh stop discovery1 stptest1 sctptest1 rdb1 -csv ${testpath}/process.csv
4 changes: 2 additions & 2 deletions tests/stp/chainedeodlognone/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ ${TORQHOME}/torq.sh start discovery1 stptest1 sctptest1 rdb1 -csv ${testpath}/pr
-proctype test -procname test1 \
-test ${testpath} \
-load ${KDBTESTS}/helperfunctions.q ${testpath}/settings.q \
-results ${KDBTESTS}/stp/results/ \
-testresults ${KDBTESTS}/stp/results/ \
-procfile ${testpath}/process.csv \
-runtime $run \
$debug $stop $quiet
$debug $stop $write $quiet

# Shut down procs
${TORQHOME}/torq.sh stop discovery1 stptest1 sctptest1 rdb1 -csv ${testpath}/process.csv
4 changes: 3 additions & 1 deletion tests/stp/chainedeodlognone/sctplognone.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ before,0,0,q,sctpEod1:sctpHandle".eodtime.d",1,,"Get initial date on SCTP"
before,0,0,q,stpDir1:stpHandle".stplg.dldir",1,,"Get initial log directory for STP"
true,0,0,q,@[{x".stplg.dldir";0b};sctpHandle;{1b}],1,,"Make sure log directory for SCTP not defined"
true,0,0,q,all rdbHandle"{count value x} each `trade`quote",1,,"Both trade & quote got records from SCTP"
true,0,0,q,0<sum sctpHandle".stplg.rowcount",1,,"SCTP has counted the first updates"
run,0,0,q,data:stpHandle".stplg.endofdaydata[]",1,,"get data"
true,0,0,q,1=counttplogs[`stptest1],1,,"Should be 1 log directory for STP"
true,0,0,q,0=counttplogs[`sctptest1],1,,"Should be 0 log directories for SCTP"
run,0,0,q,"stpHandle(`.stplg.stpeod;.eodtime.d;data,(enlist `p)!enlist .z.p)",1,,"Run EoD function on STP"
run,0,0,q,"stpHandle(`.stplg.endofday;.eodtime.d;data,(enlist `p)!enlist .z.p)",1,,"Run EoD function on STP"
true,0,0,q,all 0 = sctpHandle"count each `. .stpps.t",1,,"Check tables have been flushed"
run,0,0,q,stpEod2:stpHandle".eodtime.d",1,,"Get new date on STP"
run,0,0,q,sctpEod2:sctpHandle".eodtime.d",1,,"Get new date on SCTP"
Expand All @@ -25,6 +26,7 @@ true,0,0,q,@[{x".stplg.dldir";0b};sctpHandle;{1b}],1,,"Make sure log directory f
true,0,0,q,rdbHandle".tst.eod",1,,"Check EOD was triggered on the sub"
true,0,0,q,stpEod2~stpEod1+1,1,,"Check EOD date has incremented on STP"
true,0,0,q,sctpEod2~sctpEod1+1,1,,"Check EOD date has incremented on SCTP"
true,0,0,q,all 0=raze sctpHandle"(.stplg.msgcount;.stplg.rowcount)",1,,"SCTP's day rollover ran to the end (it reinitialises): its counts start again from 0"
true,0,0,q,2=counttplogs[`stptest1],1,,"Should now be 2 log directories for STP"
true,0,0,q,0=counttplogs[`sctptest1],1,,"Should still be 0 log directories for SCTP"
run,0,0,q,kill9proc["stptest1"],1,,"STP dies"
Expand Down
Loading