Community edition datastore garbage collection

47 views
Skip to first unread message

Patrik Pahulák

unread,
Jan 23, 2024, 7:31:05 AM1/23/24
to Magnolia User Mailing List
Hello,  some time ago a colleague of mine deleted a bunch of data via admin central - the database did not seem to really care about that and as such I have tried to implement datastore garbage collection according to jackrabbit docs and this bug. I am running this inside of a cron job scheduled via the scheduler module. The code itself does not return any errors or whatever, but it does not seem to be cleaning my workspaces since the database stays the same size.
Is there anything that I'm not doing right? 
Session magnoliaSession, unwrappedSession;
SessionImpl sessionImpl;
GarbageCollector gc;
for (String workspaceName : collectableWorkspaces) {
  magnoliaSession = MgnlContext.getJCRSession(workspaceName);
  unwrappedSession = unwrapSession(magnoliaSession);
  sessionImpl = (SessionImpl) unwrappedSession;
  gc = sessionImpl.createDataStoreGarbageCollector();
  try {
    gc.mark();
    gc.sweep();
  } finally {
    gc.close();
  }
}
private Session unwrapSession(Session session) {
while (session instanceof DelegateSessionWrapper) {
  session = ((DelegateSessionWrapper) session).getWrappedSession();
}
return session;
}
I am using Magnolia 6.2.40

Patrik Pahulák

unread,
Jan 24, 2024, 6:23:40 AM1/24/24
to Magnolia User Mailing List, Patrik Pahulák
EDIT
Forgot to mention that we are using Postgre v 15 as our database with Postgre v42.6.0 jdbc driver. After playing around on a local db on my machine, I've found out that running "VACUUM FULL;" inside of a script AFTER running the previously submitted code does (tried before and after) free up space in the db.
Does anyone have any idea why the space isn't freed up after just running the gc? What could be the cause of the db holding on to the data?

Dominik Maslanka

unread,
Jan 24, 2024, 8:16:04 AM1/24/24
to user...@magnolia-cms.com, Patrik Pahulák
Hi Patrik,
Thanks for your message. I checked with the development team and from our observation it seems that you identified two different (although related to each other) challenges: the java memory/heap "in use" and the space used by the database. Based on the input you have provided and context, our recommendation would be to start with reviewing your postgresql settings to adjust the autovacuum feature. Here you have example of config where you could generate settings that are fitting to your context: https://chat.openai.com/share/c98b7f17-4897-4565-915a-f5c4077dec9f  Before trying to adjust autovacuum feature, I would suggest raising a Support request ticket on Jira to be able to have dedicated and faster support to look into the challenge you're having.

Best regards,

Dominik Maslanka

--
You received this message because you are subscribed to the Google Groups "Magnolia User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to user-list+...@magnolia-cms.com.
To view this discussion on the web, visit https://groups.google.com/a/magnolia-cms.com/d/msgid/user-list/1e58de7c-8274-45ee-bc5e-d4ce91bad0d0n%40magnolia-cms.com.


--
Best regards,

Dominik Maslanka Product Manager
Mobile: +48668602265 dominik....@magnolia-cms.com
facebook twitter gplus youtube linkedin blog

Magnolia
Oslo-Strasse 2, 4142 Münchenstein (Basel), Switzerland
Office: +41 61 228 90 00 www.magnolia-cms.com


Reply all
Reply to author
Forward
0 new messages