-
Notifications
You must be signed in to change notification settings - Fork 86
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 11 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,26 @@ | ||
| // reload function | ||
| reload:{ | ||
|
|
||
| if[.z.w in key .hdb.reloadcalls; | ||
| .hdb.reloadcalls[.z.w]:1b; | ||
| .lg.o[`reload;"reload call received from handle ", string[.z.w], "; reload calls pending from handles ", ", "sv string where not .hdb.reloadcalls]; | ||
|
CReid98 marked this conversation as resolved.
Outdated
|
||
| if[not all .hdb.reloadcalls;:(::)]]; | ||
|
CReid98 marked this conversation as resolved.
Outdated
|
||
| .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[.z.u in `wdb`rdb;reloadcalls[h]:0b]}; | ||
|
CReid98 marked this conversation as resolved.
Outdated
|
||
| .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 |
|---|---|---|
|
|
@@ -114,6 +114,10 @@ endofday:{[date;processdata] | |
| }; | ||
|
|
||
| reload:{[date] | ||
| if[.z.w in key .rdb.reloadcalls; | ||
| .rdb.reloadcalls[.z.w]:1b; | ||
|
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. mix of tabs & spaces on this line, surrounding lines all use just tabs
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 not sure what you mean here. From what I can see it's all just tabs
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. |
||
| .lg.o[`reload;"reload call received from handle ", string[.z.w], "; reload calls pending from handles ", ", "sv string where not .rdb.reloadcalls]; | ||
| if[not all .rdb.reloadcalls;:(::)]]; | ||
|
CReid98 marked this conversation as resolved.
Outdated
|
||
| .lg.o[`reload;"reload command has been called remotely"]; | ||
| /-get all attributes from all tables before they are wiped | ||
| /-get a list of pairs (tablename;columnname!attributes) | ||
|
|
@@ -131,7 +135,19 @@ reload:{[date] | |
| /-restore original timeout back to rdb | ||
| restoretimeout[]; | ||
| .lg.o[`reload;"Finished reloading RDB"]; | ||
| @[`.rdb.reloadcalls; key .rdb.reloadcalls;:;0b]; | ||
| }; | ||
|
|
||
| // dictionary of handles to reload | ||
| reloadcalls:()!(); | ||
|
|
||
| // function to add handle to reloadcalls dictionary | ||
| po:{[h] if[.z.u in `wdb;reloadcalls[h]:0b]}; | ||
| .z.po:{[f;x] @[f;x;()];.rdb.po x} @[value;`.z.po;{{}}]; | ||
|
|
||
| // function to remove handle from reloadcalls dictionary | ||
| pc:{[h] reloadcalls _: h; if[(all .rdb.reloadcalls) & count .rdb.reloadcalls;reload[]]}; | ||
| .z.pc:{[f;x] @[f;x;()];.rdb.pc x} @[value;`.z.pc;{{}}]; | ||
|
|
||
| /-drop date from rdbpartition | ||
| rmdtfromgetpar:{[date] | ||
|
|
||
|
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" | ||
|
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. as with the other test CSV, more clear comments needed - not clear why rdb1 & hdb should be updated after calling .u.end on the wdb, but not rdb2 & gw? |
| 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.
|
||
|
|
||
| # 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"; |

Uh oh!
There was an error while loading. Please reload this page.