/** * @param cid * @return A {@link ClusterId} made from the passed in <code>cid</code> */ public static ClusterId convert(final ClusterIdProtos.ClusterId cid) { return new ClusterId(cid.getClusterId()); }
try { cid = in.readUTF(); clusterId = new ClusterId(cid); } catch (EOFException eof) { LOG.warn("Cluster ID file " + idPath.toString() + " was empty");
FSUtils.setClusterId(fs, rd, new ClusterId(), c.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000));
/** * @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix * @return An instance of {@link ClusterId} made from <code>bytes</code> * @throws DeserializationException * @see #toByteArray() */ public static ClusterId parseFrom(final byte [] bytes) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(bytes)) { int pblen = ProtobufUtil.lengthOfPBMagic(); ClusterIdProtos.ClusterId.Builder builder = ClusterIdProtos.ClusterId.newBuilder(); ClusterIdProtos.ClusterId cid = null; try { ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen); cid = builder.build(); } catch (IOException e) { throw new DeserializationException(e); } return convert(cid); } else { // Presume it was written out this way, the old way. return new ClusterId(Bytes.toString(bytes)); } }
private static String initPeerClusterState(String baseZKNode) throws IOException, KeeperException { // Add a dummy region server and set up the cluster id Configuration testConf = new Configuration(conf); testConf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, baseZKNode); ZKWatcher zkw1 = new ZKWatcher(testConf, "test1", null); String fakeRs = ZNodePaths.joinZNode(zkw1.getZNodePaths().rsZNode, "hostname1.example.org:1234"); ZKUtil.createWithParents(zkw1, fakeRs); ZKClusterId.setClusterId(zkw1, new ClusterId()); return ZKConfig.getZooKeeperClusterKey(testConf); }
builder.setClusterId(new ClusterId(metrics.getClusterId()).convert());
@Before public void setUp() throws Exception { zkw = HBaseTestingUtility.getZooKeeperWatcher(utility); String fakeRs1 = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234"); try { ZKClusterId.setClusterId(zkw, new ClusterId()); rp = ReplicationFactory.getReplicationPeers(zkw, conf); rp.init(); rt = ReplicationFactory.getReplicationTracker(zkw, new DummyServer(fakeRs1), new DummyServer(fakeRs1)); } catch (Exception e) { fail("Exception during test setup: " + e); } rsRemovedCount = new AtomicInteger(0); rsRemovedData = ""; }
/** * @param cid * @return A {@link ClusterId} made from the passed in <code>cid</code> */ public static ClusterId convert(final ClusterIdProtos.ClusterId cid) { return new ClusterId(cid.getClusterId()); }
ZKUtil.setData(zkw, "/hbase/replication/state", ZKReplicationPeerStorage.ENABLED_ZNODE_BYTES); ZKClusterId.setClusterId(zkw, new ClusterId()); FSUtils.setRootDir(utility.getConfiguration(), utility.getDataTestDir()); fs = FileSystem.get(conf);
/** * @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix * @return An instance of {@link ClusterId} made from <code>bytes</code> * @throws DeserializationException * @see #toByteArray() */ public static ClusterId parseFrom(final byte [] bytes) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(bytes)) { int pblen = ProtobufUtil.lengthOfPBMagic(); ClusterIdProtos.ClusterId.Builder builder = ClusterIdProtos.ClusterId.newBuilder(); ClusterIdProtos.ClusterId cid = null; try { ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen); cid = builder.build(); } catch (IOException e) { throw new DeserializationException(e); } return convert(cid); } else { // Presume it was written out this way, the old way. return new ClusterId(Bytes.toString(bytes)); } }
builder.setClusterId(new ClusterId(metrics.getClusterId()).convert());
/** * @param cid * @return A {@link ClusterId} made from the passed in <code>cid</code> */ public static ClusterId convert(final ClusterIdProtos.ClusterId cid) { return new ClusterId(cid.getClusterId()); }
/** * @param cid * @return A {@link ClusterId} made from the passed in <code>cid</code> */ static ClusterId convert(final ClusterIdProtos.ClusterId cid) { return new ClusterId(cid.getClusterId()); }
try { cid = in.readUTF(); clusterId = new ClusterId(cid); } catch (EOFException eof) { LOG.warn("Cluster ID file " + idPath.toString() + " was empty");
/** * @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix * @return An instance of {@link ClusterId} made from <code>bytes</code> * @throws DeserializationException * @see #toByteArray() */ public static ClusterId parseFrom(final byte [] bytes) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(bytes)) { int pblen = ProtobufUtil.lengthOfPBMagic(); ClusterIdProtos.ClusterId.Builder builder = ClusterIdProtos.ClusterId.newBuilder(); ClusterIdProtos.ClusterId cid = null; try { ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen); cid = builder.build(); } catch (IOException e) { throw new DeserializationException(e); } return convert(cid); } else { // Presume it was written out this way, the old way. return new ClusterId(Bytes.toString(bytes)); } }
/** * @param bytes A pb serialized {@link ClusterId} instance with pb magic prefix * @return An instance of {@link ClusterId} made from <code>bytes</code> * @throws DeserializationException * @see #toByteArray() */ public static ClusterId parseFrom(final byte [] bytes) throws DeserializationException { if (ProtobufUtil.isPBMagicPrefix(bytes)) { int pblen = ProtobufUtil.lengthOfPBMagic(); ClusterIdProtos.ClusterId.Builder builder = ClusterIdProtos.ClusterId.newBuilder(); ClusterIdProtos.ClusterId cid = null; try { ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen); cid = builder.build(); } catch (IOException e) { throw new DeserializationException(e); } return convert(cid); } else { // Presume it was written out this way, the old way. return new ClusterId(Bytes.toString(bytes)); } }
builder.setClusterId(new ClusterId(metrics.getClusterId()).convert());
builder.setClusterId(new ClusterId(clusterId).convert());
ZKUtil.setData(zkw, "/hbase/replication/state", ZKReplicationPeerStorage.ENABLED_ZNODE_BYTES); ZKClusterId.setClusterId(zkw, new ClusterId()); FSUtils.setRootDir(utility.getConfiguration(), utility.getDataTestDir()); fs = FileSystem.get(conf);
@Before public void setUp() throws Exception { zkw = HBaseTestingUtility.getZooKeeperWatcher(utility); String fakeRs1 = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234"); try { ZKClusterId.setClusterId(zkw, new ClusterId()); rp = ReplicationFactory.getReplicationPeers(zkw, conf); rp.init(); rt = ReplicationFactory.getReplicationTracker(zkw, new DummyServer(fakeRs1), new DummyServer(fakeRs1)); } catch (Exception e) { fail("Exception during test setup: " + e); } rsRemovedCount = new AtomicInteger(0); rsRemovedData = ""; }