Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AB8A7DA92 for ; Thu, 30 Aug 2012 17:26:40 +0000 (UTC) Received: (qmail 44578 invoked by uid 500); 30 Aug 2012 17:26:39 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 44511 invoked by uid 500); 30 Aug 2012 17:26:38 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 44503 invoked by uid 99); 30 Aug 2012 17:26:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2012 17:26:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of snbartell@gmail.com designates 209.85.160.52 as permitted sender) Received: from [209.85.160.52] (HELO mail-pb0-f52.google.com) (209.85.160.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2012 17:26:33 +0000 Received: by pbcxa7 with SMTP id xa7so3309179pbc.11 for ; Thu, 30 Aug 2012 10:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; bh=2m13bYDJ6zRwfac8WVKtJDAe3Nx51Mqq50VW2N+adiM=; b=fcKeImdoQAO3Q8KFNpmHUIz64/E6u6Iy5RlOiACyD/j3pDOFFTA5j2smWm17bupNhT BfJD2/CVVzBOQNtKjtqfJuNsqKUDBJnTOSWF1LJoTKLO4Jk4tVYM2vHGDMQxgaXlSZjT cP8+xHipRTHdgR+8nPto0qRKMmua1KEhnm1LqkE6G/eyzbLHQAmHe9oW8OIO5N03RG6D ExoL99kwCAxqez++ich7RU4X53WddaIu7WBMifycnRh/S3sDDQJSnVkRf8Md9AM8YzHT qAfj71Xs6XKOQ271CaWYgb8jEl1wV6CKTtdOefCcqokvB37MRxFj3qaIqqByhw+X+f5S G+Sw== Received: by 10.68.241.72 with SMTP id wg8mr12459393pbc.96.1346347572806; Thu, 30 Aug 2012 10:26:12 -0700 (PDT) Received: from [192.168.98.149] (static-108-23-87-130.lsanca.fios.verizon.net. [108.23.87.130]) by mx.google.com with ESMTPS id pq7sm1902852pbb.25.2012.08.30.10.26.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Aug 2012 10:26:11 -0700 (PDT) From: stephen bartell Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: multipart/alternative; boundary="Apple-Mail=_E1BC1D35-6C58-4854-9A87-D792F98DFC8B" Subject: Re: auto delete docs Date: Thu, 30 Aug 2012 10:26:10 -0700 In-Reply-To: <503F9BBD.6010603@bardubitzki.com> To: user@couchdb.apache.org References: <503F8A7A.10503@bardubitzki.com> <503F8E4C.2060600@bardubitzki.com> <820406CE2A8D4A7CA9E538821094CB52@cloudant.com> <503F9510.2050002@bardubitzki.com> <503F9BBD.6010603@bardubitzki.com> Message-Id: <03FFF0D9-87DB-4884-821B-DA9D9B5CB386@gmail.com> X-Mailer: Apple Mail (2.1257) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_E1BC1D35-6C58-4854-9A87-D792F98DFC8B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii What Simon said. Im doing this in production. I have a python script = set up as a cron job which queries the expire_time view. Docs that get = returned get deleted. Its a real small, simple script and works like a = charm. Im pretty sure you know this, but make sure to page through your view = results. If your database hasn't been 'cleaned out' for a while and the = database is huge, you're going to get quite a massive response. I once = made the mistake of not paging my results in a node program. V8's mem = limit is 1gb on a 64 bit machine, so once this limit was exceeded, the = program would crash and never complete its job. You could see where = this leads if that program is responsible for getting rid of old docs = and thus keeping database size under control. Stephen Bartell Look ahead, understand the shift, and imagine the right solution five = years from now. Then do it! -baekdal On Aug 30, 2012, at 9:58 AM, Stephan Bardubitzki wrote: > Okay, the link works now. Must have been an issue at Apache. >=20 > On 12-08-30 09:30 AM, Stephan Bardubitzki wrote: >> @Simon: >>=20 >> Thanks, again. Could you please double check the link, I can't open = it. >>=20 >> @Matthieu >>=20 >> Unfortunately, I'm not familiar with Erlang. I need to do this task = on node.js with nano (https://github.com/dscape/nano). >>=20 >>=20 >> On 12-08-30 09:03 AM, Simon Metson wrote: >>> Sure, you can use _bulk_docs and send a json doc like: >>>=20 >>> { >>> "docs": [ >>> {"_id": "expired_doc_0", "_rev": "1-62657917", "_deleted": = true}, >>> {"_id": "expired_doc_1", "_rev": "1-2089673485", "_deleted": = true}, >>> {"_id": "expired_doc_2", "_rev": "1-2063452834", "_deleted": = true} >>> ] >>> } >>>=20 >>>=20 >>> = http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API#Modify_Multiple_Docu= ments_With_a_Single_Request for more info >>>=20 >>>=20 >>> On Thursday, 30 August 2012 at 17:01, Stephan Bardubitzki wrote: >>>=20 >>>> Thanks Simon, >>>>=20 >>>> that's what I was thinking too, but have a problem to figure out = how >>>> bulk delete should be implemented. Do you have some advise or code >>>> example on that? >>>>=20 >>>> Stephan >>>>=20 >>>>=20 >>>> On 12-08-30 08:48 AM, Simon Metson wrote: >>>>> You need to have a view keyed by expire_date and an external = process (some cron script, say) that queries that appropriately and = makes the (bulk) delete of old docs. >>>>> Cheers >>>>> Simon >>>>>=20 >>>>>=20 >>>>> On Thursday, 30 August 2012 at 16:44, Stephan Bardubitzki wrote: >>>>>=20 >>>>>> I have a db with docs that have a field expire_date. I want to = auto >>>>>> delete those docs when expire_date has passed, but have no clue = how to >>>>>> do that. >>>>>>=20 >>>>>> Any advise would be greatly appreciated. >>>>>>=20 >>>>>> Thanks, >>>>>> Stephan >>>>>>=20 >>>>>=20 >>>>>=20 >>>>> -------------------------------- >>>>> Spam/Virus scanning by CanIt Pro >>>>>=20 >>>>> For more information see >>>>> http://www.kgbinternet.com/SpamFilter.htm >>>>>=20 >>>>> To control your spam filter, log in at >>>>> http://filter.kgbinternet.com >>>>>=20 >>>>=20 >>>>=20 >>>=20 >>>=20 >>> -------------------------------- >>> Spam/Virus scanning by CanIt Pro >>>=20 >>> For more information see >>> http://www.kgbinternet.com/SpamFilter.htm >>>=20 >>> To control your spam filter, log in at >>> http://filter.kgbinternet.com >>>=20 >>=20 >>=20 >> -------------------------------- >> Spam/Virus scanning by CanIt Pro >>=20 >> For more information see >> http://www.kgbinternet.com/SpamFilter.htm >>=20 >> To control your spam filter, log in at >> http://filter.kgbinternet.com >>=20 >=20 --Apple-Mail=_E1BC1D35-6C58-4854-9A87-D792F98DFC8B--