Examples of RowLock


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

    startRegionOperation();
    this.writeRequestsCount.increment();
    this.opMetrics.setWriteRequestCountMetrics(this.writeRequestsCount.get());
    try {
      RowLock lock = isPut ? ((Put)w).getRowLock() : ((Delete)w).getRowLock();
      Get get = new Get(row, lock);
      checkFamily(family);
      get.addColumn(family, qualifier);

      // Lock row
View Full Code Here

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

    byte[] qf1 = "qf1".getBytes();
   
    long ts = System.currentTimeMillis();
    int maxVersions = 2;
    long lockid = 5;
    RowLock rowLock = new RowLock(lockid);
   
    Get get = new Get(row, rowLock);
    get.addColumn(fam, qf1);
    get.setTimeRange(ts, ts+1);
    get.setMaxVersions(maxVersions);
View Full Code Here

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

      LOG.info("Updated row [" + Bytes.toString(update.getRow()) + "] val: ["
          + Bytes.toString(valueA) + "]");
  }

  private void updateLockedRow(int row, int newValue) throws IOException {
      RowLock lock = table.lockRow(PerformanceEvaluation.format(row));
      Put update = new Put(PerformanceEvaluation.format(row), lock);
      byte[] valueA = PerformanceEvaluation.format(newValue);
      update.add(FAMILY, QUAL_A, valueA);
      LOG.info("Updating row [" + Bytes.toString(update.getRow()) + "] val: ["
          + Bytes.toString(valueA) + "]");
View Full Code Here

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

  }

  private void updateLockedRowNoAutoFlush(int row, int newValue) throws IOException {
      table.flushCommits();
      table.setAutoFlush(false);
      RowLock lock = table.lockRow(PerformanceEvaluation.format(row));
      Put update = new Put(PerformanceEvaluation.format(row), lock);
      byte[] valueA = PerformanceEvaluation.format(newValue);
      update.add(FAMILY, QUAL_A, valueA);
      LOG.info("Updating row [" + Bytes.toString(update.getRow()) + "] val: ["
          + Bytes.toString(valueA) + "]");
View Full Code Here

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

  public void testLockedRowDelete() throws IOException {
    writeInitalRows();
    // Delete the first row;
    byte[] row = PerformanceEvaluation.format(0);
    RowLock lock = table.lockRow(row);
    table.delete(new Delete(row, HConstants.LATEST_TIMESTAMP, lock));
    table.unlockRow(lock);   

    assertRowDeleted(NUM_ROWS - 1)
  }
View Full Code Here

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

    startRegionOperation();
    this.writeRequestsCount.increment();
    this.opMetrics.setWriteRequestCountMetrics(this.writeRequestsCount.get());
    try {
      RowLock lock = isPut ? ((Put)w).getRowLock() : ((Delete)w).getRowLock();
      Get get = new Get(row, lock);
      checkFamily(family);
      get.addColumn(family, qualifier);

      // Lock row
View Full Code Here

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

    startRegionOperation();
    this.writeRequestsCount.increment();
    this.opMetrics.setWriteRequestCountMetrics(this.writeRequestsCount.get());
    try {
      RowLock lock = isPut ? ((Put)w).getRowLock() : ((Delete)w).getRowLock();
      Get get = new Get(row, lock);
      checkFamily(family);
      get.addColumn(family, qualifier);

      // Lock row
View Full Code Here

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

    if (!isPut && !(w instanceof Delete))
      throw new IOException("Action must be Put or Delete");

    startRegionOperation();
    try {
      RowLock lock = isPut ? ((Put)w).getRowLock() : ((Delete)w).getRowLock();
      Get get = new Get(row, lock);
      checkFamily(family);
      get.addColumn(family, qualifier);

      // Lock row
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.HRegion.RowLock

      }

      metricsAssertHelper.assertCounter("syncTimeNumOps", syncs + 2, source);

      LOG.info("Next a batch put that has to break into two batches to avoid a lock");
      RowLock rowLock = region.getRowLock(Bytes.toBytes("row_2"));

      MultithreadedTestUtil.TestContext ctx = new MultithreadedTestUtil.TestContext(conf);
      final AtomicReference<OperationStatus[]> retFromThread = new AtomicReference<OperationStatus[]>();
      TestThread putter = new TestThread(ctx) {
        @Override
        public void doWork() throws IOException {
          retFromThread.set(region.batchMutate(puts));
        }
      };
      LOG.info("...starting put thread while holding lock");
      ctx.addThread(putter);
      ctx.startThreads();

      LOG.info("...waiting for put thread to sync first time");
      long startWait = System.currentTimeMillis();
      while (metricsAssertHelper.getCounter("syncTimeNumOps", source) == syncs + 2) {
        Thread.sleep(100);
        if (System.currentTimeMillis() - startWait > 10000) {
          fail("Timed out waiting for thread to sync first minibatch");
        }
      }
      LOG.info("...releasing row lock, which should let put thread continue");
      rowLock.release();
      LOG.info("...joining on thread");
      ctx.stop();
      LOG.info("...checking that next batch was synced");
      metricsAssertHelper.assertCounter("syncTimeNumOps", syncs + 4, source);
      codes = retFromThread.get();
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.HRegion.RowLock

      }

      metricsAssertHelper.assertCounter("syncTimeNumOps", syncs + 2, source);

      LOG.info("Next a batch put that has to break into two batches to avoid a lock");
      RowLock rowLock = region.getRowLock(Bytes.toBytes("row_2"));

      MultithreadedTestUtil.TestContext ctx = new MultithreadedTestUtil.TestContext(conf);
      final AtomicReference<OperationStatus[]> retFromThread = new AtomicReference<OperationStatus[]>();
      TestThread putter = new TestThread(ctx) {
        @Override
        public void doWork() throws IOException {
          retFromThread.set(region.batchMutate(puts));
        }
      };
      LOG.info("...starting put thread while holding lock");
      ctx.addThread(putter);
      ctx.startThreads();

      LOG.info("...waiting for put thread to sync first time");
      long startWait = System.currentTimeMillis();
      while (metricsAssertHelper.getCounter("syncTimeNumOps", source) == syncs + 2) {
        Thread.sleep(100);
        if (System.currentTimeMillis() - startWait > 10000) {
          fail("Timed out waiting for thread to sync first minibatch");
        }
      }
      LOG.info("...releasing row lock, which should let put thread continue");
      rowLock.release();
      LOG.info("...joining on thread");
      ctx.stop();
      LOG.info("...checking that next batch was synced");
      metricsAssertHelper.assertCounter("syncTimeNumOps", syncs + 4, source);
      codes = retFromThread.get();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.