Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 11261 invoked from network); 5 May 2007 13:27:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 May 2007 13:27:29 -0000 Received: (qmail 83991 invoked by uid 500); 5 May 2007 13:27:35 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 83969 invoked by uid 500); 5 May 2007 13:27:35 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 83957 invoked by uid 99); 5 May 2007 13:27:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 May 2007 06:27:35 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 May 2007 06:27:28 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id CBB671A9838; Sat, 5 May 2007 06:27:07 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r535521 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/services/io/DebugByteTeeOutputStream.java impl/store/access/heap/Heap.java Date: Sat, 05 May 2007 13:27:07 -0000 To: derby-commits@db.apache.org From: mikem@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070505132707.CBB671A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mikem Date: Sat May 5 06:27:06 2007 New Revision: 535521 URL: http://svn.apache.org/viewvc?view=rev&rev=535521 Log: DERBY-2598 Fixes upgrade bug in writeExternal of Heap, it was writing the wrong conglomerate format id in the case of a hard upgrade accessing an existing Heap from an old database. It was writing out the hardcoded new format id when it should have been writing out the dynamic one in the class's state. Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/DebugByteTeeOutputStream.java db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/Heap.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/DebugByteTeeOutputStream.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/DebugByteTeeOutputStream.java?view=diff&rev=535521&r1=535520&r2=535521 ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/DebugByteTeeOutputStream.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/DebugByteTeeOutputStream.java Sat May 5 06:27:06 2007 @@ -22,6 +22,7 @@ import java.io.*; import org.apache.derby.iapi.services.io.AccessibleByteArrayOutputStream; +import org.apache.derby.iapi.services.sanity.SanityManager; class DebugByteTeeOutputStream extends FilterOutputStream { @@ -45,7 +46,8 @@ void checkObject(Formatable f) { - ByteArrayInputStream in = new ByteArrayInputStream(tee.getInternalByteArray(), 0, tee.size()); + ByteArrayInputStream in = + new ByteArrayInputStream(tee.getInternalByteArray(), 0, tee.size()); FormatIdInputStream fin = new FormatIdInputStream(in); @@ -70,22 +72,39 @@ if ((f1.hashCode() == System.identityHashCode(f1)) && (f.hashCode() == System.identityHashCode(f))) return; + } catch (Throwable t) { - System.out.println("FormatableError:read error : " + t.toString()); - System.out.println("FormatableError:class written : " + f.getClass()); - if( null == f1) - System.out.println("FormatableError:read back as null"); - else - System.out.println("FormatableError:class read : " + f1.getClass()); - System.out.println("FormatableError:write id : " + FormatIdUtil.formatIdToString(f.getTypeFormatId())); - if( null != f1) - System.out.println("FormatableError:read id : " + FormatIdUtil.formatIdToString(f1.getTypeFormatId())); + + // for debugging purposes print this both to derby.log and to + // System.out. + String err_msg = + "FormatableError:read error : " + t.toString() + + "\nFormatableError:class written : " + f.getClass(); + + err_msg += (f1 == null) ? + "FormatableError:read back as null" : + ("FormatableError:class read : " + f1.getClass()); + + err_msg += + "FormatableError:write id : " + + FormatIdUtil.formatIdToString(f.getTypeFormatId()); + + if (f1 != null) { + err_msg += "FormatableError:read id : " + + FormatIdUtil.formatIdToString(f1.getTypeFormatId()); + } + + System.out.println(err_msg); t.printStackTrace(System.out); + + if (SanityManager.DEBUG) { + SanityManager.DEBUG_PRINT("DebugByteTeeOutputStream", err_msg); + SanityManager.showTrace(t); + } } //System.out.println("FormatableError:Class written " + f.getClass() + " format id " + f.getTypeFormatId()); //if (f1 != null) //System.out.println("FormatableError:Class read " + f1.getClass() + " format id " + f1.getTypeFormatId()); } - } Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/Heap.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/Heap.java?view=diff&rev=535521&r1=535520&r2=535521 ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/Heap.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/access/heap/Heap.java Sat May 5 06:27:06 2007 @@ -1144,7 +1144,7 @@ { // write the format id of this conglomerate - FormatIdUtil.writeFormatIdInteger(out, this.getTypeFormatId()); + FormatIdUtil.writeFormatIdInteger(out, conglom_format_id); out.writeInt((int) id.getSegmentId()); out.writeLong(id.getContainerId());