Examples of toByteArray()


Examples of org.apache.hadoop.hbase.HRegionInfo.toByteArray()

    byte [] hriSplitBytes = getBytes(r, which);
    if (!isMigrated(hriSplitBytes)) {
      //This will 'migrate' the HRI from 092.x and 0.94.x to 0.96+ by reading the
      //writable serialization
      HRegionInfo hri = parseFrom(hriSplitBytes);
      p.add(HConstants.CATALOG_FAMILY, which, hri.toByteArray());
    }
  }

  static HRegionInfo parseFrom(byte[] hriBytes) throws IOException {
    try {
View Full Code Here

Examples of org.apache.hadoop.hbase.HTableDescriptor.toByteArray()

    FSTableDescriptors fstd = new FSTableDescriptors(UTIL.getConfiguration(), fs, rootdir);
    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name));
    TableDescriptor td = new TableDescriptor(htd, TableState.State.ENABLED);
    Path descriptorFile = fstd.updateTableDescriptor(td);
    try (FSDataOutputStream out = fs.create(descriptorFile, true)) {
      out.write(htd.toByteArray());
    }
    FSTableDescriptors fstd2 = new FSTableDescriptors(UTIL.getConfiguration(), fs, rootdir);
    TableDescriptor td2 = fstd2.getDescriptor(htd.getTableName());
    assertEquals(td, td2);
    FileStatus descriptorFile2 =
View Full Code Here

Examples of org.apache.hadoop.hbase.RegionTransition.toByteArray()

    am.getZKTable().setEnabledTable(REGIONINFO.getTable());
    RegionTransition data = RegionTransition.createRegionTransition(EventType.RS_ZK_REGION_SPLITTING,
        REGIONINFO.getRegionName(), SERVERNAME_A);
    String node = ZKAssign.getNodeName(this.watcher, REGIONINFO.getEncodedName());
    // create znode in M_ZK_REGION_CLOSING state.
    ZKUtil.createAndWatch(this.watcher, node, data.toByteArray());

    try {
      processServerShutdownHandler(ct, am, regionSplitDone);
      // check znode deleted or not.
      // In both cases the znode should be deleted.
View Full Code Here

Examples of org.apache.hadoop.hbase.SplitLogTask.toByteArray()

  public void testOrphanTaskAcquisition() throws Exception {
    LOG.info("TestOrphanTaskAcquisition");

    String tasknode = ZKSplitLog.getEncodedNodeName(zkw, "orphan/test/slash");
    SplitLogTask slt = new SplitLogTask.Owned(DUMMY_MASTER);
    zkw.getRecoverableZooKeeper().create(tasknode, slt.toByteArray(), Ids.OPEN_ACL_UNSAFE,
        CreateMode.PERSISTENT);

    slm = new SplitLogManager(zkw, conf, stopper, master, DUMMY_MASTER);
    waitForCounter(tot_mgr_orphan_task_acquired, 0, 1, to/2);
    Task task = slm.findOrCreateOrphanTask(tasknode);
View Full Code Here

Examples of org.apache.hadoop.hbase.filter.Filter.toByteArray()

  }

  @Test public void testCompareFilter() throws Exception {
    Filter f = new RowFilter(CompareOp.EQUAL,
      new BinaryComparator(Bytes.toBytes("testRowOne-2")));
    byte [] bytes = f.toByteArray();
    Filter ff = RowFilter.parseFrom(bytes);
    assertNotNull(ff);
  }

  @Test public void testTableDescriptor() throws Exception {
View Full Code Here

Examples of org.apache.hadoop.hbase.filter.RowFilter.toByteArray()

  }

  @Test public void testCompareFilter() throws Exception {
    Filter f = new RowFilter(CompareOp.EQUAL,
      new BinaryComparator(Bytes.toBytes("testRowOne-2")));
    byte [] bytes = f.toByteArray();
    Filter ff = RowFilter.parseFrom(bytes);
    assertNotNull(ff);
  }

  @Test public void testTableDescriptor() throws Exception {
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.toByteArray()

    }

    private byte[] getMutationBytes() {
        try {
            MutationProto m = toMutationProto(this.mutation);
            return m.toByteArray();
        } catch (IOException e) {
            throw new IllegalArgumentException("Failed to get bytes for mutation!", e);
        }
    }
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ErrorHandlingProtos.ForeignExceptionMessage.toByteArray()

    }
    GenericExceptionMessage payload = gemBuilder.build();
    ForeignExceptionMessage.Builder exception = ForeignExceptionMessage.newBuilder();
    exception.setGenericException(payload).setSource(source);
    ForeignExceptionMessage eem = exception.build();
    return eem.toByteArray();
  }

  /**
   * Takes a series of bytes and tries to generate an ForeignException instance for it.
   * @param bytes
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.MetaRegionServer.toByteArray()

    // the znode content.
    MetaRegionServer pbrsr = MetaRegionServer.newBuilder()
      .setServer(ProtobufUtil.toServerName(serverName))
      .setRpcVersion(HConstants.RPC_CURRENT_VERSION)
      .setState(state.convert()).build();
    byte[] data = ProtobufUtil.prependPBMagic(pbrsr.toByteArray());
    try {
      ZKUtil.setData(zookeeper, zookeeper.metaServerZNode, data);
    } catch(KeeperException.NoNodeException nne) {
      LOG.debug("META region location doesn't existed, create it");
      ZKUtil.createAndWatch(zookeeper, zookeeper.metaServerZNode, data);
View Full Code Here

Examples of org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.ReplicationPeer.toByteArray()

  private void migrateClusterKeyToPB(ZooKeeperWatcher zkw, String peerZnode, byte[] data)
      throws KeeperException, NoNodeException {
    ReplicationPeer peer = ZooKeeperProtos.ReplicationPeer.newBuilder()
        .setClusterkey(Bytes.toString(data)).build();
    ZKUtil.setData(zkw, peerZnode, ProtobufUtil.prependPBMagic(peer.toByteArray()));
  }

  private void migratePeerStateToPB(ZooKeeperWatcher zkw, byte[] data,
String peerStatePath)
      throws KeeperException, NoNodeException {
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.