Return-Path: X-Original-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 383EA9C7D for ; Sat, 31 Mar 2012 10:39:58 +0000 (UTC) Received: (qmail 62085 invoked by uid 500); 31 Mar 2012 10:39:58 -0000 Delivered-To: apmail-jackrabbit-oak-dev-archive@jackrabbit.apache.org Received: (qmail 62061 invoked by uid 500); 31 Mar 2012 10:39:58 -0000 Mailing-List: contact oak-dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-dev@jackrabbit.apache.org Received: (qmail 62051 invoked by uid 99); 31 Mar 2012 10:39:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Mar 2012 10:39:57 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jukka.zitting@gmail.com designates 209.85.212.42 as permitted sender) Received: from [209.85.212.42] (HELO mail-vb0-f42.google.com) (209.85.212.42) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Mar 2012 10:39:50 +0000 Received: by vbjk13 with SMTP id k13so2118685vbj.1 for ; Sat, 31 Mar 2012 03:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=ab9xu6R9ztxLZ7yY0dwdtMh5UojsEybjgIEYhaV5NzE=; b=pPW1MNgGoT+Ezmm04hu227JuXoULm176gOuBE2dGzCXmhGmKVdKwJ2aatSnSzUOpPt PpF8oPVwm3i1yOoAFhz3WlrECfrG6SvVOxlrsnM7K0aGIU5ubfPz/mdy3XLJM07yXzTF LwQRsR5xk1PAGDQdS3anMUyXdExBQrVtbNUPpUs6tdDnR3jJxme+cQ/8pIyKisTxjdd8 BzGu7DayziZkaX7ekipW9QKBaMSi4PVLXFkRcJaTkhGCh4BM1s5j0bKNJ/2GqHgYC2Zv Pm3klGuOCXzX5Djx7ETgtleOxyVuHegQzLuX9dUTyC6Bb+KwfsunW251A6iRMJUi7N4A /pOQ== Received: by 10.220.151.71 with SMTP id b7mr781009vcw.62.1333190369613; Sat, 31 Mar 2012 03:39:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.26.42 with HTTP; Sat, 31 Mar 2012 03:39:08 -0700 (PDT) From: Jukka Zitting Date: Sat, 31 Mar 2012 12:39:08 +0200 Message-ID: Subject: Lifetime of revision identifiers To: Oak devs Content-Type: text/plain; charset=ISO-8859-1 Hi, The revision identifiers returned by methods like MicroKernel.getHeadRevision() are plain strings so in theory I could write one down on a piece of paper, lock it in a safe, and come back ten years later expecting the identifier to give me access to the repository content as it existed a decade ago. Currently there's nothing in the documented MicroKernel contract that prevents me from expecting that the above use case would work. This is troublesome as it means that *no* past state of the repository should ever be automatically cleaned out as garbage. To allow automatic garbage collection without unexpectedly breaking client expectations, we should define some rules on the expected lifetime of revision identifiers. Without rules like that a client can't even do the following without worrying about potential interference from the garbage collector: String revision = mk.getHeadRevision(); String root = mk.getNodes(revision, "/"); Since the revision identifiers are plain strings, we can't leverage the standard garbage collector of the JVM and simply declare that all revisions identifiers will remain valid for at least as long as they are being referenced by some client. Thus a lease mechanism like "revision identifiers remain valid for at least N minutes since last access" may be needed. A client like a long-lived JCR Session would then need to either periodically refresh to the latest revision or extend its "lease" on an earlier revision. Or we could combine these approaches by defining a Revision interface for local Java clients and an accompanying Revision-String mapping with defined lease handling for remote access. WDYT? BR, Jukka Zitting