-
Notifications
You must be signed in to change notification settings - Fork 82
Sync reload #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Sync reload #577
Changes from all commits
4cce806
e4728c0
c7f2c7e
e827a55
ebce23d
f930bac
c91eb32
c5e5600
6f62e2b
c46d052
1ffac1b
ee9bcad
8d96210
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,28 @@ | ||
| // reload function | ||
| reload:{ | ||
| if[.z.w in key .hdb.reloadcalls; | ||
| .hdb.reloadcalls[.z.w]:1b; | ||
| $[not all .hdb.reloadcalls; | ||
| {.lg.o[`reload;"reload call received from handle ", string[.z.w], "; reload calls pending from handles ", ", "sv string where not .hdb.reloadcalls]; :(::)}[]; | ||
| .lg.o[`reload;"reload call received from handle ", string[.z.w], "; no more reload calls pending"]; | ||
| ] | ||
| ] | ||
| .lg.o[`reload;"reloading HDB"]; | ||
| @[`.hdb.reloadcalls;key .hdb.reloadcalls;:;0b]; | ||
| system"l ."} | ||
|
|
||
| // Get the relevant HDB attributes | ||
| .proc.getattributes:{`date`tables!(@[value;`date;`date$()];tables[])} | ||
|
|
||
| \d .hdb | ||
|
|
||
| // dictionary of handles to reload | ||
| reloadcalls:()!(); | ||
|
|
||
| // function to add handle to reloadcalls dictionary | ||
| po:{[h] if[.proc.proctype in .hdb.connectedProcs;reloadcalls[h]:0b]}; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| .z.po:{[f;x] @[f;x;()];.hdb.po x} @[value;`.z.po;{{}}]; | ||
|
|
||
| // function to remove handle from reloadcalls dictionary | ||
| pc:{[h] reloadcalls _: h; if[(all .hdb.reloadcalls) & count .hdb.reloadcalls;reload[]]}; | ||
| .z.pc:{[f;x] @[f;x;()];.hdb.pc x} @[value;`.z.pc;{{}}]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,9 @@ querykeeptime:0D00:30 // the time to keep queries in the | |
| errorprefix:"error: " // the prefix for clients to look for in error strings | ||
| clearinactivetime:0D01:00 // the time to keep inactive handle data | ||
|
|
||
| // list of process types connected for sync reload | ||
| connectedProcs:() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't use camel case anywhere else in TorQ, so let's not introduce it here please |
||
|
|
||
| \d .kxdash | ||
| enabled:0b // Functionality for parsing and handling kx dashboard queries - disabled by default | ||
|
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think more clear comments are needed in this file - it's not at all clear why numbers of connections should be what they are etc., so it's very unclear what is actually being tested here |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| action,ms,bytes,lang,code,repeat,minver,comment | ||
| beforeany,0,0,q,system "sleep 5",1,,"wait for all procs to go up" | ||
| before,0,0,q,hdbHandle:hopen`::41804:admin:admin,1,,"Get handle to the HDB" | ||
| before,0,0,q,rdb1Handle:hopen`::41802:admin:admin,1,,"Get handle to RDB1" | ||
| before,0,0,q,rdb2Handle:hopen`::41803:admin:admin,1,,"Get handle to RDB2" | ||
| before,0,0,q,wdbHandle:hopen`::41805:admin:admin,1,,"Get handle to WDB" | ||
| before,0,0,q,gwHandle:hopen`::41806:admin:admin,1,,"Get handle to gateway" | ||
|
Comment on lines
+3
to
+7
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hardcoded ports in unit tests isn't ideal - a future developer should be able to run all unit tests in TorQ easily, without having to faff about with configuring base ports or worrying about port collisions etc.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm having some trouble resolving this issue. I've tried getting the baseport from the system variable and then joining it with sv, but this gives `::/41800/:admin:admin. I'm not sure where to go from here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So couple of thoughts -
`$"::",getenv[`BASEPORT],":admin:admin"
|
||
| true,0,0,q,2~count hdbHandle(value;`.hdb.reloadcalls),1,,"check number of connections to the HDB" | ||
| true,0,0,q,1~count rdb1Handle(value;`.rdb.reloadcalls),1,,"check number of connections to RDB1" | ||
| true,0,0,q,1~count rdb2Handle(value;`.rdb.reloadcalls),1,,"check number of connections to RDB12" | ||
| true,0,0,q,1~count gwHandle(value;`.gwreload.reloadcalls),1,,"check number of connections to the gateway" | ||
| run,0,0,q,kill9proc["rdb1"],1,,"shut down rdb1 process" | ||
| run,0,0,q,system "sleep 5",1,,"to ensure rdb1 shuts down" | ||
| true,0,0,q,2~count hdbHandle(value;`.hdb.reloadcalls),1,,"recheck number of connections to the HDB" | ||
| true,0,0,q,1~count rdb2Handle(value;`.rdb.reloadcalls),1,,"recheck number of connections to RDB2" | ||
| run,0,0,q,kill9proc["rdb2"],1,,"shut down rdb2 process" | ||
| run,0,0,q,system "sleep 5",1,,"to ensure rdb2 shuts down" | ||
| true,0,0,q,1~count hdbHandle(value;`.hdb.reloadcalls),1,,"recheck number of connections to the HDB" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| action,ms,bytes,lang,code,repeat,minver,comment | ||
| beforeany,0,0,q,system "sleep 5",1,,"wait for all procs to go up" | ||
| before,0,0,q,hdbHandle:hopen`::41804:admin:admin,1,,"Get handle to the HDB" | ||
| before,0,0,q,rdb1Handle:hopen`::41802:admin:admin,1,,"Get handle to RDB1" | ||
| before,0,0,q,rdb2Handle:hopen`::41803:admin:admin,1,,"Get handle to RDB2" | ||
| before,0,0,q,wdbHandle:hopen`::41805:admin:admin,1,,"Get handle to WDB" | ||
| before,0,0,q,gwHandle:hopen`::41806:admin:admin,1,,"Get handle to gateway" | ||
| true,0,0,q,0=all rdb1Handle(value;`.rdb.reloadcalls),1,,"check rdb1 reloadcalls dictionary" | ||
| true,0,0,q,0=all rdb2Handle(value;`.rdb.reloadcalls),1,,"check rdb2 reloadcalls dictionary" | ||
| true,0,0,q,0=all gwHandle(value;`.gwreload.reloadcalls),1,,"check gateway reloadcalls dictionary" | ||
| true,0,0,q,0=all hdbHandle(value;`.hdb.reloadcalls),1,,"check hdb reloadcalls dictionary" | ||
| run,0,0,q,wdbHandle(`.u.end;.z.d) | ||
| run,0,0,q,system "sleep 5",1,,"wait to allow wdb endofday process to finish running" | ||
| true,0,0,q,1=all rdb1Handle(value;`.rdb.reloadcalls),1,,"check rdb1 reloadcalls dictionary has updated" | ||
| true,0,0,q,0=all rdb2Handle(value;`.rdb.reloadcalls),1,,"check rdb2 reloadcalls dictionary has not updated" | ||
| true,0,0,q,0=all gwHandle(value;`.gwreload.reloadcalls),1,,"check gateway reloadcalls dictionary has updated" | ||
| true,0,0,q,1=sum hdbHandle(value;`.hdb.reloadcalls),1,,"check hdb reloadcalls dictionary has updated" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| host,port,proctype,procname,U,localtime,g,T,w,load,startwithall,extras,qcmd | ||
| localhost,{KDBBASEPORT}+1,discovery,discovery1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/discovery.q,1,, | ||
| localhost,{KDBBASEPORT},segmentedtickerplant,stp1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${TORQAPPHOME}/database.q -tplogdir ${KDBTPLOG}, | ||
| localhost,{KDBBASEPORT}+2,rdb,rdb1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,180,,${KDBCODE}/processes/rdb.q,1,, | ||
| localhost,{KDBBASEPORT}+3,rdb,rdb2,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,180,,${KDBCODE}/processes/rdb.q,1,, | ||
| localhost,{KDBBASEPORT}+4,hdb,hdb1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,60,4000,${KDBHDB},1,, | ||
| localhost,{KDBBASEPORT}+5,wdb,wdb1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,,${KDBCODE}/processes/wdb.q,1,, | ||
| localhost,{KDBBASEPORT}+6,gateway,gateway1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,,4000,${KDBCODE}/processes/gateway.q,1,, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .rdb.hdbtypes:enlist`hdb | ||
| .servers.CONNECTIONS:`gateway`hdb |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Handle command-line arguments | ||
| source $KDBTESTS/flagparse.sh | ||
|
|
||
| # Path to test directory | ||
| testpath=/home/creid/devTorQ/bin/syncreload | ||
CReid98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Start procs | ||
| bin/torq.sh start discovery1 stp1 hdb1 rdb1 rdb2 wdb1 gateway1 -csv ${testpath}/process.csv | ||
|
|
||
| # Start test proc | ||
| /usr/bin/rlwrap q ${TORQHOME}/torq.q \ | ||
| -proctype test -procname test1 \ | ||
| -test ${testpath} \ | ||
| -load ${KDBTESTS}/helperfunctions.q ${testpath}/settings.q \ | ||
| -testresults ${KDBTESTS}/syncreload/results/ \ | ||
| -procfile ${testpath}/process.csv \ | ||
| -runtime $run \ | ||
| $debug $stop $write $quiet | ||
|
|
||
| # Shut down procs | ||
| bin/torq.sh stop discovery1 stp1 hdb1 rdb1 rdb2 wdb1 gateway1 -csv ${testpath}/process.csv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // IPC connection parameters | ||
| .servers.CONNECTIONS:`rdb`segmentedtickerplant; | ||
| .servers.USERPASS:`admin:admin; | ||
|
|
||
| // Paths to process CSV and test STP log directory | ||
| processcsv:getenv[`KDBTESTS],"/syncreload/connections/process.csv"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think less duplication is needed here
or something like this