Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 30189 invoked from network); 15 Jul 2008 13:33:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jul 2008 13:33:56 -0000 Received: (qmail 68444 invoked by uid 500); 15 Jul 2008 13:33:55 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 68420 invoked by uid 500); 15 Jul 2008 13:33:55 -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 68409 invoked by uid 99); 15 Jul 2008 13:33:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jul 2008 06:33:55 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jul 2008 13:33:10 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9A851234C16B for ; Tue, 15 Jul 2008 06:33:34 -0700 (PDT) Message-ID: <1450971020.1216128814631.JavaMail.jira@brutus> Date: Tue, 15 Jul 2008 06:33:34 -0700 (PDT) From: "Kristian Waagan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-3769) Make LOBStoredProcedure on the server side smarter about the read buffer size In-Reply-To: <514572111.1215609933670.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kristian Waagan updated DERBY-3769: ----------------------------------- Derby Info: (was: [Patch Available]) Fix Version/s: 10.5.0.0 Thanks for looking at the patch Knut Anders. Committed 1b to trunk with revision 676912. Awaiting test run results before backporting. > Make LOBStoredProcedure on the server side smarter about the read buffer size > ----------------------------------------------------------------------------- > > Key: DERBY-3769 > URL: https://issues.apache.org/jira/browse/DERBY-3769 > Project: Derby > Issue Type: Improvement > Components: Network Server > Affects Versions: 10.3.3.0, 10.4.1.3, 10.5.0.0 > Reporter: Kristian Waagan > Assignee: Kristian Waagan > Fix For: 10.5.0.0 > > Attachments: derby-3769-1a-buffer_size_adjustment.diff, derby-3769-1b-buffer_size_adjustment.diff > > > Derby has a max length for VARBINARY and VARCHAR, which is 32'672 bytes or characters (see Limits.DB2_VARCHAR_MAXWIDTH). > When working with LOBs represented by locators, using a read buffer larger than the max value causes the server to process far more data than necessary. > Say the read buffer is 33'000 bytes, and these bytes are requested by the client. This requests ends up in LOBStoredProcedure.BLOBGETBYTES. > Assume the stream position is 64'000, and this is where we want to read from. The following happens: > a) BLOBGETBYTES instructs EmbedBlob to read 33'000 bytes, advancing the stream position to 97'000. > b) Derby fetches/receives the 33'000 bytes, but can only send 32'672. The rest of the data (328 bytes) is discarded. > c) The client receives the 32'672 bytes, recalculates the position and length arguments and sends another request. > d) BLOBGETBYTES(locator, 96672, 328) is executed. EmbedBlob detects that the stream position has advanced too far, so it resets the stream to position zero and skips/reads until position 96'672 has been reached. > e) The remaining 328 bytes are sent to the client. > This issue deals with points b) and d), by avoiding the need to reset the stream. > Points a) and e) are also problematic if a large number of bytes are going to be read, say hundreds of megabytes, but that's another issue. > It is unfortunate that using 32 K (32 * 1024) as the buffer size is almost the worst case; 32'768 - 32'672 = 96 bytes. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.