Return-Path: Delivered-To: apmail-incubator-jena-dev-archive@minotaur.apache.org Received: (qmail 2375 invoked from network); 25 Feb 2011 08:18:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Feb 2011 08:18:23 -0000 Received: (qmail 43864 invoked by uid 500); 25 Feb 2011 08:18:22 -0000 Delivered-To: apmail-incubator-jena-dev-archive@incubator.apache.org Received: (qmail 43824 invoked by uid 500); 25 Feb 2011 08:18:21 -0000 Mailing-List: contact jena-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jena-dev@incubator.apache.org Delivered-To: mailing list jena-dev@incubator.apache.org Received: (qmail 43816 invoked by uid 99); 25 Feb 2011 08:18:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Feb 2011 08:18:20 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of castagna.lists@googlemail.com designates 74.125.82.41 as permitted sender) Received: from [74.125.82.41] (HELO mail-ww0-f41.google.com) (74.125.82.41) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Feb 2011 08:18:13 +0000 Received: by wwb17 with SMTP id 17so275247wwb.0 for ; Fri, 25 Feb 2011 00:17:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=NwIXWvzMZUHn5DCVSzgihpVEteclGrF78EpNySdRVS8=; b=BCs2f8Qn7eR1xH58/fA3rNSNGCFUdjSyShZUzNJ95nKvACt7vDcBuAN9BXDFd78hI2 ar3QPSpMVTYfVBr/IhquaJNRtQi44I8whDqKkNNHYK3PzpnhV8yKygTECZ6LH18kE1IF RdYVmcUx3dQTJadd6ilCdxjBtSrwulnwlS9B8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=QfelnbtGlaZSNkHmsQbWAd3JLITQhmV8XphQJaI9acX0PJzdI2rTrA/6oe8qzfXOyS 4DftiXBLVN6SyNYjs7IOWNnmYsWbGnUSGti/k0YFmjEa6MlKyg2Nju6ctETTIidOOkrD 7StAZsZUhD3nG97Gd79K17/Zb6vJWwP8nrw6A= Received: by 10.227.145.208 with SMTP id e16mr1860455wbv.5.1298621872877; Fri, 25 Feb 2011 00:17:52 -0800 (PST) Received: from [192.168.1.10] (80-42-197-178.dynamic.dsl.as9105.com [80.42.197.178]) by mx.google.com with ESMTPS id y29sm365267wbd.4.2011.02.25.00.17.50 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Feb 2011 00:17:51 -0800 (PST) Message-ID: <4D6765A9.7040700@googlemail.com> Date: Fri, 25 Feb 2011 08:17:45 +0000 From: Paolo Castagna User-Agent: Thunderbird 2.0.0.24 (X11/20101027) MIME-Version: 1.0 To: jena-dev@yahoogroups.com CC: jena-dev@incubator.apache.org Subject: Re: [jena-dev] TDB concurrency References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Danny, Dave and Damian have already answered your question. In the past, I had those sort of doubts about MRSW myself. A simple multi threaded test can help finding the answer. For clarity, it's MR XOR SW. It's an exclusive OR: if you are writing, nobody can read. Therefore a long write would block access to readers. Similarly, a long read would block any write too. There is an issue (i.e. New Feature) for this: https://issues.apache.org/jira/browse/JENA-41 We should discuss technical details there. Andy proposed "journaled file access". I'd like to help on this and try to do a prototype as a proof of concept. However, I am not an expert on this (i.e. I've never wrote a journaled file access system before) and it does not appear to be only a "small matter of programming". ;-) There are a lot of details which are not clear to me. Damian's suggestion works perfectly for your. Paolo PS: I know it's a pain, but we are trying to move the mailing list to Apache. Please, subscribe by sending an email to: jena-dev-subscribe AT incubator.apache.org jena-users-subscribe AT incubator.apache.org Danny Ayers wrote: > on the wiki it says: > [[ > TDB provides a Multiple Reader or Single Writer (MRSW) policy for > concurrency access. Applications are expected to adhere to this policy > - it is not automatically checked. > > One gotcha is Java iterators. An iterator that is moving over the > database is making read operations and no updates to the dataset are > possible while an iterator is being used. > ]] > > I'd like to check I'm reading this correctly - is it that many readers > can access the data concurrently but the (one and only) writer should > have an exclusive lock - and that lock should block reading..? > > The scenario I'm looking at will be TDB shared between Fuseki and > programmatic access (a Turtle editor). > > I've haven't yet really got a clue how I'll handle the sharing, so if > anyone's got any code for a similar situation I'd be grateful for a > pointer. > > (Right now I've got the editing happening on a single memory model, so > for the moment at least I can probably get away with access to TDB > models through a read-(edit)-replace kind of cycle). > > Cheers, > Danny. >