HDFS-12692. Ozone: fix javadoc/unit test for calling MetadataStore.getRangeKVs with non existing key. Contributed by Elek, Marton.
This commit is contained in:
parent
6d9f914b55
commit
393a02d8e1
@ -286,7 +286,7 @@ public List<Map.Entry<byte[], byte[]>> getSequentialRangeKVs(byte[] startKey,
|
|||||||
* If the startKey is specified and found in levelDB, this key and the keys
|
* If the startKey is specified and found in levelDB, this key and the keys
|
||||||
* after this key will be included in the result. If the startKey is null
|
* after this key will be included in the result. If the startKey is null
|
||||||
* all entries will be included as long as other conditions are satisfied.
|
* all entries will be included as long as other conditions are satisfied.
|
||||||
* If the given startKey doesn't exist, an IOException will be thrown.
|
* If the given startKey doesn't exist, an empty list will be returned.
|
||||||
* <p>
|
* <p>
|
||||||
* The count argument is to limit number of total entries to return,
|
* The count argument is to limit number of total entries to return,
|
||||||
* the value for count must be an integer greater than 0.
|
* the value for count must be an integer greater than 0.
|
||||||
|
@ -78,7 +78,7 @@ public interface MetadataStore extends Closeable{
|
|||||||
* If the startKey is specified and found in levelDB, this key and the keys
|
* If the startKey is specified and found in levelDB, this key and the keys
|
||||||
* after this key will be included in the result. If the startKey is null
|
* after this key will be included in the result. If the startKey is null
|
||||||
* all entries will be included as long as other conditions are satisfied.
|
* all entries will be included as long as other conditions are satisfied.
|
||||||
* If the given startKey doesn't exist, an IOException will be thrown.
|
* If the given startKey doesn't exist and empty list will be returned.
|
||||||
* <p>
|
* <p>
|
||||||
* The count argument is to limit number of total entries to return,
|
* The count argument is to limit number of total entries to return,
|
||||||
* the value for count must be an integer greater than 0.
|
* the value for count must be an integer greater than 0.
|
||||||
|
@ -95,7 +95,7 @@ public void init() throws IOException {
|
|||||||
|
|
||||||
// Add 20 entries.
|
// Add 20 entries.
|
||||||
// {a0 : a-value0} to {a9 : a-value9}
|
// {a0 : a-value0} to {a9 : a-value9}
|
||||||
// {b0 : a-value0} to {b0 : b-value9}
|
// {b0 : b-value0} to {b9 : b-value9}
|
||||||
for (int i=0; i<10; i++) {
|
for (int i=0; i<10; i++) {
|
||||||
store.put(getBytes("a" + i), getBytes("a-value" + i));
|
store.put(getBytes("a" + i), getBytes("a-value" + i));
|
||||||
store.put(getBytes("b" + i), getBytes("b-value" + i));
|
store.put(getBytes("b" + i), getBytes("b-value" + i));
|
||||||
@ -242,6 +242,10 @@ public void testGetRangeKVs() throws IOException {
|
|||||||
Assert.assertEquals(5, result.size());
|
Assert.assertEquals(5, result.size());
|
||||||
Assert.assertEquals("a-value2", getString(result.get(2).getValue()));
|
Assert.assertEquals("a-value2", getString(result.get(2).getValue()));
|
||||||
|
|
||||||
|
// Empty list if startKey doesn't exist.
|
||||||
|
result = store.getRangeKVs(getBytes("a12"), 5);
|
||||||
|
Assert.assertEquals(0, result.size());
|
||||||
|
|
||||||
// Returns max available entries after a valid startKey.
|
// Returns max available entries after a valid startKey.
|
||||||
result = store.getRangeKVs(getBytes("b0"), MAX_GETRANGE_LENGTH);
|
result = store.getRangeKVs(getBytes("b0"), MAX_GETRANGE_LENGTH);
|
||||||
Assert.assertEquals(10, result.size());
|
Assert.assertEquals(10, result.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user