Repository: hadoop Updated Branches: refs/heads/HDFS-7240 218f6f61b -> 1e1fe06ac
HDFS-12692. Ozone: fix javadoc/unit test for calling MetadataStore.getRangeKVs with non existing key. Contributed by Elek, Marton. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1e1fe06a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1e1fe06a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1e1fe06a Branch: refs/heads/HDFS-7240 Commit: 1e1fe06ac6e8221a964e83b8e7cd940992196a23 Parents: 218f6f6 Author: Yiqun Lin <[email protected]> Authored: Tue Oct 24 19:27:48 2017 +0800 Committer: Yiqun Lin <[email protected]> Committed: Tue Oct 24 19:27:48 2017 +0800 ---------------------------------------------------------------------- .../src/main/java/org/apache/hadoop/utils/LevelDBStore.java | 2 +- .../src/main/java/org/apache/hadoop/utils/MetadataStore.java | 2 +- .../test/java/org/apache/hadoop/ozone/TestMetadataStore.java | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e1fe06a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/LevelDBStore.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/LevelDBStore.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/LevelDBStore.java index 57ae538..38cee76 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/LevelDBStore.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/LevelDBStore.java @@ -286,7 +286,7 @@ public class LevelDBStore implements MetadataStore { * 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 * 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> * The count argument is to limit number of total entries to return, * the value for count must be an integer greater than 0. http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e1fe06a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/MetadataStore.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/MetadataStore.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/MetadataStore.java index 9a17bb5..b90b08f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/MetadataStore.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/utils/MetadataStore.java @@ -78,7 +78,7 @@ public interface MetadataStore extends Closeable{ * 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 * 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> * The count argument is to limit number of total entries to return, * the value for count must be an integer greater than 0. http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e1fe06a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestMetadataStore.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestMetadataStore.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestMetadataStore.java index 9442e99..da42c48 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestMetadataStore.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/ozone/TestMetadataStore.java @@ -95,7 +95,7 @@ public class TestMetadataStore { // Add 20 entries. // {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++) { store.put(getBytes("a" + i), getBytes("a-value" + i)); store.put(getBytes("b" + i), getBytes("b-value" + i)); @@ -242,6 +242,10 @@ public class TestMetadataStore { Assert.assertEquals(5, result.size()); 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. result = store.getRangeKVs(getBytes("b0"), MAX_GETRANGE_LENGTH); Assert.assertEquals(10, result.size()); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
