You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:16:42 UTC
svn commit: r1181526 -
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
Author: nspiegelberg
Date: Tue Oct 11 02:16:42 2011
New Revision: 1181526
URL: http://svn.apache.org/viewvc?rev=1181526&view=rev
Log:
Fixing incorrect ByteBuffer instances created by cache-on-write
Summary:
This fixes ByteBuffer objects with arrayOffset=0 and position=8 that were
inserted into the block cache by the cache-on-write functionality, and rewound
to position=0 in loadBlock, resulting in the IllegalArgumentException crash
described in Task #536041, where the DATABLK* magic record was interpreted as a
(key_length, value_length) pair. With this fix the cached buffer has
arrayOffset=8 and position=0, so it is correctly rewound to the beginning of key
length in loadBlock.
Test Plan:
Run HBaseTest with cacheOnWrite and evictOnClose turned on
Reviewed By: kannan
Reviewers: jgray, kannan
CC: kannan, liyintang, hbase@lists,
Revert Plan:
OK
Differential Revision: 236138
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java?rev=1181526&r1=1181525&r2=1181526&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java Tue Oct 11 02:16:42 2011
@@ -420,7 +420,7 @@ public class HFile {
baosDos.flush();
byte [] bytes = baos.toByteArray();
ByteBuffer blockToCache = ByteBuffer.wrap(bytes, DATABLOCKMAGIC.length,
- bytes.length - DATABLOCKMAGIC.length);
+ bytes.length - DATABLOCKMAGIC.length).slice();
String blockName = name + blockNumber;
blockCache.cacheBlock(blockName, blockToCache);
baosDos.close();