-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow to configure HSQLDB DEFRAG value #8064
base: main
Are you sure you want to change the base?
Conversation
sjames-au
commented
Sep 8, 2023
- Added 'defrag' database param
- Proposes a default of 90%
- Added GUI for setting percentage
- read, update and initialize setting
- requires session restart for change to take effect
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.
This would definitely be easier to review if all the unnecessary formatting changes were suppressed 😉
zap/src/main/java/org/parosproxy/paros/extension/option/DatabaseParam.java
Outdated
Show resolved
Hide resolved
zap/src/main/java/org/parosproxy/paros/extension/option/DatabaseParam.java
Outdated
Show resolved
Hide resolved
zap/src/main/java/org/parosproxy/paros/extension/option/OptionsDatabasePanel.java
Show resolved
Hide resolved
To address the DCO requirement you'll need to sign-off the commit(s): |
ee2f5e3
to
3e50184
Compare
* Added 'defrag' database param * Proposes a default of 90% * Added GUI for setting percentage between 0 and 90 * read, update and initialize setting * Apply defrag on database connection start * requires session restart for change to take effect Signed-off-by: Stewart James <8992773+stootles@users.noreply.github.com>
3e50184
to
9cc892c
Compare
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.
Thanks that's much easier to review now. I think it's largely good, I want to pull the branch and see what the UI and tooltip look like. I'll try to do that tomorrow.
Thank you, your calm approach to my mess helped me dive in further. I still have a decision point stuck in my head on the "default" position for this; while the DB software defaults to zero they hint that this should be between 30 and 60, 30 would help keep the file size smallish and zap has a max file size of 128Gb. I pitched 90% simply because it seemed as close to the current default of never defrag (though zero is still a viable option). Also as a random contributor, while I happy to raise this as a decision point, I am not the right person to make such a choice. If it is purely a me call, I would probably default to 0 just so it is aligned with what has been the zaps history. |
I need to read about this option/feature. If zero is off and also close to 90 then what's 30? If the suggestion is 30 to 60 then 45 seems logical 🤷♂️ |
from: http://www.hsqldb.org/doc/2.0/guide/management-chapt.html set files defrag statement ::= SET FILES DEFRAG Sets the threshold for performing a DEFRAG during a checkpoint. The is the percentage of abandoned space in the *.data file. When a CHECKPOINT is performed either as a result of the .log file reaching the limit set by SET FILES LOG SIZE m, or by the user issuing a CHECKPOINT command, the amount of space abandoned since the database was opened is checked and if it is larger than the specified percentage, a CHECKPOINT DEFRAG is performed instead of a CHECKPOINT. As the DEFRAG operation uses a lot of memory and takes a long time with large databases, setting the threshold well above zero is suitable for databases that are around than 500 MB or more. The default is 0, which indicates no DEFRAG. Useful values are between 30 to 60. Only a user with the DBA role can execute this statement. This is equivalent to the connection property hsqldb.defrag_limit. |
In that case I think my original suggestion of 45 is probably a good balance between performance and disk usage. |
That sounds completely reasonable to me. :) I will get that updated :) |
You could wait till tomorrow, others might chime in early Monday. |
Sure. I have a local workaround, so this isnt blocking me from anything and it will be nice to have helped :) I am already dealing with Mondayitis at my location, the weather is nice though. ;) I am a little curious about a code quality issue, specifically, I mirrored/copied others work and have ended up with the default being defined in two locations. OptionsDatabasePanel.jave, which sets default within the spinner and DatabaseParam.java which does the real work. Ideally the default should be defined centrally and just referenced where its needed. If someone could point me to a preferred pattern for that, I would be happy to incorporate it into this change :) |