HBASE-13945 - Prefix_Tree seekBefore() does not work correctly (Ram)

This commit is contained in:
ramkrishna 2015-06-24 09:12:29 +05:30
parent 578e34aa1b
commit 92f4e30f45
4 changed files with 16 additions and 8 deletions

View File

@ -105,11 +105,15 @@ public class KeyValueUtil {
return kvCell;
}
/**
* The position will be set to the beginning of the new ByteBuffer
* @param cell
* @return the Bytebuffer containing the key part of the cell
*/
public static ByteBuffer copyKeyToNewByteBuffer(final Cell cell) {
byte[] bytes = new byte[keyLength(cell)];
appendKeyTo(cell, bytes, 0);
ByteBuffer buffer = ByteBuffer.wrap(bytes);
buffer.position(buffer.limit());//make it look as if each field were appended
return buffer;
}
@ -151,11 +155,15 @@ public class KeyValueUtil {
return pos;
}
/**
* The position will be set to the beginning of the new ByteBuffer
* @param cell
* @return the ByteBuffer containing the cell
*/
public static ByteBuffer copyToNewByteBuffer(final Cell cell) {
byte[] bytes = new byte[length(cell)];
appendToByteArray(cell, bytes, 0);
ByteBuffer buffer = ByteBuffer.wrap(bytes);
buffer.position(buffer.limit());//make it look as if each field were appended
return buffer;
}

View File

@ -582,6 +582,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
public ByteBuffer getKeyDeepCopy() {
ByteBuffer keyBuffer = ByteBuffer.allocate(current.keyLength);
keyBuffer.put(current.keyBuffer, 0, current.keyLength);
keyBuffer.rewind();
return keyBuffer;
}
@ -616,6 +617,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
kvBuffer.put(current.tagsBuffer, 0, current.tagsLength);
}
}
kvBuffer.rewind();
return kvBuffer;
}

View File

@ -153,8 +153,9 @@ public interface DataBlockEncoder {
* @return value at current position
*/
ByteBuffer getValueShallowCopy();
/** @return key value at current position with position set to limit */
//TODO : to be removed - currently used in testcases only
/** @return a key value buffer with the position set at the beginning of the buffer */
ByteBuffer getKeyValueBuffer();
/**

View File

@ -64,10 +64,7 @@ public class TestSeekTo {
public static Collection<Object[]> parameters() {
List<Object[]> paramList = new ArrayList<Object[]>();
for (DataBlockEncoding encoding : DataBlockEncoding.values()) {
// Remove after HBASE-13939
if (encoding != DataBlockEncoding.PREFIX_TREE) {
paramList.add(new Object[] { encoding });
}
paramList.add(new Object[] { encoding });
}
return paramList;
}