Package org.apache.hadoop.hbase.regionserver.wal

Examples of org.apache.hadoop.hbase.regionserver.wal.HLogKey


      for (FileStatus logStatus: FSUtils.listStatus(fs, regionEdits)) {
        HLog.Reader reader = HLogFactory.createReader(fs, logStatus.getPath(), conf);
        try {
          HLog.Entry entry;
          while ((entry = reader.next()) != null) {
            HLogKey key = entry.getKey();
            assertEquals(tableName, key.getTablename());
            assertArrayEquals(regionName, key.getEncodedRegionName());
          }
        } finally {
          reader.close();
        }
      }
View Full Code Here


        TableName tableName = getTableName(i);
        for (int j = 0; j < 10; ++j) {
          byte[] regionName = getRegionName(tableName, j);
          for (int k = 0; k < 50; ++k) {
            byte[] rowkey = Bytes.toBytes("row-" + k);
            HLogKey key = new HLogKey(regionName, tableName, (long)k,
              System.currentTimeMillis(), HConstants.DEFAULT_CLUSTER_ID);
            WALEdit edit = new WALEdit();
            edit.add(new KeyValue(rowkey, TEST_FAMILY, TEST_QUALIFIER, rowkey));
            writer.append(new HLog.Entry(key, edit));
          }
View Full Code Here

    for(long i = 1; i < 101; i++) {
      if(i > 1 && i % 20 == 0) {
        hlog.rollWriter();
      }
      LOG.info(i);
      HLogKey key = new HLogKey(hri.getRegionName(), test, seq++,
          System.currentTimeMillis(), HConstants.DEFAULT_CLUSTER_ID);
      hlog.append(hri, test, edit, System.currentTimeMillis(), htd);
    }

    // Simulate a rapid insert that's followed
View Full Code Here

        long time = System.nanoTime();
        WALEdit edit = new WALEdit();
        edit.add(new KeyValue(row, family, Bytes.toBytes(i),
            time, KeyValue.Type.Put, Bytes.toBytes(i)));
        writer.append(new HLog.Entry(new HLogKey(regionName, tableName,
            i, time, HConstants.DEFAULT_CLUSTER_ID), edit));

        writer.close();
      }
      MonitoredTask status = TaskMonitor.get().createStatus(method);
View Full Code Here

        long time = System.nanoTime();
        WALEdit edit = new WALEdit();
        edit.add(new KeyValue(row, family, Bytes.toBytes(i),
            time, KeyValue.Type.Put, Bytes.toBytes(i)));
        writer.append(new HLog.Entry(new HLogKey(regionName, tableName,
            i, time, HConstants.DEFAULT_CLUSTER_ID), edit));

        writer.close();
      }
      long recoverSeqId = 1030;
View Full Code Here

      fs.create(recoveredEdits);
      HLog.Writer writer = HLogFactory.createWriter(fs, recoveredEdits, conf);

      long time = System.nanoTime();

      writer.append(new HLog.Entry(new HLogKey(regionName, tableName, 10, time, HConstants.DEFAULT_CLUSTER_ID),
          WALEdit.createCompaction(compactionDescriptor)));
      writer.close();

      //close the region now, and reopen again
      HTableDescriptor htd = region.getTableDesc();
View Full Code Here

      WALEdit edit = entry.getEdit();
      this.metrics.logEditsReadRate.inc(1);
      seenEntries++;
      // Remove all KVs that should not be replicated
      removeNonReplicableEdits(edit);
      HLogKey logKey = entry.getKey();
      // Don't replicate catalog entries, if the WALEdit wasn't
      // containing anything to replicate and if we're currently not set to replicate
      if (!(Bytes.equals(logKey.getTablename(), HConstants.ROOT_TABLE_NAME) ||
          Bytes.equals(logKey.getTablename(), HConstants.META_TABLE_NAME)) &&
          edit.size() != 0 && replicating.get()) {
        logKey.setClusterId(this.clusterId);
        currentNbOperations += countDistinctRowKeys(edit);
        currentNbEntries++;
      } else {
        this.metrics.logEditsFilteredRate.inc(1);
      }
View Full Code Here

    for(int i = 0; i < 3; i++) {
      byte[] b = Bytes.toBytes(Integer.toString(i));
      KeyValue kv = new KeyValue(b,b,b);
      WALEdit edit = new WALEdit();
      edit.add(kv);
      HLogKey key = new HLogKey(b, b, 0, 0);
      writer.append(new HLog.Entry(key, edit));
      writer.sync();
    }
    writer.close();
View Full Code Here

    } else if (type.getCode() == KeyValue.Type.DeleteFamily.getCode()) {
        kv = new KeyValue(rowBytes, fam, null,
            now, KeyValue.Type.DeleteFamily);
    }

    HLogKey key = new HLogKey(table, table, now, now);

    WALEdit edit = new WALEdit();
    edit.add(kv);

    return new HLog.Entry(key, edit);
View Full Code Here

    for(long i = 1; i < 101; i++) {
      if(i > 1 && i % 20 == 0) {
        hlog.rollWriter();
      }
      LOG.info(i);
      HLogKey key = new HLogKey(hri.getRegionName(),
        test, seq++, System.currentTimeMillis());
      hlog.append(hri, key, edit);
    }

    // Simulate a rapid insert that's followed
    // by a report that's still not totally complete (missing last one)
    LOG.info(baseline + " and " + time);
    baseline += 101;
    time = baseline;
    LOG.info(baseline + " and " + time);

    for (int i = 0; i < 3; i++) {
      HLogKey key = new HLogKey(hri.getRegionName(),
        test, seq++, System.currentTimeMillis());
      hlog.append(hri, key, edit);
    }

    assertEquals(6, manager.getHLogs().size());

    hlog.rollWriter();

    manager.logPositionAndCleanOldLogs(manager.getSources().get(0).getCurrentPath(),
        "1", 0, false);

    HLogKey key = new HLogKey(hri.getRegionName(),
          test, seq++, System.currentTimeMillis());
    hlog.append(hri, key, edit);

    assertEquals(1, manager.getHLogs().size());
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.regionserver.wal.HLogKey

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.