Package org.apache.hadoop.hbase.regionserver

Examples of org.apache.hadoop.hbase.regionserver.KeyValueScanner


      StoreFileScanner scanner = reader.getStoreFileScanner(false, false);
      scanner.seek(fakeKV); // have to call seek of each underlying scanner, otherwise KeyValueHeap won't work
      scanners.add(scanner);
    }
    assertTrue(!scanners.isEmpty());
    KeyValueScanner kvh = new KeyValueHeap(scanners, KeyValue.COMPARATOR);
    boolean seekOk = kvh.seek(fakeKV);
    assertTrue(seekOk);
    KeyValue kv = kvh.next();
    kvh.close();
    return kv;
  }
View Full Code Here


      StoreFileScanner scanner = reader.getStoreFileScanner(false, false);
      scanner.seek(fakeKV); // have to call seek of each underlying scanner, otherwise KeyValueHeap won't work
      scanners.add(scanner);
    }
    assertTrue(!scanners.isEmpty());
    KeyValueScanner kvh = new KeyValueHeap(scanners, KeyValue.COMPARATOR);
    boolean seekOk = kvh.seek(fakeKV);
    assertTrue(seekOk);
    KeyValue kv = kvh.next();
    kvh.close();
    return kv;
  }
View Full Code Here

  public byte[] getCurrentRowKey() {
    return this.update.getRow();
  }

  public Result getCurrentRowState() {
    KeyValueScanner scanner = this.memstore.getScanner();
    List<KeyValue> kvs = new ArrayList<KeyValue>();
    while (scanner.peek() != null) {
      try {
        kvs.add(scanner.next());
      } catch (IOException e) {
        // this should never happen - something has gone terribly arwy if it has
        throw new RuntimeException("Local MemStore threw IOException!");
      }
    }
View Full Code Here

    KeyValue kv2 = new KeyValue(row, family, qual, ts, Type.Put, val2);
    kv2.setMemstoreTS(0);
    store.add(kv, true);
    // adding the exact same kv shouldn't change anything stored if not overwritting
    store.add(kv2, false);
    KeyValueScanner scanner = store.getScanner();
    KeyValue first = KeyValue.createFirstOnRow(row);
    scanner.seek(first);
    assertTrue("Overwrote kv when specifically not!", kv == scanner.next());
    scanner.close();

    // now when we overwrite, we should get the newer one
    store.add(kv2, true);
    scanner = store.getScanner();
    scanner.seek(first);
    assertTrue("Didn't overwrite kv when specifically requested!", kv2 == scanner.next());
    scanner.close();
  }
View Full Code Here

    store.add(dc, true);
    KeyValue d = new KeyValue(row, family, qual, 12, Type.Delete, null);
    store.add(d, true);

    // null qualifiers should always sort before the non-null cases
    KeyValueScanner scanner = store.getScanner();
    KeyValue first = KeyValue.createFirstOnRow(row);
    assertTrue("Didn't have any data in the scanner", scanner.seek(first));
    assertTrue("Didn't get delete family first (no qualifier == sort first)", df == scanner.next());
    assertTrue("Didn't get point delete before corresponding put", d == scanner.next());
    assertTrue("Didn't get larger ts Put", kv == scanner.next());
    assertTrue("Didn't get delete column before corresponding put(delete sorts first)",
      dc == scanner.next());
    assertTrue("Didn't get smaller ts Put", kv2 == scanner.next());
    assertNull("Have more data in the scanner", scanner.next());
  }
View Full Code Here

      StoreFileScanner scanner = reader.getStoreFileScanner(false, false);
      scanner.seek(fakeKV); // have to call seek of each underlying scanner, otherwise KeyValueHeap won't work
      scanners.add(scanner);
    }
    assertTrue(!scanners.isEmpty());
    KeyValueScanner kvh = new KeyValueHeap(scanners, KeyValue.COMPARATOR);
    boolean seekOk = kvh.seek(fakeKV);
    assertTrue(seekOk);
    KeyValue kv = kvh.next();
    kvh.close();
    return kv;
  }
View Full Code Here

  public byte[] getCurrentRowKey() {
    return this.update.getRow();
  }

  public Result getCurrentRowState() {
    KeyValueScanner scanner = this.memstore.getScanner();
    List<KeyValue> kvs = new ArrayList<KeyValue>();
    while (scanner.peek() != null) {
      try {
        kvs.add(scanner.next());
      } catch (IOException e) {
        // this should never happen - something has gone terribly arwy if it has
        throw new RuntimeException("Local MemStore threw IOException!");
      }
    }
View Full Code Here

    KeyValue kv2 = new KeyValue(row, family, qual, ts, Type.Put, val2);
    kv2.setMemstoreTS(0);
    store.add(kv, true);
    // adding the exact same kv shouldn't change anything stored if not overwritting
    store.add(kv2, false);
    KeyValueScanner scanner = store.getScanner();
    KeyValue first = KeyValue.createFirstOnRow(row);
    scanner.seek(first);
    assertTrue("Overwrote kv when specifically not!", kv == scanner.next());
    scanner.close();

    // now when we overwrite, we should get the newer one
    store.add(kv2, true);
    scanner = store.getScanner();
    scanner.seek(first);
    assertTrue("Didn't overwrite kv when specifically requested!", kv2 == scanner.next());
    scanner.close();
  }
View Full Code Here

    store.add(dc, true);
    KeyValue d = new KeyValue(row, family, qual, 12, Type.Delete, null);
    store.add(d, true);

    // null qualifiers should always sort before the non-null cases
    KeyValueScanner scanner = store.getScanner();
    KeyValue first = KeyValue.createFirstOnRow(row);
    assertTrue("Didn't have any data in the scanner", scanner.seek(first));
    assertTrue("Didn't get delete family first (no qualifier == sort first)", df == scanner.next());
    assertTrue("Didn't get point delete before corresponding put", d == scanner.next());
    assertTrue("Didn't get larger ts Put", kv == scanner.next());
    assertTrue("Didn't get delete column before corresponding put(delete sorts first)",
      dc == scanner.next());
    assertTrue("Didn't get smaller ts Put", kv2 == scanner.next());
    assertNull("Have more data in the scanner", scanner.next());
  }
View Full Code Here

    KeyValue kv2 = new KeyValue(row, family, qual, ts, Type.Put, val2);
    kv2.setMvccVersion(0);
    store.add(kv, true);
    // adding the exact same kv shouldn't change anything stored if not overwritting
    store.add(kv2, false);
    KeyValueScanner scanner = store.getScanner();
    KeyValue first = KeyValue.createFirstOnRow(row);
    scanner.seek(first);
    assertTrue("Overwrote kv when specifically not!", kv == scanner.next());
    scanner.close();

    // now when we overwrite, we should get the newer one
    store.add(kv2, true);
    scanner = store.getScanner();
    scanner.seek(first);
    assertTrue("Didn't overwrite kv when specifically requested!", kv2 == scanner.next());
    scanner.close();
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.regionserver.KeyValueScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.