cshannon commented on PR #2233: URL: https://github.com/apache/activemq/pull/2233#issuecomment-5375576437
Here is an example output of this in action. It truncated the file over two GC checks (this has to do with the math and config of max/min free page ratio). According to the logs the first truncation was 5 milliseconds and the second was < 1 milliseconds. There is a 5 second gap because by default KahaDB does a checkpoint every 5 seconds. ``` 026-08-21 17:08:19,219 DEBUG (PageFile) - Beginning PageFile compaction check. 2026-08-21 17:08:19,219 DEBUG (PageFile) - Number of free pages to be deleted: 35917 2026-08-21 17:08:19,219 DEBUG (PageFile) - Disk size of end of file free pages: 147116032 2026-08-21 17:08:19,220 DEBUG (PageFile) - Truncating page file to length: 16961536 2026-08-21 17:08:19,224 DEBUG (PageFile) - Page file was compacted, new length: 16961536, old length:164077568 2026-08-21 17:08:19,224 DEBUG (PageFile) - New page count: 4140, free page count: 4006 2026-08-21 17:08:24,229 DEBUG (PageFile) - Beginning PageFile compaction check. 2026-08-21 17:08:24,229 DEBUG (PageFile) - Number of free pages to be deleted: 2555 2026-08-21 17:08:24,229 DEBUG (PageFile) - Disk size of end of file free pages: 10465280 2026-08-21 17:08:24,229 DEBUG (PageFile) - Truncating page file to length: 6496256 2026-08-21 17:08:24,229 DEBUG (PageFile) - Page file was compacted, new length: 6496256, old length:16961536 2026-08-21 17:08:24,229 DEBUG (PageFile) - New page count: 1585, free page count: 1451 ``` Here is the before and after with how much data was saved for the index file. This was an extreme example because I purposely created a large backlog without any new metadata (like destinations) added to prevent truncation just to illustrate the potential: **KahaDB dir before truncation:** ``` -rw-rw----. 1 user user 16M Aug 21 17:08 db-409.log -rw-rw----. 1 user user 157M Aug 21 17:08 db.data -rw-rw----. 1 user user 3.2M Aug 21 17:08 db.redo -rw-rw----. 1 user user 8 Aug 21 17:08 lock ``` **KahaDB dir after truncation:** ``` -rw-rw----. 1 user user 16M Aug 21 17:08 db-409.log -rw-rw----. 1 user user 6.2M Aug 21 17:08 db.data -rw-rw----. 1 user user 3.2M Aug 21 17:08 db.redo -rw-rw----. 1 user user 8 Aug 21 17:08 lock ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
