feat: prune invalid SSZ objects - #5388
Conversation
Performance Report鉁旓笍 no performance regression detected Full benchmark results
|
|
Hey @wemeetagain, thanks for your comments. I addressed all of them and left a question. |
dapplion
left a comment
There was a problem hiding this comment.
Good start! Main comment about moving code to CLI package
nflaig
left a comment
There was a problem hiding this comment.
Some basic unit tests for this would be good to make sure files are deleted correctly and errors are handled
189dd50 to
d17f200
Compare
|
Redone, now with code in beacon handler only |
| // dev debug option to have access to the BN instance | ||
| if (args.attachToGlobalThis) { | ||
| (globalThis as unknown as {bn: BeaconNode}).bn = node; | ||
| } |
There was a problem hiding this comment.
Added comment and this section of code is getting crowded
d17f200 to
9d800ef
Compare
639c878 to
d1215f2
Compare
| if (stat.isDirectory()) { | ||
| pruneOldFilesInDir(entryPath, maxAgeMs); | ||
| } else if (stat.isFile()) { | ||
| if (Date.now() - stat.mtimeMs > maxAgeMs) { |
There was a problem hiding this comment.
Changed from cTimeMs to mtimeMs as can't manipulate creation time from within Nodejs which makes it hard to test.
I am not sure what is technically more correct. Currently, it should not matter for ssz objects because I would assume those are just written once and not modified.
For more general purpose, I would not consider a file which was just recently modified "old" so might be anyways better to use mTimeMs
17c6fce to
9380aa6
Compare
9380aa6 to
dd671c5
Compare
|
馃帀 This PR is included in v1.9.0 馃帀 |
Motivation
This PR closes #4420. That is, it allows the user to prune old
invalidSszObjectsafter a specified number of days.Description
This PR adds a new CLI hidden option
--persistInvalidSszObjectsRetentiononly applicable tobeaconcommand. It works in conjunction with--chain.persistInvalidSszObjectsand--persistInvalidSszObjectsDir.When
--chain.persistInvalidSszObjectsis enabled, pruning is activated by default. However, you can disable it with--persistInvalidSszObjectsRetention 0If
--persistInvalidSszObjectsRetentionis not specified, the retention period for invalid SSZ objects defaults to 7 days.The application prunes invalid SSZ objects during start up and every hour.
Steps to test or reproduce