Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 51265 invoked from network); 2 Dec 2008 01:38:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Dec 2008 01:38:39 -0000 Received: (qmail 78946 invoked by uid 500); 2 Dec 2008 01:38:51 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 78914 invoked by uid 500); 2 Dec 2008 01:38:51 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 78905 invoked by uid 99); 2 Dec 2008 01:38:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 17:38:51 -0800 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Dec 2008 01:37:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B69CA2388975; Mon, 1 Dec 2008 17:37:48 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r722325 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/c++/librecordio/binarchive.cc Date: Tue, 02 Dec 2008 01:37:48 -0000 To: core-commits@hadoop.apache.org From: cdouglas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081202013748.B69CA2388975@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cdouglas Date: Mon Dec 1 17:37:48 2008 New Revision: 722325 URL: http://svn.apache.org/viewvc?rev=722325&view=rev Log: HADOOP-4713. Fix librecordio to handle records larger than 64k. Contributed by Christian Kunz. Modified: hadoop/core/branches/branch-0.18/CHANGES.txt hadoop/core/branches/branch-0.18/src/c++/librecordio/binarchive.cc Modified: hadoop/core/branches/branch-0.18/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=722325&r1=722324&r2=722325&view=diff ============================================================================== --- hadoop/core/branches/branch-0.18/CHANGES.txt (original) +++ hadoop/core/branches/branch-0.18/CHANGES.txt Mon Dec 1 17:37:48 2008 @@ -52,6 +52,9 @@ HADOOP-4257. The DFS client should pick only one datanode as the candidate to initiate lease recovery. (Tsz Wo (Nicholas), SZE via dhruba) + HADOOP-4713. Fix librecordio to handle records larger than 64k. (Christian + Kunz via cdouglas) + Release 0.18.2 - 2008-11-03 BUG FIXES Modified: hadoop/core/branches/branch-0.18/src/c++/librecordio/binarchive.cc URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/c%2B%2B/librecordio/binarchive.cc?rev=722325&r1=722324&r2=722325&view=diff ============================================================================== --- hadoop/core/branches/branch-0.18/src/c++/librecordio/binarchive.cc (original) +++ hadoop/core/branches/branch-0.18/src/c++/librecordio/binarchive.cc Mon Dec 1 17:37:48 2008 @@ -161,10 +161,19 @@ int32_t len = 0; ::deserializeInt(len, stream); if (len > 0) { - char buf[len]; - stream.read((void*) buf, len); - std::string s(buf, len); - t = s; + // resize the string to the right length + t.resize(len); + // read into the string in 64k chunks + const int bufSize = 65536; + int offset = 0; + char buf[bufSize]; + while (len > 0) { + int chunkLength = len > bufSize ? bufSize : len; + stream.read((void *)buf, chunkLength); + t.replace(offset, chunkLength, buf, chunkLength); + offset += chunkLength; + len -= chunkLength; + } } }