Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Result


              a.add(fam1, qual2, val);
              a.add(fam2, qual3, val);
              region.append(a);

              Get g = new Get(row);
              Result result = region.get(g);
              assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam1, qual2).length);
              assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam2, qual3).length);
            } catch (IOException e) {
              e.printStackTrace();
              failures.incrementAndGet();
              fail();
            }
          }
        }
      };
    }

    // run all threads
    for (int i = 0; i < numThreads; i++) {
      all[i].start();
    }

    // wait for all threads to finish
    for (int i = 0; i < numThreads; i++) {
      try {
        all[i].join();
      } catch (InterruptedException e) {
      }
    }
    assertEquals(0, failures.get());
    Get g = new Get(row);
    Result result = region.get(g);
    assertEquals(result.getValue(fam1, qual1).length, 10000);
    assertEquals(result.getValue(fam1, qual2).length, 10000);
    assertEquals(result.getValue(fam2, qual3).length, 10000);
  }
View Full Code Here


              }
              region.mutateRow(rm);
              op ^= true;
              // check: should always see exactly one column
              Get g = new Get(row);
              Result r = region.get(g);
              if (r.size() != 1) {
                LOG.debug(r);
                failures.incrementAndGet();
                fail();
              }
            } catch (IOException e) {
View Full Code Here

          inc.addColumn(fam2, qual3, amount*3);
          region.increment(inc);

          // verify: Make sure we only see completed increments
          Get g = new Get(row);
          Result result = region.get(g);
          assertEquals(Bytes.toLong(result.getValue(fam1, qual1))*2, Bytes.toLong(result.getValue(fam1, qual2)));
          assertEquals(Bytes.toLong(result.getValue(fam1, qual1))*3, Bytes.toLong(result.getValue(fam2, qual3)));
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here

        maxSeqIdInStores.put(store.getColumnFamilyName().getBytes(), minSeqId - 1);
      }
      long seqId = region.replayRecoveredEditsIfAny(regiondir, maxSeqIdInStores, null, status);
      assertEquals(maxSeqId, seqId);
      Get get = new Get(row);
      Result result = region.get(get);
      for (long i = minSeqId; i <= maxSeqId; i += 10) {
        List<Cell> kvs = result.getColumnCells(family, Bytes.toBytes(i));
        assertEquals(1, kvs.size());
        assertArrayEquals(Bytes.toBytes(i), CellUtil.cloneValue(kvs.get(0)));
      }
    } finally {
      HRegion.closeHRegion(this.region);
View Full Code Here

        maxSeqIdInStores.put(store.getColumnFamilyName().getBytes(), recoverSeqId - 1);
      }
      long seqId = region.replayRecoveredEditsIfAny(regiondir, maxSeqIdInStores, null, status);
      assertEquals(maxSeqId, seqId);
      Get get = new Get(row);
      Result result = region.get(get);
      for (long i = minSeqId; i <= maxSeqId; i += 10) {
        List<Cell> kvs = result.getColumnCells(family, Bytes.toBytes(i));
        if (i < recoverSeqId) {
          assertEquals(0, kvs.size());
        } else {
          assertEquals(1, kvs.size());
          assertArrayEquals(Bytes.toBytes(i), CellUtil.cloneValue(kvs.get(0)));
View Full Code Here

      files = FSUtils.listStatus(fs, tmpDir);
      assertTrue("Expected to find 0 files inside " + tmpDir, files == null || files.length == 0);

      for (long i = minSeqId; i < maxSeqId; i++) {
        Get get = new Get(Bytes.toBytes(i));
        Result result = region.get(get);
        byte[] value = result.getValue(family, Bytes.toBytes(i));
        assertArrayEquals(Bytes.toBytes(i), value);
      }
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
View Full Code Here

      Get get = new Get(row1);
      get.addColumn(fam1, qf1);
      get.addColumn(fam1, qf3);
      get.addColumn(fam2, qf2);
      Result r = region.get(get);
      assertEquals(2, r.size());
      assertArrayEquals(val1, r.getValue(fam1, qf1));
      assertArrayEquals(val2, r.getValue(fam2, qf2));

      // Family delete
      delete = new Delete(row1);
      delete.deleteFamily(fam2);
      res = region.checkAndMutate(row1, fam2, qf1, CompareOp.EQUAL, new BinaryComparator(emptyVal),
          delete, true);
      assertEquals(true, res);

      get = new Get(row1);
      r = region.get(get);
      assertEquals(1, r.size());
      assertArrayEquals(val1, r.getValue(fam1, qf1));

      // Row delete
      delete = new Delete(row1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val1),
          delete, true);
      assertEquals(true, res);
      get = new Get(row1);
      r = region.get(get);
      assertEquals(0, r.size());
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
    }
  }
View Full Code Here

      delete.deleteColumn(fam1, qual);
      region.delete(delete);

      Get get = new Get(row1);
      get.addFamily(fam1);
      Result r = region.get(get);
      assertEquals(0, r.size());
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
    }
  }
View Full Code Here

      delete.deleteColumns(fam, splitA);
      region.delete(delete);

      // assert some things:
      Get get = new Get(row).addColumn(fam, serverinfo);
      Result result = region.get(get);
      assertEquals(1, result.size());

      get = new Get(row).addColumn(fam, splitA);
      result = region.get(get);
      assertEquals(0, result.size());

      get = new Get(row).addColumn(fam, splitB);
      result = region.get(get);
      assertEquals(1, result.size());

      // Assert that after a delete, I can put.
      put = new Put(row);
      put.add(fam, splitA, Bytes.toBytes("reference_A"));
      region.put(put);
      get = new Get(row);
      result = region.get(get);
      assertEquals(3, result.size());

      // Now delete all... then test I can add stuff back
      delete = new Delete(row);
      region.delete(delete);
      assertEquals(0, region.get(get).size());

      region.put(new Put(row).add(fam, splitA, Bytes.toBytes("reference_A")));
      result = region.get(get);
      assertEquals(1, result.size());
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
    }
  }
View Full Code Here

      Delete delete = new Delete(row);
      region.delete(delete);

      // make sure we still see our data
      Get get = new Get(row).addColumn(fam, serverinfo);
      Result result = region.get(get);
      assertEquals(1, result.size());

      // delete the future row
      delete = new Delete(row, HConstants.LATEST_TIMESTAMP - 3);
      region.delete(delete);

      // make sure it is gone
      get = new Get(row).addColumn(fam, serverinfo);
      result = region.get(get);
      assertEquals(0, result.size());
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.Result

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.