当前位置:首页 > 开发 > 系统架构 > 架构 > 正文

hbase mvcc

发表于: 2015-04-03   作者:blackproof   来源:转载   浏览:
摘要:   MVCC相关源码:   在HBase put源码中 http://blackproof.iteye.com/blog/2197710   有mvcc用hregion的mvcc的write point,在生成mvcc的readpoint   KeyValueHeap类的next获取cell的时候使用keyvalue的mvcc的readpoint,判断

  MVCC相关源码:

  在HBase put源码中 http://blackproof.iteye.com/blog/2197710

  有mvcc用hregion的mvcc的write point,在生成mvcc的readpoint

  KeyValueHeap类的next获取cell的时候使用keyvalue的mvcc的readpoint,判断是否取当前kv

  

/**
   * Gets the next row of keys from the top-most scanner.
   * <p>
   * This method takes care of updating the heap.
   * <p>
   * This can ONLY be called when you are using Scanners that implement
   * InternalScanner as well as KeyValueScanner (a {@link StoreScanner}).
   * @param result
   * @param limit
   * @return true if there are more keys, false if all scanners are done
   */
  public boolean next(List<Cell> result, int limit) throws IOException {
    if (this.current == null) {
      return false;
    }
    InternalScanner currentAsInternal = (InternalScanner)this.current;
    boolean mayContainMoreRows = currentAsInternal.next(result, limit);
    KeyValue pee = this.current.peek();
    /*
     * By definition, any InternalScanner must return false only when it has no
     * further rows to be fetched. So, we can close a scanner if it returns
     * false. All existing implementations seem to be fine with this. It is much
     * more efficient to close scanners which are not needed than keep them in
     * the heap. This is also required for certain optimizations.
     */
    if (pee == null || !mayContainMoreRows) {
      this.current.close();
    } else {
      this.heap.add(this.current);
    }
    this.current = pollRealKV();
    return (this.current != null);
  }

 

hbase mvcc

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号