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 8894689C7 for ; Thu, 18 Aug 2011 18:45:20 +0000 (UTC) Received: (qmail 11952 invoked by uid 500); 18 Aug 2011 18:45:18 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 11877 invoked by uid 500); 18 Aug 2011 18:45:18 -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 11866 invoked by uid 99); 18 Aug 2011 18:45:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 18:45:18 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.joseph.davis@gmail.com designates 74.125.83.52 as permitted sender) Received: from [74.125.83.52] (HELO mail-gw0-f52.google.com) (74.125.83.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2011 18:45:09 +0000 Received: by gwj15 with SMTP id 15so1641228gwj.11 for ; Thu, 18 Aug 2011 11:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=+F6vEyfxj3Oju+hhoJInjeSwSq9jmtRQ2+GLSeahWU0=; b=TlpVS9b34BeectCWI/dTBM5lDgvbjv0xRVkPAc1KF1aac9FzszWMgya4X5IZNswpxp R1BLyx92E2EEH585XxTpy5/wiR+U2isWflRT3+H0fcwl4jgLzNmTmSIvK92dVqs5Rla2 QFQNcsqmyhN4zML0KxGrrzEyncytdQ96D3+YE= Received: by 10.150.235.7 with SMTP id i7mr1112186ybh.211.1313693089135; Thu, 18 Aug 2011 11:44:49 -0700 (PDT) Received: from [192.168.1.100] (50-82-31-124.client.mchsi.com [50.82.31.124]) by mx.google.com with ESMTPS id g16sm1489328ybi.8.2011.08.18.11.44.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 11:44:48 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Apple Message framework v1244.3) Subject: Re: MVCC and update locking From: Paul Davis In-Reply-To: Date: Thu, 18 Aug 2011 13:44:47 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <1AB66117-C401-48DE-9976-60C21BD255BF@gmail.com> References: To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1244.3) X-Virus-Checked: Checked by ClamAV on apache.org Reads are pulled from the last update that is made available to readers. = This is slightly different than "last MVCC checkpoint (or header write = in couchdb internal speak)" in that it doesn't require that the header = was written to disk (if you have delayed_commits=3Dtrue, etc). Reads are never locked. They have concurrent access to the database file = and can read to the heart's content. This is because the database is = append only, so once they have a pointer to data on disk, that data will = never be changed (until the file is compacted away, but ignore that for = now). Writes on the other hand aren't locked either, they're just coordinated = through a central writer process. The reason that the synchronous writes = is fine is that the writer batches write requests through the file IO = and db update process. Ie, say 1 person shows up with a write request, = the writer goes off to service this request. While its away, 10 more = people show up with write requests. When the writer returns the first = request it sees 10 new ones. Instead of handling one at a time, it = handles all 10 simultaneously. HTH, Paul Davis On Aug 18, 2011, at 1:03 PM, Sean Copenhaver wrote: > To my understanding each read pulls from the last good MVCC > checkpoint/revision/what-have-you so there are no read locks due to = writes. > Nor do any reads lock other reads. Then each write on a single file = are done > serially so there are no write locks. >=20 > I believe each database and each view are in their own separate file = so they > can all be written to concurrently. Not positive on that though. >=20 > On Thu, Aug 18, 2011 at 1:49 PM, Danny Sinang = wrote: >=20 >> Hello, >>=20 >> CouchDB claims to be lockless, thanks to its use of MVCC. Both = CouchDB and >> MarkLogic claim to use MVCC. >>=20 >> However, http://www.odbms.org/download/inside-marklogic-server.pdf = states >> that MarkLogic does read and write locking for updates. >>=20 >> Does CouchDB also do the same ? If not, how does it do updates = differently >> ? >>=20 >> Regards, >> Danny >>=20 >=20 >=20 >=20 > --=20 > =93The limits of language are the limits of one's world. =93 -Ludwig = von > Wittgenstein