Skip to content

Commit 09cfe1d

Browse files
authored
IDB - fixed wdb folder deletion issue on Windows at eod, fixed IDB notification trigger, added getattributes to IDB (#662)
1 parent f83e4d1 commit 09cfe1d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

code/processes/idb.q

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ init:{[]
8787

8888
\d .
8989

90+
// Get the relevant IDB attributes
91+
.proc.getattributes:{`partition`tables!(.idb.currentpartition;tables[])}
92+
9093
.idb.init[];
9194

9295
/- helper function to support queries against the sym column

code/processes/wdb.q

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ savetables:$[writedownmode in partwritemodes;savetablesbypart[;;;;writedownmode]
168168
savetodisk:{[]
169169
changes:savetables[savedir;getpartition[];0b;] each tablelist[];
170170
/- we have to let the idbs know of the changes in the wdbhdb. using filldb[] to make sure it is a db with all the tables
171-
if[any[changes] or writedownmode in `partbyenum`default;filldb[];notifyidbs[`.idb.intradayreload;enlist()]]};
171+
if[any[changes] and writedownmode in `partbyenum`default;filldb[];notifyidbs[`.idb.intradayreload;enlist()]]};
172172

173173
/- send an intraday reload message to idbs:
174174
notifyidbs:{[func;params]
@@ -295,7 +295,7 @@ endofdaysortdate:{[dir;pt;tablist;hdbsettings]
295295
/-sort permitted tables in database
296296
/- sort the table and garbage collect (if enabled)
297297
.lg.o[`sort;"starting to sort data"];
298-
/- .z.pd funciton in finspace will cause an error. Add in this check to skip over the use of .z.pd. This should be temporary and will be removed when issue resolved by AWS.
298+
/- .z.pd function in finspace will cause an error. Add in this check to skip over the use of .z.pd. This should be temporary and will be removed when issue resolved by AWS.
299299
tempfix1:$[.finspace.enabled;0b;count[.z.pd[]]];
300300
$[tempfix1&0>system"s";
301301
[.lg.o[`sort;"sorting on worker sort", string .z.p];
@@ -401,8 +401,9 @@ endofdaymerge:{[dir;pt;tablist;mergelimits;hdbsettings;mergemethod;writedownmode
401401
];
402402
/- if path exists, delete it
403403
if[not () ~ key savedir;
404-
.lg.o[`merge;"deleting temp storage directory"];
405-
.os.deldir .os.pth[string[` sv savedir,`$string[pt]]];
404+
.lg.o[`merge;"attempting to delete temp storage directory"];
405+
dirtodel:.os.pth[string[` sv savedir,`$string[pt]]];
406+
@[.os.deldir;dirtodel;{[x;y].lg.o[`eod;"could not delete directory: ",x," - maybe something(IDB?) gets hold of it."]}[dirtodel;]];
406407
];
407408
/-call the posteod function
408409
.save.postreplay[hdbsettings[`hdbdir];pt];
@@ -550,11 +551,13 @@ replayupd:{[f;t;d]
550551
savetables[savedir;getpartition[];0b;t]]
551552
}[upd];
552553

553-
/ - if there is data in the wdb directory for the partition, if there is remove it before replay
554+
/ - if there is data in the wdb directory for the partition remove it before replay
554555
/ - is only for wdb processes that are saving data to disk
555556
clearwdbdata:{[]
556557
$[saveenabled and not () ~ key wdbpart:.Q.par[savedir;getpartition[];`];
557558
[.lg.o[`deletewdbdata;"removing wdb data (",(delstrg:1_string wdbpart),") prior to log replay"];
559+
/- an error here could happen on Windows(works on Linux) with an IDB setup - if the IDB has a hold of the folder then it cannot be deleted
560+
/- this can be solved by restarting the IDBs as well
558561
@[.os.deldir;delstrg;{[e] .lg.e[`deletewdbdata;"Failed to delete existing wdb data. Error was : ",e];'e }];
559562
.lg.o[`deletewdbdata;"finished removing wdb data prior to log replay"];
560563
];

0 commit comments

Comments
 (0)