当前位置: 首页>>代码示例>>Java>>正文


Java AdminProtos.ReplicateWALEntryRequest方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ReplicateWALEntryRequest方法的典型用法代码示例。如果您正苦于以下问题:Java AdminProtos.ReplicateWALEntryRequest方法的具体用法?Java AdminProtos.ReplicateWALEntryRequest怎么用?Java AdminProtos.ReplicateWALEntryRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.protobuf.generated.AdminProtos的用法示例。


在下文中一共展示了AdminProtos.ReplicateWALEntryRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replayToServer

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
private void replayToServer(HRegionInfo regionInfo, List<Entry> entries)
    throws IOException, ServiceException {
  if (entries.isEmpty()) return;

  Entry[] entriesArray = new Entry[entries.size()];
  entriesArray = entries.toArray(entriesArray);
  AdminService.BlockingInterface remoteSvr = conn.getAdmin(getLocation().getServerName());

  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
      ReplicationProtbufUtil.buildReplicateWALEntryRequest(entriesArray);
  PayloadCarryingRpcController controller = rpcControllerFactory.newController(p.getSecond());
  try {
    remoteSvr.replay(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:WALEditsReplaySink.java

示例2: replayToServer

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
private void replayToServer(HRegionInfo regionInfo, List<HLog.Entry> entries)
    throws IOException, ServiceException {
  if (entries.isEmpty()) return;

  HLog.Entry[] entriesArray = new HLog.Entry[entries.size()];
  entriesArray = entries.toArray(entriesArray);
  AdminService.BlockingInterface remoteSvr = conn.getAdmin(getLocation().getServerName());

  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
      ReplicationProtbufUtil.buildReplicateWALEntryRequest(entriesArray);
  try {
    PayloadCarryingRpcController controller = new PayloadCarryingRpcController(p.getSecond());
    remoteSvr.replay(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:18,代码来源:WALEditsReplaySink.java

示例3: replayToServer

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
private void replayToServer(HRegionInfo regionInfo, List<HLog.Entry> entries)
    throws IOException, ServiceException {
  if (entries.isEmpty()) return;

  HLog.Entry[] entriesArray = new HLog.Entry[entries.size()];
  entriesArray = entries.toArray(entriesArray);
  AdminService.BlockingInterface remoteSvr = conn.getAdmin(getLocation().getServerName());

  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
      ReplicationProtbufUtil.buildReplicateWALEntryRequest(entriesArray);
  PayloadCarryingRpcController controller = rpcControllerFactory.newController(p.getSecond());
  try {
    remoteSvr.replay(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:18,代码来源:WALEditsReplaySink.java

示例4: replicateWALEntry

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * A helper to replicate a list of WAL entries using admin protocol.
 *
 * @param admin
 * @param entries
 * @throws java.io.IOException
 */
public static void replicateWALEntry(final AdminService.BlockingInterface admin,
    final Entry[] entries) throws IOException {
  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
    buildReplicateWALEntryRequest(entries, null);
  PayloadCarryingRpcController controller = new PayloadCarryingRpcController(p.getSecond());
  try {
    admin.replicateWALEntry(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:ReplicationProtbufUtil.java

示例5: replicateWALEntry

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * A helper to replicate a list of WAL entries using admin protocol.
 *
 * @param admin
 * @param entries
 * @throws java.io.IOException
 */
public static void replicateWALEntry(final AdminService.BlockingInterface admin,
    final Entry[] entries) throws IOException {
  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
    buildReplicateWALEntryRequest(entries);
  PayloadCarryingRpcController controller = new PayloadCarryingRpcController(p.getSecond());
  try {
    admin.replicateWALEntry(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:19,代码来源:ReplicationProtbufUtil.java

示例6: replicateWALEntry

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * A helper to replicate a list of HLog entries using admin protocol.
 *
 * @param admin
 * @param entries
 * @throws java.io.IOException
 */
public static void replicateWALEntry(final AdminService.BlockingInterface admin,
    final HLog.Entry[] entries) throws IOException {
  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
    buildReplicateWALEntryRequest(entries);
  try {
    PayloadCarryingRpcController controller = new PayloadCarryingRpcController(p.getSecond());
    admin.replicateWALEntry(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:19,代码来源:ReplicationProtbufUtil.java

示例7: replicateWALEntry

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * A helper to replicate a list of HLog entries using admin protocol.
 *
 * @param admin
 * @param entries
 * @throws java.io.IOException
 */
public static void replicateWALEntry(final AdminService.BlockingInterface admin,
    final HLog.Entry[] entries) throws IOException {
  Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
    buildReplicateWALEntryRequest(entries);
  PayloadCarryingRpcController controller = new PayloadCarryingRpcController(p.getSecond());
  try {
    admin.replicateWALEntry(controller, p.getFirst());
  } catch (ServiceException se) {
    throw ProtobufUtil.getRemoteException(se);
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:19,代码来源:ReplicationProtbufUtil.java

示例8: replayToServer

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
private ReplicateWALEntryResponse replayToServer(List<Entry> entries, int timeout)
    throws IOException {
  // check whether we should still replay this entry. If the regions are changed, or the
  // entry is not coming form the primary region, filter it out because we do not need it.
  // Regions can change because of (1) region split (2) region merge (3) table recreated
  boolean skip = false;

  if (!Bytes.equals(location.getRegionInfo().getEncodedNameAsBytes(),
    initialEncodedRegionName)) {
    skip = true;
  }
  if (!entries.isEmpty() && !skip) {
    Entry[] entriesArray = new Entry[entries.size()];
    entriesArray = entries.toArray(entriesArray);

    // set the region name for the target region replica
    Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner> p =
        ReplicationProtbufUtil.buildReplicateWALEntryRequest(
          entriesArray, location.getRegionInfo().getEncodedNameAsBytes());
    try {
      PayloadCarryingRpcController controller = rpcControllerFactory.newController(p.getSecond());
      controller.setCallTimeout(timeout);
      controller.setPriority(tableName);
      return stub.replay(controller, p.getFirst());
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
  }

  if (skip) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("Skipping " + entries.size() + " entries in table " + tableName
        + " because located region " + location.getRegionInfo().getEncodedName()
        + " is different than the original region "
        + Bytes.toStringBinary(initialEncodedRegionName) + " from WALEdit");
      for (Entry entry : entries) {
        LOG.trace("Skipping : " + entry);
      }
    }
    skippedEntries.addAndGet(entries.size());
  }
  return ReplicateWALEntryResponse.newBuilder().build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:44,代码来源:RegionReplicaReplicationEndpoint.java

示例9: buildReplicateWALEntryRequest

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * Create a new ReplicateWALEntryRequest from a list of HLog entries
 *
 * @param entries the HLog entries to be replicated
 * @param encodedRegionName alternative region name to use if not null
 * @return a pair of ReplicateWALEntryRequest and a CellScanner over all the WALEdit values
 * found.
 */
public static Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>
    buildReplicateWALEntryRequest(final Entry[] entries, byte[] encodedRegionName) {
  // Accumulate all the KVs seen in here.
  List<List<? extends Cell>> allCells = new ArrayList<List<? extends Cell>>(entries.length);
  int size = 0;
  WALProtos.FamilyScope.Builder scopeBuilder = WALProtos.FamilyScope.newBuilder();
  AdminProtos.WALEntry.Builder entryBuilder = AdminProtos.WALEntry.newBuilder();
  AdminProtos.ReplicateWALEntryRequest.Builder builder =
    AdminProtos.ReplicateWALEntryRequest.newBuilder();
  HBaseProtos.UUID.Builder uuidBuilder = HBaseProtos.UUID.newBuilder();
  for (Entry entry: entries) {
    entryBuilder.clear();
    // TODO: this duplicates a lot in WALKey#getBuilder
    WALProtos.WALKey.Builder keyBuilder = entryBuilder.getKeyBuilder();
    WALKey key = entry.getKey();
    keyBuilder.setEncodedRegionName(
      ByteStringer.wrap(encodedRegionName == null
          ? key.getEncodedRegionName()
          : encodedRegionName));
    keyBuilder.setTableName(ByteStringer.wrap(key.getTablename().getName()));
    keyBuilder.setLogSequenceNumber(key.getLogSeqNum());
    keyBuilder.setWriteTime(key.getWriteTime());
    if (key.getNonce() != HConstants.NO_NONCE) {
      keyBuilder.setNonce(key.getNonce());
    }
    if (key.getNonceGroup() != HConstants.NO_NONCE) {
      keyBuilder.setNonceGroup(key.getNonceGroup());
    }
    for(UUID clusterId : key.getClusterIds()) {
      uuidBuilder.setLeastSigBits(clusterId.getLeastSignificantBits());
      uuidBuilder.setMostSigBits(clusterId.getMostSignificantBits());
      keyBuilder.addClusterIds(uuidBuilder.build());
    }
    if(key.getOrigLogSeqNum() > 0) {
      keyBuilder.setOrigSequenceNumber(key.getOrigLogSeqNum());
    }
    WALEdit edit = entry.getEdit();
    NavigableMap<byte[], Integer> scopes = key.getScopes();
    if (scopes != null && !scopes.isEmpty()) {
      for (Map.Entry<byte[], Integer> scope: scopes.entrySet()) {
        scopeBuilder.setFamily(ByteStringer.wrap(scope.getKey()));
        WALProtos.ScopeType scopeType =
            WALProtos.ScopeType.valueOf(scope.getValue().intValue());
        scopeBuilder.setScopeType(scopeType);
        keyBuilder.addScopes(scopeBuilder.build());
      }
    }
    List<Cell> cells = edit.getCells();
    // Add up the size.  It is used later serializing out the cells.
    for (Cell cell: cells) {
      size += CellUtil.estimatedSerializedSizeOf(cell);
    }
    // Collect up the cells
    allCells.add(cells);
    // Write out how many cells associated with this entry.
    entryBuilder.setAssociatedCellCount(cells.size());
    builder.addEntry(entryBuilder.build());
  }
  return new Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>(builder.build(),
    getCellScanner(allCells, size));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:70,代码来源:ReplicationProtbufUtil.java

示例10: buildReplicateWALEntryRequest

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * Create a new ReplicateWALEntryRequest from a list of WAL entries
 *
 * @param entries the WAL entries to be replicated
 * @return a pair of ReplicateWALEntryRequest and a CellScanner over all the WALEdit values
 * found.
 */
public static Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>
    buildReplicateWALEntryRequest(final Entry[] entries) {
  // Accumulate all the Cells seen in here.
  List<List<? extends Cell>> allCells = new ArrayList<List<? extends Cell>>(entries.length);
  int size = 0;
  WALProtos.FamilyScope.Builder scopeBuilder = WALProtos.FamilyScope.newBuilder();
  AdminProtos.WALEntry.Builder entryBuilder = AdminProtos.WALEntry.newBuilder();
  AdminProtos.ReplicateWALEntryRequest.Builder builder =
    AdminProtos.ReplicateWALEntryRequest.newBuilder();
  HBaseProtos.UUID.Builder uuidBuilder = HBaseProtos.UUID.newBuilder();
  for (Entry entry: entries) {
    entryBuilder.clear();
    // TODO: this duplicates a lot in WALKey#getBuilder
    WALProtos.WALKey.Builder keyBuilder = entryBuilder.getKeyBuilder();
    WALKey key = entry.getKey();
    keyBuilder.setEncodedRegionName(
      ByteStringer.wrap(key.getEncodedRegionName()));
    keyBuilder.setTableName(ByteStringer.wrap(key.getTablename().getName()));
    keyBuilder.setLogSequenceNumber(key.getLogSeqNum());
    keyBuilder.setWriteTime(key.getWriteTime());
    if (key.getNonce() != HConstants.NO_NONCE) {
      keyBuilder.setNonce(key.getNonce());
    }
    if (key.getNonceGroup() != HConstants.NO_NONCE) {
      keyBuilder.setNonceGroup(key.getNonceGroup());
    }
    for(UUID clusterId : key.getClusterIds()) {
      uuidBuilder.setLeastSigBits(clusterId.getLeastSignificantBits());
      uuidBuilder.setMostSigBits(clusterId.getMostSignificantBits());
      keyBuilder.addClusterIds(uuidBuilder.build());
    }
    if(key.getOrigLogSeqNum() > 0) {
      keyBuilder.setOrigSequenceNumber(key.getOrigLogSeqNum());
    }
    WALEdit edit = entry.getEdit();
    NavigableMap<byte[], Integer> scopes = key.getScopes();
    if (scopes != null && !scopes.isEmpty()) {
      for (Map.Entry<byte[], Integer> scope: scopes.entrySet()) {
        scopeBuilder.setFamily(ByteStringer.wrap(scope.getKey()));
        WALProtos.ScopeType scopeType =
            WALProtos.ScopeType.valueOf(scope.getValue().intValue());
        scopeBuilder.setScopeType(scopeType);
        keyBuilder.addScopes(scopeBuilder.build());
      }
    }
    List<Cell> cells = edit.getCells();
    // Add up the size.  It is used later serializing out the cells.
    for (Cell cell: cells) {
      size += CellUtil.estimatedSerializedSizeOf(cell);
    }
    // Collect up the cells
    allCells.add(cells);
    // Write out how many cells associated with this entry.
    entryBuilder.setAssociatedCellCount(cells.size());
    builder.addEntry(entryBuilder.build());
  }
  return new Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>(builder.build(),
    getCellScanner(allCells, size));
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:67,代码来源:ReplicationProtbufUtil.java

示例11: buildReplicateWALEntryRequest

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * Create a new ReplicateWALEntryRequest from a list of HLog entries
 *
 * @param entries the HLog entries to be replicated
 * @return a pair of ReplicateWALEntryRequest and a CellScanner over all the WALEdit values
 * found.
 */
public static Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>
    buildReplicateWALEntryRequest(final HLog.Entry[] entries) {
  // Accumulate all the KVs seen in here.
  List<List<? extends Cell>> allkvs = new ArrayList<List<? extends Cell>>(entries.length);
  int size = 0;
  WALProtos.FamilyScope.Builder scopeBuilder = WALProtos.FamilyScope.newBuilder();
  AdminProtos.WALEntry.Builder entryBuilder = AdminProtos.WALEntry.newBuilder();
  AdminProtos.ReplicateWALEntryRequest.Builder builder =
    AdminProtos.ReplicateWALEntryRequest.newBuilder();
  HBaseProtos.UUID.Builder uuidBuilder = HBaseProtos.UUID.newBuilder();
  for (HLog.Entry entry: entries) {
    entryBuilder.clear();
    // TODO: this duplicates a lot in HLogKey#getBuilder
    WALProtos.WALKey.Builder keyBuilder = entryBuilder.getKeyBuilder();
    HLogKey key = entry.getKey();
    keyBuilder.setEncodedRegionName(
      HBaseZeroCopyByteString.wrap(key.getEncodedRegionName()));
    keyBuilder.setTableName(HBaseZeroCopyByteString.wrap(key.getTablename().getName()));
    keyBuilder.setLogSequenceNumber(key.getLogSeqNum());
    keyBuilder.setWriteTime(key.getWriteTime());
    if (key.getNonce() != HConstants.NO_NONCE) {
      keyBuilder.setNonce(key.getNonce());
    }
    if (key.getNonceGroup() != HConstants.NO_NONCE) {
      keyBuilder.setNonceGroup(key.getNonceGroup());
    }
    for(UUID clusterId : key.getClusterIds()) {
      uuidBuilder.setLeastSigBits(clusterId.getLeastSignificantBits());
      uuidBuilder.setMostSigBits(clusterId.getMostSignificantBits());
      keyBuilder.addClusterIds(uuidBuilder.build());
    }
    WALEdit edit = entry.getEdit();
    NavigableMap<byte[], Integer> scopes = key.getScopes();
    if (scopes != null && !scopes.isEmpty()) {
      for (Map.Entry<byte[], Integer> scope: scopes.entrySet()) {
        scopeBuilder.setFamily(HBaseZeroCopyByteString.wrap(scope.getKey()));
        WALProtos.ScopeType scopeType =
            WALProtos.ScopeType.valueOf(scope.getValue().intValue());
        scopeBuilder.setScopeType(scopeType);
        keyBuilder.addScopes(scopeBuilder.build());
      }
    }
    List<KeyValue> kvs = edit.getKeyValues();
    // Add up the size.  It is used later serializing out the kvs.
    for (KeyValue kv: kvs) {
      size += kv.getLength();
    }
    // Collect up the kvs
    allkvs.add(kvs);
    // Write out how many kvs associated with this entry.
    entryBuilder.setAssociatedCellCount(kvs.size());
    builder.addEntry(entryBuilder.build());
  }
  return new Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>(builder.build(),
    getCellScanner(allkvs, size));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:64,代码来源:ReplicationProtbufUtil.java

示例12: buildReplicateWALEntryRequest

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
/**
 * Create a new ReplicateWALEntryRequest from a list of HLog entries
 *
 * @param entries the HLog entries to be replicated
 * @return a pair of ReplicateWALEntryRequest and a CellScanner over all the WALEdit values
 * found.
 */
public static Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>
    buildReplicateWALEntryRequest(final HLog.Entry[] entries) {
  // Accumulate all the KVs seen in here.
  List<List<? extends Cell>> allkvs = new ArrayList<List<? extends Cell>>(entries.length);
  int size = 0;
  WALProtos.FamilyScope.Builder scopeBuilder = WALProtos.FamilyScope.newBuilder();
  AdminProtos.WALEntry.Builder entryBuilder = AdminProtos.WALEntry.newBuilder();
  AdminProtos.ReplicateWALEntryRequest.Builder builder =
    AdminProtos.ReplicateWALEntryRequest.newBuilder();
  HBaseProtos.UUID.Builder uuidBuilder = HBaseProtos.UUID.newBuilder();
  for (HLog.Entry entry: entries) {
    entryBuilder.clear();
    WALProtos.WALKey.Builder keyBuilder = entryBuilder.getKeyBuilder();
    HLogKey key = entry.getKey();
    keyBuilder.setEncodedRegionName(
      ZeroCopyLiteralByteString.wrap(key.getEncodedRegionName()));
    keyBuilder.setTableName(ZeroCopyLiteralByteString.wrap(key.getTablename().getName()));
    keyBuilder.setLogSequenceNumber(key.getLogSeqNum());
    keyBuilder.setWriteTime(key.getWriteTime());
    for(UUID clusterId : key.getClusterIds()) {
      uuidBuilder.setLeastSigBits(clusterId.getLeastSignificantBits());
      uuidBuilder.setMostSigBits(clusterId.getMostSignificantBits());
      keyBuilder.addClusterIds(uuidBuilder.build());
    }
    WALEdit edit = entry.getEdit();
    NavigableMap<byte[], Integer> scopes = key.getScopes();
    if (scopes != null && !scopes.isEmpty()) {
      for (Map.Entry<byte[], Integer> scope: scopes.entrySet()) {
        scopeBuilder.setFamily(ZeroCopyLiteralByteString.wrap(scope.getKey()));
        WALProtos.ScopeType scopeType =
            WALProtos.ScopeType.valueOf(scope.getValue().intValue());
        scopeBuilder.setScopeType(scopeType);
        keyBuilder.addScopes(scopeBuilder.build());
      }
    }
    List<KeyValue> kvs = edit.getKeyValues();
    // Add up the size.  It is used later serializing out the kvs.
    for (KeyValue kv: kvs) {
      size += kv.getLength();
    }
    // Collect up the kvs
    allkvs.add(kvs);
    // Write out how many kvs associated with this entry.
    entryBuilder.setAssociatedCellCount(kvs.size());
    builder.addEntry(entryBuilder.build());
  }
  return new Pair<AdminProtos.ReplicateWALEntryRequest, CellScanner>(builder.build(),
    getCellScanner(allkvs, size));
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:57,代码来源:ReplicationProtbufUtil.java

示例13: replicateWALEntry

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
@Override
public AdminProtos.ReplicateWALEntryResponse replicateWALEntry(RpcController rpcController, AdminProtos.ReplicateWALEntryRequest replicateWALEntryRequest) throws ServiceException {
    throw new UnsupportedOperationException("Not implemented");
}
 
开发者ID:NGDATA,项目名称:hbase-indexer,代码行数:5,代码来源:BaseHRegionServer.java

示例14: replay

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
@Override
public AdminProtos.ReplicateWALEntryResponse replay(final RpcController controller, final AdminProtos.ReplicateWALEntryRequest request) throws ServiceException {
    throw new UnsupportedOperationException("Not implemented");
}
 
开发者ID:NGDATA,项目名称:hbase-indexer,代码行数:5,代码来源:BaseHRegionServer.java

示例15: replicateWALEntry

import org.apache.hadoop.hbase.protobuf.generated.AdminProtos; //导入方法依赖的package包/类
@Override
public AdminProtos.ReplicateWALEntryResponse replicateWALEntry(final RpcController controller,
        final AdminProtos.ReplicateWALEntryRequest request) throws ServiceException {
    try {

        // TODO Recording of last processed timestamp won't work if two batches of log entries are sent out of order
        long lastProcessedTimestamp = -1;

        SepEventExecutor eventExecutor = new SepEventExecutor(listener, executors, 100, sepMetrics);

        List<AdminProtos.WALEntry> entries = request.getEntryList();
        CellScanner cells = ((PayloadCarryingRpcController)controller).cellScanner();

        for (final AdminProtos.WALEntry entry : entries) {
            TableName tableName = (entry.getKey().getWriteTime() < subscriptionTimestamp) ? null :
                    TableName.valueOf(entry.getKey().getTableName().toByteArray());
            Multimap<ByteBuffer, Cell> keyValuesPerRowKey = ArrayListMultimap.create();
            final Map<ByteBuffer, byte[]> payloadPerRowKey = Maps.newHashMap();
            int count = entry.getAssociatedCellCount();
            for (int i = 0; i < count; i++) {
                if (!cells.advance()) {
                    throw new ArrayIndexOutOfBoundsException("Expected=" + count + ", index=" + i);
                }

                // this signals to us that we simply need to skip over count of cells
                if (tableName == null) {
                    continue;
                }

                Cell cell = cells.current();
                ByteBuffer rowKey = ByteBuffer.wrap(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
                byte[] payload;
                KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
                if (payloadExtractor != null && (payload = payloadExtractor.extractPayload(tableName.toBytes(), kv)) != null) {
                    if (payloadPerRowKey.containsKey(rowKey)) {
                        log.error("Multiple payloads encountered for row " + Bytes.toStringBinary(rowKey)
                                + ", choosing " + Bytes.toStringBinary(payloadPerRowKey.get(rowKey)));
                    } else {
                        payloadPerRowKey.put(rowKey, payload);
                    }
                }
                keyValuesPerRowKey.put(rowKey, kv);
            }

            for (final ByteBuffer rowKeyBuffer : keyValuesPerRowKey.keySet()) {
                final List<Cell> keyValues = (List<Cell>) keyValuesPerRowKey.get(rowKeyBuffer);

                final SepEvent sepEvent = new SepEvent(tableName.toBytes(), CellUtil.cloneRow(keyValues.get(0)), keyValues,
                        payloadPerRowKey.get(rowKeyBuffer));
                eventExecutor.scheduleSepEvent(sepEvent);
                lastProcessedTimestamp = Math.max(lastProcessedTimestamp, entry.getKey().getWriteTime());
            }

        }
        List<Future<?>> futures = eventExecutor.flush();
        waitOnSepEventCompletion(futures);

        if (lastProcessedTimestamp > 0) {
            sepMetrics.reportSepTimestamp(lastProcessedTimestamp);
        }
        return AdminProtos.ReplicateWALEntryResponse.newBuilder().build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
 
开发者ID:NGDATA,项目名称:hbase-indexer,代码行数:66,代码来源:SepConsumer.java


注:本文中的org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ReplicateWALEntryRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。