Return-Path: X-Original-To: apmail-directory-kerby-archive@minotaur.apache.org Delivered-To: apmail-directory-kerby-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E7B8173E2 for ; Thu, 24 Sep 2015 14:22:20 +0000 (UTC) Received: (qmail 19747 invoked by uid 500); 24 Sep 2015 14:22:20 -0000 Delivered-To: apmail-directory-kerby-archive@directory.apache.org Received: (qmail 19721 invoked by uid 500); 24 Sep 2015 14:22:20 -0000 Mailing-List: contact kerby-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: kerby@directory.apache.org Delivered-To: mailing list kerby@directory.apache.org Received: (qmail 19709 invoked by uid 99); 24 Sep 2015 14:22:20 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Sep 2015 14:22:20 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id C896AF84A1 for ; Thu, 24 Sep 2015 14:22:19 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ODa_PfQyiRhc for ; Thu, 24 Sep 2015 14:22:19 +0000 (UTC) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 2E83321270 for ; Thu, 24 Sep 2015 14:22:18 +0000 (UTC) Received: by pacgz1 with SMTP id gz1so7978057pac.3 for ; Thu, 24 Sep 2015 07:22:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=rEyJ77EPlpMQszqz29HgajGnema0O6jolCy52o4npv8=; b=my1b/TFN4johDXBlb2pCBtgAc7gZsWskZIW+PrLuWjwAiEwiDxsKNVrAqLWNZsE8Ta MlJk+BqNnNEioJ3ERMs4ur8HSH8cwTaLgXcPu10H/YCKhS6npCWds9LXEhYFaJeEus/g BNx62vNuMqY43cxXIc0UQU0fkQeAjs+D5S7yRfzP2kwIfL/hcgDat9O4hnQmRyYkiswW 8o4Va1EDW29qYwwkykTFSNLPoPDotYR+zbnb+3SAv4awIOCX8ZsOP5OSk03u+cPvxAfJ ZwRgAuxQuMkiN3It24rUz8OCE5seEWuyYblnPbiplYCMti9sxumIAn++yqDgUOw8lal3 aFFg== X-Received: by 10.68.94.3 with SMTP id cy3mr44288246pbb.113.1443104536928; Thu, 24 Sep 2015 07:22:16 -0700 (PDT) Received: from [192.168.1.29] (AMontsouris-651-1-132-12.w90-46.abo.wanadoo.fr. [90.46.47.12]) by smtp.googlemail.com with ESMTPSA id zc4sm14030971pbb.24.2015.09.24.07.22.15 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Sep 2015 07:22:16 -0700 (PDT) Subject: Re: Transaction support for Kerby backend To: kerby@directory.apache.org References: <8D5F7E3237B3ED47B84CF187BB17B66611C43363@SHSMSX103.ccr.corp.intel.com> From: =?UTF-8?Q?Emmanuel_L=c3=a9charny?= X-Enigmail-Draft-Status: N1110 Message-ID: <56040712.2050205@gmail.com> Date: Thu, 24 Sep 2015 16:22:10 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <8D5F7E3237B3ED47B84CF187BB17B66611C43363@SHSMSX103.ccr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Le 21/09/15 13:29, Zheng, Kai a =C3=A9crit : > Hi all, > > This is proposing to add transaction support API for Kerby backend for = efficiency. Kerby provides various backends, some of them is file based, = like the Json one. I'm attempting to add another one based on Google Flat= buffers format. Such backends based on simple file would be better to hav= e transaction support for efficiency. In existing codes, every call to ad= dIdentity/updateIdentity/deleteIdentity will require to write the memory = buffer/states to the disk file, quite inefficiently. > > For simple, it would be good enough to be: > > 1. A backend instance allows only one transaction at a time; > > 2. When it's in a transaction, any mutation operation via non-tra= nsaction API (existing one) will be denied; > > 3. In a transaction, multiple mutation operations can be made via= the new transaction API, and states are only updated to the memory, no s= tore/save/flush to the disk file; > > 4. When the transaction ends, the memory state will be persisted/= synced to the disk file, then the update content will be visible to other= backend instances if it reloads. > > 5. For backends that use a system already supporting transaction,= like Mavibot, LDAP and Zookeeper, the new transaction API will have defa= ult implementation that performs no-op. > > I'd like to hold on some time for feedbacks before proceed, since I'm n= ot expert for such system designs. I wish it to be practical, simple, eff= iciency, and easy to do. > Thanks. So, let's talk about what is a transaction, in the kerby context. Let's first talk about what is a Transaction in ApacheDS, just for the record. In ApacheDS, when we update an entry, we impact many B-trees (the Master table, which holds the entries, and the various indexes). We currently don't have a cross-B-tree transaction, but we are working on it. the idea is that either all the B-trees are updated as a whole, or none of them are. That makes teh LDAP server consistent. It also implies that reads aren't impacted by the writes. In a Kerberos context, the problem is exactly the same, as many elements might be modified when injecting some new element. How I see the thing : - if the underlying repository (or backend) does not support transactions, then you are a bit in trouble. Typically, if the backend is using flat files, then that means you have to copy the files when updating them, which might be a costly operation, then swap the files when done, and let the new readers using this new files, while the existing readers keep going with the old files... Not simple ! JDBM has the exact same problem : it support transaction at the B-tree level, but not across B-trees, which makes it a wrong backend (as every of us are realized 3 years ago :/) and this is the reason we started Mavibot ! So I think kerby *NEEDS* to define a transaction layer on top of the backends, but it also has to ensure than the backends support transaction= s. Thoughts ?