Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 21999 invoked from network); 15 Nov 2005 18:06:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Nov 2005 18:06:30 -0000 Received: (qmail 963 invoked by uid 500); 15 Nov 2005 18:06:29 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 788 invoked by uid 500); 15 Nov 2005 18:06:29 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 778 invoked by uid 99); 15 Nov 2005 18:06:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2005 10:06:28 -0800 X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [32.97.182.143] (HELO e3.ny.us.ibm.com) (32.97.182.143) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2005 10:06:19 -0800 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e3.ny.us.ibm.com (8.12.11/8.12.11) with ESMTP id jAFI64CS017850 for ; Tue, 15 Nov 2005 13:06:04 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.12.10/NCO/VERS6.8) with ESMTP id jAFI64Pd120552 for ; Tue, 15 Nov 2005 13:06:04 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11/8.13.3) with ESMTP id jAFI64IY013446 for ; Tue, 15 Nov 2005 13:06:04 -0500 Received: from [9.72.134.65] (dyn9072134065.usca.ibm.com [9.72.134.65]) by d01av03.pok.ibm.com (8.12.11/8.12.11) with ESMTP id jAFI64nB013418 for ; Tue, 15 Nov 2005 13:06:04 -0500 Message-ID: <437A2388.7080000@sbcglobal.net> Date: Tue, 15 Nov 2005 10:06:00 -0800 From: Mike Matrigali User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707) X-Accept-Language: en-us, en MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: RowLocation lifetime References: <43729B2D.9070502@sun.com> <43729E46.4020105@sbcglobal.net> <4378B489.1030104@sun.com> <4378BE7D.6050004@sbcglobal.net> <4378FBB1.6050606@sbcglobal.net> In-Reply-To: X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N �ystein Gr�vlen wrote: >>>>>>"MM" == Mike Matrigali writes: > > > MM> It is only stable while some sort of stable table intent lock is held. > MM> Rows can move during a compress table operation. > > I understand, when a record is moved to another page, its RecordId > will change. Is this the only case where a RecordId will change? If > yes, I would think one could solve the problem for insensitive result > sets by invalidating open result sets when an underlying table is > compressed. > > Some questions to how compression works: > - Will RecordIds ever be reused or will the sequence number continue to > increase? Derby now supports 2 different compression techniques, basically one offline and one online. SYSCS_UTIL.SYSCS_COMPRESS_TABLE() basically copies all rows from one table to another, so recordId's may be reused. This requires table level locking and so is effectively offline. SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE() moves records within the same table, and will not reuse RecordId's, but a given record can definitely change RecordId. This requires row locks for purged/moved rows for most of it's work. Giving back space to OS requires short time table level lock. > - How do you ensure that the old RecordIds are not encountered > during recovery? Does the compression include a checkpoint? Neither really does anything special to stop old recordId's from being encountered during recovery. With offline redo recovery of old table is basically a drop table so either the table is there and we drop it again, or the table is already dropped and we do nothing. In online it is the normal case of redo or a record delete or a record purge, in either case redo will either see a version of the page where it can redo the delete or purge or it will see from the version of the page that there is no work to do. SYSCS_UTIL.SYSCS_COMPRESS_TABLE(): This activity is basically all done above the store level, store does not really know what is going on and there is no special casing of recovery. The path is basically the same recovery path as the fast create/load of a new table/indexes. As the last step in the transaction the language code switches the mapping of the user table to the underlying store conglomerates. SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE(): For the row movement portion of this, there is no special recovery code. Every row movement is just a logged delete and insert, with all the associated index updates in the same transaction. The row movement portion, and row purging portion of this compress is "online" in that it only needs short term page latches and short row level locked transactions. The actual giving space back to the OS still needs a table level lock, and does require a checkpoint. > - It seems like the compression heavily depends on that no log > records are generated during compression. Do you have any ideas > of how to make compression on-line? I guess you would need a > mapping between new and old RecordIds (i.e., every move would > have to be logged.) There is not requirement of no log records. As you say every move is logged, which is why in it is recommended that users use offline compression if that option is available to them as it uses way less system resources and will finish quicker, but definitely is not as concurrent. >