HBASE-13945 - Prefix_Tree seekBefore() does not work correctly (Ram)
This commit is contained in:
parent
76d6700d23
commit
d7356667be
|
@ -106,11 +106,15 @@ public class KeyValueUtil {
|
||||||
return kvCell;
|
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) {
|
public static ByteBuffer copyKeyToNewByteBuffer(final Cell cell) {
|
||||||
byte[] bytes = new byte[keyLength(cell)];
|
byte[] bytes = new byte[keyLength(cell)];
|
||||||
appendKeyTo(cell, bytes, 0);
|
appendKeyTo(cell, bytes, 0);
|
||||||
ByteBuffer buffer = ByteBuffer.wrap(bytes);
|
ByteBuffer buffer = ByteBuffer.wrap(bytes);
|
||||||
buffer.position(buffer.limit());//make it look as if each field were appended
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,11 +156,15 @@ public class KeyValueUtil {
|
||||||
return pos;
|
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) {
|
public static ByteBuffer copyToNewByteBuffer(final Cell cell) {
|
||||||
byte[] bytes = new byte[length(cell)];
|
byte[] bytes = new byte[length(cell)];
|
||||||
appendToByteArray(cell, bytes, 0);
|
appendToByteArray(cell, bytes, 0);
|
||||||
ByteBuffer buffer = ByteBuffer.wrap(bytes);
|
ByteBuffer buffer = ByteBuffer.wrap(bytes);
|
||||||
buffer.position(buffer.limit());//make it look as if each field were appended
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -644,6 +644,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
|
||||||
public ByteBuffer getKeyDeepCopy() {
|
public ByteBuffer getKeyDeepCopy() {
|
||||||
ByteBuffer keyBuffer = ByteBuffer.allocate(current.keyLength);
|
ByteBuffer keyBuffer = ByteBuffer.allocate(current.keyLength);
|
||||||
keyBuffer.put(current.keyBuffer, 0, current.keyLength);
|
keyBuffer.put(current.keyBuffer, 0, current.keyLength);
|
||||||
|
keyBuffer.rewind();
|
||||||
return keyBuffer;
|
return keyBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,6 +679,7 @@ abstract class BufferedDataBlockEncoder implements DataBlockEncoder {
|
||||||
kvBuffer.put(current.tagsBuffer, 0, current.tagsLength);
|
kvBuffer.put(current.tagsBuffer, 0, current.tagsLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
kvBuffer.rewind();
|
||||||
return kvBuffer;
|
return kvBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,8 @@ public interface DataBlockEncoder {
|
||||||
*/
|
*/
|
||||||
ByteBuffer getValueShallowCopy();
|
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();
|
ByteBuffer getKeyValueBuffer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -65,10 +65,7 @@ public class TestSeekTo {
|
||||||
public static Collection<Object[]> parameters() {
|
public static Collection<Object[]> parameters() {
|
||||||
List<Object[]> paramList = new ArrayList<Object[]>();
|
List<Object[]> paramList = new ArrayList<Object[]>();
|
||||||
for (DataBlockEncoding encoding : DataBlockEncoding.values()) {
|
for (DataBlockEncoding encoding : DataBlockEncoding.values()) {
|
||||||
// Remove after HBASE-13939
|
paramList.add(new Object[] { encoding });
|
||||||
if (encoding != DataBlockEncoding.PREFIX_TREE) {
|
|
||||||
paramList.add(new Object[] { encoding });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return paramList;
|
return paramList;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue