Return-Path: X-Original-To: apmail-jackrabbit-users-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6557A11F15 for ; Wed, 27 Aug 2014 07:44:30 +0000 (UTC) Received: (qmail 85457 invoked by uid 500); 27 Aug 2014 07:44:29 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 85400 invoked by uid 500); 27 Aug 2014 07:44:29 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 85389 invoked by uid 99); 27 Aug 2014 07:44:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Aug 2014 07:44:29 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of vikram.vaswani@loudcloudsystems.com designates 134.170.140.117 as permitted sender) Received: from [134.170.140.117] (HELO APAC01-HK1-obe.outbound.protection.outlook.com) (134.170.140.117) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Aug 2014 07:44:01 +0000 Received: from SIXPR04MB319.apcprd04.prod.outlook.com (10.141.120.149) by SIXPR04MB317.apcprd04.prod.outlook.com (10.141.120.147) with Microsoft SMTP Server (TLS) id 15.0.1015.19; Wed, 27 Aug 2014 07:43:55 +0000 Received: from SIXPR04MB319.apcprd04.prod.outlook.com ([10.141.120.149]) by SIXPR04MB319.apcprd04.prod.outlook.com ([10.141.120.149]) with mapi id 15.00.1010.016; Wed, 27 Aug 2014 07:43:55 +0000 From: Vikram Vaswani To: "users@jackrabbit.apache.org" Subject: Problem deleting from DB datastore Thread-Topic: Problem deleting from DB datastore Thread-Index: AQHPwcqmO3Sz0sXmiEGYEC1Abz6seQ== Date: Wed, 27 Aug 2014 07:43:54 +0000 Message-ID: <126e977e977b44efbb9089dc5f97c46a@SIXPR04MB319.apcprd04.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [120.61.212.72] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;UriScan:; x-forefront-prvs: 0316567485 x-forefront-antispam-report: SFV:NSPM;SFS:(10019011)(6009001)(53754006)(199003)(189002)(81342001)(81542001)(85306004)(4396001)(20776003)(64706001)(66066001)(80022001)(74502001)(108616004)(31966008)(74662001)(76482001)(77982001)(79102001)(83072002)(85852003)(90102001)(87936001)(92566001)(76576001)(46102001)(101416001)(86362001)(95666004)(74316001)(105586002)(16236675004)(19627405001)(106356001)(229853001)(106116001)(21056001)(2351001)(107886001)(50986999)(2656002)(83322001)(110136001)(107046002)(54356999)(99396002)(33646002)(19580395003)(2501001);DIR:OUT;SFP:1102;SCL:1;SRVR:SIXPR04MB317;H:SIXPR04MB319.apcprd04.prod.outlook.com;FPR:;MLV:sfv;PTR:InfoNoRecords;A:1;MX:3;LANG:en; Content-Type: multipart/alternative; boundary="_000_126e977e977b44efbb9089dc5f97c46aSIXPR04MB319apcprd04pro_" MIME-Version: 1.0 X-OriginatorOrg: loudcloudsystems.com X-Virus-Checked: Checked by ClamAV on apache.org --_000_126e977e977b44efbb9089dc5f97c46aSIXPR04MB319apcprd04pro_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all I have a Jackrabbit 2.8.0 setup and am using MySQL as the backend for the d= ata store, versioning etc. Our repository is quite active with 100+ documen= ts being added daily. When a new document is added, I can see that a new re= cord is also added to the datastore table in MySQL I am trying to find a way to have Jackrabbit automatically delete unused (r= elating to deleted content) records from the datastore table. I have read a= bout Jackrabbit's garbage collection and I created a servlet to try and use= this. Despite my best efforts however, when I run the servlet code there is no re= moval of records from the datastore table, even though I know for a fact th= at there are a high number of records referencing previously-deleted docs. My servlet code is below, runs on Tomcat, please could you help me identify= what I might be doing wrong? @WebServlet("/GCServlet") public class GCServlet extends HttpServlet { private static org.apache.log4j.Logger logger =3D org.apache.log4j.Logg= er.getLogger(GCServlet.class); private static final long serialVersionUID =3D 1L; private List repositoryManagers; /** * @see HttpServlet#HttpServlet() */ public GCServlet() { super(); // TODO Auto-generated constructor stub } /** * Runs the garbage collector for the given RepositoryManagers. If mult= iple * repositories use the same data store, give all RepositoryManagers in= the * parameter list. * * @param rms * @throws RepositoryException */ @SuppressWarnings(value=3D"DM_GC") private int runDataStoreGarbageCollector(OutputStream out) throws RepositoryException { int result =3D 0; JackrabbitRepositoryFactory rf =3D new RepositoryFactoryImpl(); Properties prop =3D new Properties(); ServletContext servletContext =3D getServletContext(); String path =3D servletContext.getRealPath("."); System.out.println("Real Path =3D>"+path); prop.setProperty("org.apache.jackrabbit.repository.home", "/opt/jac= krabbit"); prop.setProperty("org.apache.jackrabbit.repository.conf", "/opt/ja= ckrabbit/repository.xml"); JackrabbitRepository rep =3D (JackrabbitRepository) rf.getRepositor= y(prop); // need to login to start the repository Session session =3D rep.login(new SimpleCredentials("admin", "admin= ".toCharArray())); RepositoryManager rm =3D rf.getRepositoryManager(rep); DataStoreGarbageCollector gc =3D rm.createDataStoreGarbageCollector= (); try { gc.mark(); gc.sweep(); } finally { gc.close(); } session.logout(); rm.stop(); return result; } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletRespon= se response) */ protected void doGet(HttpServletRequest request, HttpServletResponse re= sponse) throws ServletException, IOException { String gcEnabled =3D request.getParameter("gcExecute"); System.out.println("gcEnabled=3D=3D"+gcEnabled+" length =3D "+gcEna= bled.length()); response.setContentType("text/html"); OutputStream outputStream =3D response.getOutputStream(); outputStream.write("Starting Garbage Collection

".g= etBytes()); if (gcEnabled.equals("1")) { try { int result =3D runDataStoreGarbageCollector(outputStream); outputStream.write(result); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); logger.error(e); }finally { outputStream.close(); } } outputStream.write("".getBytes()); outputStream.flush(); } I have also attached the relevant section of the Tomcat log file. Vikram ________________________________ This email may contain proprietary, privileged and confidential information= and is sent for the intended recipient(s) only. If, by an addressing or tr= ansmission error, this mail has been misdirected to you, you are requested = to notify us immediately by return email message and delete this email and = its attachments. You are also hereby notified that any use, any form of rep= roduction, dissemination, copying, disclosure, modification, distribution a= nd/or publication of this email message, contents or its attachment(s) othe= r than by its intended recipient(s) is strictly prohibited. Any opinions ex= pressed in this email are those of the individual and may not necessarily r= epresent those of LoudCloud Systems. Before opening attachment(s), please s= can for viruses. It is further notified that email transmission cannot be g= uaranteed to be secure or error-free as information could be intercepted, c= orrupted, lost, destroyed, arrive late or incomplete, or may contain viruse= s. The sender therefore does not accept liability for any error or omission= in the contents of this message, which arise as a result of email transmis= sion. LoudCloud Systems Inc. and its subsidiaries do not accept liability f= or damage caused by this email or any attachments and may monitor email tra= ffic. ________________________________ --_000_126e977e977b44efbb9089dc5f97c46aSIXPR04MB319apcprd04pro_--