when reversing a Scan in HBase, which is the startKey and which is the stopKey?

橙三吉。 提交于 2019-12-11 03:25:14

问题


I'm using HBase 0.98 which allows scans in reverse order.

Here is my code:

    scan = new Scan(eventTimeKey, nowKey);
    scan.setCaching(1); // setting this to 1 since I only want the first result
    scan.setMaxResultSize(1L);
    scan.addColumn(dataBytes, readingBytes);
    scan.setReversed(true);
    try {
        scanner = getTable().getScanner(scan);
        result = scanner.next();
    } finally {
        if (scanner != null)
            scanner.close();
    }
    if (result != null && valueIsZero(result))
        return true;

My question is, what order should the arguments to the Scan constructor be in? Should startKey be 'aaa' and endKey be 'zzz' or the other way around? Or does it matter?

Update: turns out, we have HBase 0.96 on the server side so reverse scans are, apparently, not going to work. I think this explains the confusion I was having. Until we upgrade, my tests are not going to be able to answer this question so I'll leave this open in case someone else is interested.


回答1:


In case of reversed scan in HBase 0.98 onwards start key and end key are reversed.

Documentation Link explains this: Doc Link



来源:https://stackoverflow.com/questions/23390546/when-reversing-a-scan-in-hbase-which-is-the-startkey-and-which-is-the-stopkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!