Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 10827 invoked from network); 25 Nov 2009 10:48:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Nov 2009 10:48:55 -0000 Received: (qmail 78772 invoked by uid 500); 25 Nov 2009 10:48:54 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 78460 invoked by uid 500); 25 Nov 2009 10:48:53 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 78452 invoked by uid 99); 25 Nov 2009 10:48:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Nov 2009 10:48:53 +0000 X-ASF-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of elecharny@gmail.com designates 209.85.218.222 as permitted sender) Received: from [209.85.218.222] (HELO mail-bw0-f222.google.com) (209.85.218.222) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Nov 2009 10:48:49 +0000 Received: by bwz22 with SMTP id 22so7248002bwz.25 for ; Wed, 25 Nov 2009 02:48:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=jRdDDGw78/wCQPn8tleSwAc1rpCiYp273wXLJ5Q7SKM=; b=p7xWut6OzU+4Mp9DOnf77+nFq7n1fNNfchGxarf/fOpTMT7V2m+2ueriJitoSwAl1k vEmiQSNoBwVRFEca3xixCCg+NEg0AJezkn6rrFB+85BE5roHAj4ULP6U5CSNhz21G/NC JSlRlNUC33vVQ+ksWnz+cDghpFHD/Sse+v3+I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=CdSeM16VI2Is0QD6cSlrzAXCV+aamEcyRmcXnQYYA5gvluMDfbzQxTThmH2MuTUzZv nTC6hAejbpYq+57fL1gpgh27xREoe5JN9gWFpJJqDOR1IMnrkMijM2jmnHXmSXs1TYNJ SWWLtJKdvu92joX0VXMPidXtLFFNWAr+V0uzQ= Received: by 10.204.11.3 with SMTP id r3mr7182960bkr.107.1259146108081; Wed, 25 Nov 2009 02:48:28 -0800 (PST) Received: from ?192.168.0.51? (lon92-10-78-226-4-211.fbx.proxad.net [78.226.4.211]) by mx.google.com with ESMTPS id f31sm8462115fkf.12.2009.11.25.02.48.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 25 Nov 2009 02:48:26 -0800 (PST) Sender: Emmanuel Lecharny Message-ID: <4B0D0B79.8080206@nextury.com> Date: Wed, 25 Nov 2009 11:48:25 +0100 From: Emmanuel Lecharny User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: [ApacheDS] [Schema] Update mechanism References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Alex Karasulu wrote: > Thinking more about how to update the schema and the mechanics involved > along with the various trade offs. Here's how this should progress: > > Schema Change Steps > > (1) A schema change operation arrives and changes are performed on a cloned > set of registries where the impact of the change is calculated in terms of > the total number of indirect dependents affected. > When you talk about 'indirect dependents affected', you mean affected SchemaObjects, I guess. > (2a) If the operation is consistent then a schema-txn-begin message is sent > to all listeners informing them of the OIDs impacted by the schema change > calculated in the first step. This lets objects dependent on these schema > entities to respond to the situation. This message is delivered > synchronously. Access to the old Registries is provided before the swap in > case the object needs them via the SchemaManager handle if they are exposed. > There is an issue here, if the message is synchronous, as many of the ServerEntries (or constants used all over the code) may be in memory, without any thread using them. Some of the use cases are : - objects in cache (we have many different cache, like the referral cache, the alias cache, etc) - objects currently being built, but not completed, waiting for some more data from the client side (in the codec) - objects which has already been checked against the old schema, but are not yet processed by the backend, and may become invalid There is also another potential problem if the modification impacts the index (like if we removed an indexed AttributeType). Anyway, sending synchronous messages is simply impossible. > (2b) If the operation leaves the schema in an inconsistent state then no > message is sent to schema listeners and the schema change is rejected. > That I agree on. > (3) The schema registries are swapped out. > (4) The SchemaManager then sends a schema-txn-commit message to all > listeners to now be able to access the modified schema elements they're > interested in from the newly swapped in registries. This message is > delivered synchronously. > See point 2a above. > > Schema Change Responses > > (1) Invalidate the object in question so all using/run processes and caches > can reset or update themselves via the acquisition of a new valid object to > continue the process. > Clearing the cache is an option, but for aliases or referals, it will request a new search to get back all the aliases or referrals. Can be costly... But maybe the problem is not that this operation is costly, but that it's the way we handle aliases and referrals which is wrong... > (2) Make the object depending on schema objects valid by updating stale > references and hope for the best. Sometimes timing will cause certain > failures but this is really OK with us since this is a rare situation to > update the schema. > Assuming that an synchronous message being sent to the objects can't be done, the other option would be to send this synchronous message to the session and to the cache managers, as they have direct access to the objects. Let's say the session is not active (no thread to process it), and let's say it's reactivated at some point : the first thing to do would be to check if the schema has changed, and if so, propagate the new schema to all the related objects. That mean we must register aother listener in the objects to react to this session modification. the very same for the cache managers. About the cache, we have to use a better strategy than the one we are using? It's insane to have so many caches all over the server. We should use one generic cache system where we store all the different elements we want to cache, and have a dedicated thread to manage the global cache. But the first step would be to list all the caches we are using... Interesting times ! -- -- cordialement, regards, Emmanuel L�charny www.iktek.com directory.apache.org