From 28d260910dfe7f6eae7ee225624d925264f0f9dd Mon Sep 17 00:00:00 2001 From: skairulla Date: Wed, 14 May 2025 10:45:51 -0400 Subject: [PATCH 1/4] Update stplog.q When the STP is in memorybatch mode, .z.exit will now update log file with whatever data is in memory during unexpected shutdown. --- code/segmentedtickerplant/stplog.q | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index a6eb92392..e911b1aad 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -283,6 +283,13 @@ init:{[dbname] .dotz.set[`.z.exit;{ if[not x~0i;.lg.e[`stpexit;"Bad exit!"];:()]; .lg.o[`stpexit;"Exiting process"]; + +// Flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch + if[.stplg.batchmode=`memorybatch; + .lg.o[`flushToDisk;"STP shutdown unexpectedly, batchmode = `memorybatch, therefore flushing any remaining data to the on-disk log file"]; + .stplg.zts.memorybatch[]; + .lg.o[`flushToDisk; "Complete!"]]; + // exit before logs are touched if process is an sctp NOT in create mode if[.sctp.chainedtp and not .sctp.loggingmode=`create; :()]; .lg.o[`stpexit;"Closing off log files"]; From 33c93cf3fb37a40eb61957906818b5c3280af039 Mon Sep 17 00:00:00 2001 From: skairulla Date: Wed, 14 May 2025 11:24:55 -0400 Subject: [PATCH 2/4] Update stplog.q Stylistic update based off Jonathon McMurray's comments. --- code/segmentedtickerplant/stplog.q | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index e911b1aad..703e9a4b1 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -286,9 +286,10 @@ init:{[dbname] // Flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch if[.stplg.batchmode=`memorybatch; - .lg.o[`flushToDisk;"STP shutdown unexpectedly, batchmode = `memorybatch, therefore flushing any remaining data to the on-disk log file"]; + .lg.o[`stpexit;"STP shutdown unexpectedly, batchmode = `memorybatch, therefore flushing any remaining data to the on-disk log file"]; .stplg.zts.memorybatch[]; - .lg.o[`flushToDisk; "Complete!"]]; + .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; :()]; From 84c9236405186e24f621590cc593c99b9ced2ab0 Mon Sep 17 00:00:00 2001 From: skairulla Date: Wed, 14 May 2025 11:41:35 -0400 Subject: [PATCH 3/4] Update stplog.q Comment alignment. --- code/segmentedtickerplant/stplog.q | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index 703e9a4b1..8283fcca7 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -284,8 +284,7 @@ init:{[dbname] if[not x~0i;.lg.e[`stpexit;"Bad exit!"];:()]; .lg.o[`stpexit;"Exiting process"]; -// Flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch - if[.stplg.batchmode=`memorybatch; + if[.stplg.batchmode=`memorybatch; // Flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch .lg.o[`stpexit;"STP shutdown unexpectedly, batchmode = `memorybatch, therefore flushing any remaining data to the on-disk log file"]; .stplg.zts.memorybatch[]; .lg.o[`stpexit; "Complete!"] From b9db389d1979213c7e4703c0cf2d6f8195372b45 Mon Sep 17 00:00:00 2001 From: skairulla Date: Thu, 15 May 2025 09:58:59 -0400 Subject: [PATCH 4/4] Update stplog.q Fixing comments to align with the rest of the function. --- code/segmentedtickerplant/stplog.q | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index 8283fcca7..b587c7311 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -284,7 +284,8 @@ init:{[dbname] if[not x~0i;.lg.e[`stpexit;"Bad exit!"];:()]; .lg.o[`stpexit;"Exiting process"]; - if[.stplg.batchmode=`memorybatch; // Flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch + // flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch + if[.stplg.batchmode=`memorybatch; .lg.o[`stpexit;"STP shutdown unexpectedly, batchmode = `memorybatch, therefore flushing any remaining data to the on-disk log file"]; .stplg.zts.memorybatch[]; .lg.o[`stpexit; "Complete!"]