• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BulkLoadHFileRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest的典型用法代码示例。如果您正苦于以下问题:Java BulkLoadHFileRequest类的具体用法?Java BulkLoadHFileRequest怎么用?Java BulkLoadHFileRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BulkLoadHFileRequest类属于org.apache.hadoop.hbase.protobuf.generated.ClientProtos包,在下文中一共展示了BulkLoadHFileRequest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getMockedConnection

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private HConnection getMockedConnection(final Configuration conf)
throws IOException, ServiceException {
  HConnection c = Mockito.mock(HConnection.class);
  Mockito.when(c.getConfiguration()).thenReturn(conf);
  Mockito.doNothing().when(c).close();
  // Make it so we return a particular location when asked.
  final HRegionLocation loc = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
      ServerName.valueOf("example.org", 1234, 0));
  Mockito.when(c.getRegionLocation((TableName) Mockito.any(),
      (byte[]) Mockito.any(), Mockito.anyBoolean())).
    thenReturn(loc);
  Mockito.when(c.locateRegion((TableName) Mockito.any(), (byte[]) Mockito.any())).
    thenReturn(loc);
  ClientProtos.ClientService.BlockingInterface hri =
    Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);
  Mockito.when(hri.bulkLoadHFile((RpcController)Mockito.any(), (BulkLoadHFileRequest)Mockito.any())).
    thenThrow(new ServiceException(new IOException("injecting bulk load error")));
  Mockito.when(c.getClient(Mockito.any(ServerName.class))).
    thenReturn(hri);
  return c;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:TestLoadIncrementalHFilesSplitRecovery.java


示例2: buildBulkLoadHFileRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Create a protocol buffer bulk load request
 *
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @return a bulk load request
 */
public static BulkLoadHFileRequest buildBulkLoadHFileRequest(
    final List<Pair<byte[], String>> familyPaths,
    final byte[] regionName, boolean assignSeqNum) {
  BulkLoadHFileRequest.Builder builder = BulkLoadHFileRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  FamilyPath.Builder familyPathBuilder = FamilyPath.newBuilder();
  for (Pair<byte[], String> familyPath: familyPaths) {
    familyPathBuilder.setFamily(ByteStringer.wrap(familyPath.getFirst()));
    familyPathBuilder.setPath(familyPath.getSecond());
    builder.addFamilyPath(familyPathBuilder.build());
  }
  builder.setAssignSeqNum(assignSeqNum);
  return builder.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:RequestConverter.java


示例3: getMockedConnection

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
private HConnection getMockedConnection(final Configuration conf)
throws IOException, ServiceException {
  HConnection c = Mockito.mock(HConnection.class);
  Mockito.when(c.getConfiguration()).thenReturn(conf);
  Mockito.doNothing().when(c).close();
  // Make it so we return a particular location when asked.
  final HRegionLocation loc = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
      ServerName.valueOf("example.org", 1234, 0));
  Mockito.when(c.getRegionLocation((TableName) Mockito.any(),
      (byte[]) Mockito.any(), Mockito.anyBoolean())).
    thenReturn(loc);
  Mockito.when(c.locateRegion((TableName) Mockito.any(), (byte[]) Mockito.any())).
    thenReturn(loc);
  ClientProtos.ClientService.BlockingInterface hri =
    Mockito.mock(ClientProtos.ClientService.BlockingInterface.class);
  Mockito.when(hri.bulkLoadHFile((RpcController)Mockito.any(), (BulkLoadHFileRequest)Mockito.any())).
    thenThrow(new ServiceException(new IOException("injecting bulk load error")));
  Mockito.when(c.getClient(Mockito.any(ServerName.class))).
    thenReturn(hri);
  return c;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:22,代码来源:TestLoadIncrementalHFilesSplitRecovery.java


示例4: buildBulkLoadHFileRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Create a protocol buffer bulk load request
 *
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @return a bulk load request
 */
public static BulkLoadHFileRequest buildBulkLoadHFileRequest(
    final List<Pair<byte[], String>> familyPaths,
    final byte[] regionName, boolean assignSeqNum) {
  BulkLoadHFileRequest.Builder builder = BulkLoadHFileRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  FamilyPath.Builder familyPathBuilder = FamilyPath.newBuilder();
  for (Pair<byte[], String> familyPath: familyPaths) {
    familyPathBuilder.setFamily(HBaseZeroCopyByteString.wrap(familyPath.getFirst()));
    familyPathBuilder.setPath(familyPath.getSecond());
    builder.addFamilyPath(familyPathBuilder.build());
  }
  builder.setAssignSeqNum(assignSeqNum);
  return builder.build();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:RequestConverter.java


示例5: secureBulkLoadHFiles

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
@Override
public void secureBulkLoadHFiles(RpcController controller, SecureBulkLoadHFilesRequest request,
    RpcCallback<SecureBulkLoadHFilesResponse> done) {
  boolean loaded = false;
  Map<byte[], List<Path>> map = null;
  try {
    SecureBulkLoadManager secureBulkLoadManager = this.rsServices.getSecureBulkLoadManager();
    BulkLoadHFileRequest bulkLoadHFileRequest = ConvertSecureBulkLoadHFilesRequest(request);
    map = secureBulkLoadManager.secureBulkLoadHFiles((HRegion) this.env.getRegion(),
        convert(bulkLoadHFileRequest));
    loaded = map != null && !map.isEmpty();
  } catch (IOException e) {
    CoprocessorRpcUtils.setControllerException(controller, e);
  }
  done.run(SecureBulkLoadHFilesResponse.newBuilder().setLoaded(loaded).build());
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:SecureBulkLoadEndpoint.java


示例6: buildBulkLoadHFileRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Create a protocol buffer bulk load request
 *
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @return a bulk load request
 */
public static BulkLoadHFileRequest buildBulkLoadHFileRequest(
    final List<Pair<byte[], String>> familyPaths,
    final byte[] regionName, boolean assignSeqNum) {
  BulkLoadHFileRequest.Builder builder = BulkLoadHFileRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  FamilyPath.Builder familyPathBuilder = FamilyPath.newBuilder();
  for (Pair<byte[], String> familyPath: familyPaths) {
    familyPathBuilder.setFamily(ZeroCopyLiteralByteString.wrap(familyPath.getFirst()));
    familyPathBuilder.setPath(familyPath.getSecond());
    builder.addFamilyPath(familyPathBuilder.build());
  }
  builder.setAssignSeqNum(assignSeqNum);
  return builder.build();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:25,代码来源:RequestConverter.java


示例7: buildBulkLoadHFileRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Create a protocol buffer bulk load request
 *
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @return a bulk load request
 */
public static BulkLoadHFileRequest buildBulkLoadHFileRequest(
    final List<Pair<byte[], String>> familyPaths,
    final byte[] regionName, boolean assignSeqNum) {
  BulkLoadHFileRequest.Builder builder = BulkLoadHFileRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  FamilyPath.Builder familyPathBuilder = FamilyPath.newBuilder();
  for (Pair<byte[], String> familyPath: familyPaths) {
    familyPathBuilder.setFamily(ByteString.copyFrom(familyPath.getFirst()));
    familyPathBuilder.setPath(familyPath.getSecond());
    builder.addFamilyPath(familyPathBuilder.build());
  }
  builder.setAssignSeqNum(assignSeqNum);
  return builder.build();
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:25,代码来源:RequestConverter.java


示例8: getMockedConnection

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
private HConnection getMockedConnection(final Configuration conf)
throws IOException, ServiceException {
  HConnection c = Mockito.mock(HConnection.class);
  Mockito.when(c.getConfiguration()).thenReturn(conf);
  Mockito.doNothing().when(c).close();
  // Make it so we return a particular location when asked.
  final HRegionLocation loc = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
      "example.org", 1234);
  Mockito.when(c.getRegionLocation((byte[]) Mockito.any(),
      (byte[]) Mockito.any(), Mockito.anyBoolean())).
    thenReturn(loc);
  Mockito.when(c.locateRegion((byte[]) Mockito.any(), (byte[]) Mockito.any())).
    thenReturn(loc);
  ClientProtocol hri = Mockito.mock(ClientProtocol.class);
  Mockito.when(hri.bulkLoadHFile((RpcController)Mockito.any(), (BulkLoadHFileRequest)Mockito.any())).
    thenThrow(new ServiceException(new IOException("injecting bulk load error")));
  Mockito.when(c.getClient(Mockito.anyString(), Mockito.anyInt())).
    thenReturn(hri);
  return c;
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:21,代码来源:TestLoadIncrementalHFilesSplitRecovery.java


示例9: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Atomically bulk load several HFiles into an open region
 * @return true if successful, false is failed but recoverably (no action)
 * @throws ServiceException if failed unrecoverably
 */
@Override
public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,
    final BulkLoadHFileRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    Region region = getRegion(request.getRegion());
    List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>();
    for (FamilyPath familyPath: request.getFamilyPathList()) {
      familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(),
        familyPath.getPath()));
    }
    boolean bypass = false;
    if (region.getCoprocessorHost() != null) {
      bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
    }
    boolean loaded = false;
    if (!bypass) {
      loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum(), null);
    }
    if (region.getCoprocessorHost() != null) {
      loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);
    }
    BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder();
    builder.setLoaded(loaded);
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:RSRpcServices.java


示例10: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * A helper to bulk load a list of HFiles using client protocol.
 *
 * @param client
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @return true if all are loaded
 * @throws IOException
 */
public static boolean bulkLoadHFile(final ClientService.BlockingInterface client,
    final List<Pair<byte[], String>> familyPaths,
    final byte[] regionName, boolean assignSeqNum) throws IOException {
  BulkLoadHFileRequest request =
    RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum);
  try {
    BulkLoadHFileResponse response =
      client.bulkLoadHFile(null, request);
    return response.getLoaded();
  } catch (ServiceException se) {
    throw getRemoteException(se);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:ProtobufUtil.java


示例11: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Atomically bulk load several HFiles into an open region
 *
 * @return true if successful, false is failed but recoverably (no action)
 * @throws IOException if failed unrecoverably
 */
@Override
public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,
                                           final BulkLoadHFileRequest request) throws ServiceException {
    try {
        checkOpen();
        requestCount.increment();
        HRegion region = getRegion(request.getRegion());
        List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>();
        for (FamilyPath familyPath : request.getFamilyPathList()) {
            familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(),
                    familyPath.getPath()));
        }
        boolean bypass = false;
        if (region.getCoprocessorHost() != null) {
            bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
        }
        boolean loaded = false;
        if (!bypass) {
            loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum());
        }
        if (region.getCoprocessorHost() != null) {
            loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);
        }
        BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder();
        builder.setLoaded(loaded);
        return builder.build();
    } catch (IOException ie) {
        throw new ServiceException(ie);
    }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:37,代码来源:RSRpcServices.java


示例12: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Atomically bulk load several HFiles into an open region
 * @return true if successful, false is failed but recoverably (no action)
 * @throws IOException if failed unrecoverably
 */
@Override
public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,
    final BulkLoadHFileRequest request) throws ServiceException {
  try {
    checkOpen();
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>();
    for (FamilyPath familyPath: request.getFamilyPathList()) {
      familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(),
        familyPath.getPath()));
    }
    boolean bypass = false;
    if (region.getCoprocessorHost() != null) {
      bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
    }
    boolean loaded = false;
    if (!bypass) {
      loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum());
    }
    if (region.getCoprocessorHost() != null) {
      loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);
    }
    BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder();
    builder.setLoaded(loaded);
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:36,代码来源:HRegionServer.java


示例13: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * A helper to bulk load a list of HFiles using client protocol.
 *
 * @param client
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @param controller
 * @return true if all are loaded
 * @throws IOException
 */
public static boolean bulkLoadHFile(final ClientService.BlockingInterface client,
    final List<Pair<byte[], String>> familyPaths, final byte[] regionName, boolean assignSeqNum,
    PayloadCarryingRpcController controller) throws IOException {
  BulkLoadHFileRequest request =
    RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum);
  try {
    BulkLoadHFileResponse response =
      client.bulkLoadHFile(controller, request);
    return response.getLoaded();
  } catch (ServiceException se) {
    throw getRemoteException(se);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:25,代码来源:ProtobufUtil.java


示例14: convert

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest
convert(BulkLoadHFileRequest request)
    throws org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferException {
  byte [] bytes = request.toByteArray();
  org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest.Builder
      builder =
    org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.BulkLoadHFileRequest.
      newBuilder();
  builder.mergeFrom(bytes);
  return builder.build();
}
 
开发者ID:apache,项目名称:hbase,代码行数:12,代码来源:SecureBulkLoadEndpoint.java


示例15: ConvertSecureBulkLoadHFilesRequest

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
private BulkLoadHFileRequest ConvertSecureBulkLoadHFilesRequest(
    SecureBulkLoadHFilesRequest request) {
  BulkLoadHFileRequest.Builder bulkLoadHFileRequest = BulkLoadHFileRequest.newBuilder();
  RegionSpecifier region =
      ProtobufUtil.buildRegionSpecifier(RegionSpecifierType.REGION_NAME, this.env
          .getRegionInfo().getRegionName());
  bulkLoadHFileRequest.setRegion(region).setFsToken(request.getFsToken())
      .setBulkToken(request.getBulkToken()).setAssignSeqNum(request.getAssignSeqNum())
      .addAllFamilyPath(request.getFamilyPathList());
  return bulkLoadHFileRequest.build();
}
 
开发者ID:apache,项目名称:hbase,代码行数:12,代码来源:SecureBulkLoadEndpoint.java


示例16: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * Atomically bulk load several HFiles into an open region
 * @return true if successful, false is failed but recoverably (no action)
 * @throws IOException if failed unrecoverably
 */
@Override
public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,
    final BulkLoadHFileRequest request) throws ServiceException {
  try {
    requestCount.increment();
    HRegion region = getRegion(request.getRegion());
    List<Pair<byte[], String>> familyPaths = new ArrayList<Pair<byte[], String>>();
    for (FamilyPath familyPath: request.getFamilyPathList()) {
      familyPaths.add(new Pair<byte[], String>(familyPath.getFamily().toByteArray(),
        familyPath.getPath()));
    }
    boolean bypass = false;
    if (region.getCoprocessorHost() != null) {
      bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);
    }
    boolean loaded = false;
    if (!bypass) {
      loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum());
    }
    if (region.getCoprocessorHost() != null) {
      loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);
    }
    BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder();
    builder.setLoaded(loaded);
    return builder.build();
  } catch (IOException ie) {
    throw new ServiceException(ie);
  }
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:35,代码来源:HRegionServer.java


示例17: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
/**
 * A helper to bulk load a list of HFiles using client protocol.
 *
 * @param client
 * @param familyPaths
 * @param regionName
 * @param assignSeqNum
 * @return true if all are loaded
 * @throws IOException
 */
public static boolean bulkLoadHFile(final ClientProtocol client,
    final List<Pair<byte[], String>> familyPaths,
    final byte[] regionName, boolean assignSeqNum) throws IOException {
  BulkLoadHFileRequest request =
    RequestConverter.buildBulkLoadHFileRequest(familyPaths, regionName, assignSeqNum);
  try {
    BulkLoadHFileResponse response =
      client.bulkLoadHFile(null, request);
    return response.getLoaded();
  } catch (ServiceException se) {
    throw getRemoteException(se);
  }
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:24,代码来源:ProtobufUtil.java


示例18: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
@Override
public BulkLoadHFileResponse bulkLoadHFile(RpcController controller,
    BulkLoadHFileRequest request) throws ServiceException {
  // TODO Auto-generated method stub
  return null;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:MockRegionServer.java


示例19: doAnAction

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
public void doAnAction() throws Exception {
  long iteration = numBulkLoads.getAndIncrement();
  Path dir =  UTIL.getDataTestDirOnTestFS(String.format("bulkLoad_%08d",
      iteration));

  // create HFiles for different column families
  FileSystem fs = UTIL.getTestFileSystem();
  byte[] val = Bytes.toBytes(String.format("%010d", iteration));
  final List<Pair<byte[], String>> famPaths = new ArrayList<Pair<byte[], String>>(
      NUM_CFS);
  for (int i = 0; i < NUM_CFS; i++) {
    Path hfile = new Path(dir, family(i));
    byte[] fam = Bytes.toBytes(family(i));
    createHFile(fs, hfile, fam, QUAL, val, 1000);
    famPaths.add(new Pair<byte[], String>(fam, hfile.toString()));
  }

  // bulk load HFiles
  final HConnection conn = UTIL.getHBaseAdmin().getConnection();
  RegionServerCallable<Void> callable =
      new RegionServerCallable<Void>(conn, tableName, Bytes.toBytes("aaa")) {
    @Override
    public Void call(int callTimeout) throws Exception {
      LOG.debug("Going to connect to server " + getLocation() + " for row "
          + Bytes.toStringBinary(getRow()));
      byte[] regionName = getLocation().getRegionInfo().getRegionName();
      BulkLoadHFileRequest request =
        RequestConverter.buildBulkLoadHFileRequest(famPaths, regionName, true);
      getStub().bulkLoadHFile(null, request);
      return null;
    }
  };
  RpcRetryingCallerFactory factory = new RpcRetryingCallerFactory(conf);
  RpcRetryingCaller<Void> caller = factory.<Void> newCaller();
  caller.callWithRetries(callable, Integer.MAX_VALUE);

  // Periodically do compaction to reduce the number of open file handles.
  if (numBulkLoads.get() % 10 == 0) {
    // 10 * 50 = 500 open file handles!
    callable = new RegionServerCallable<Void>(conn, tableName, Bytes.toBytes("aaa")) {
      @Override
      public Void call(int callTimeout) throws Exception {
        LOG.debug("compacting " + getLocation() + " for row "
            + Bytes.toStringBinary(getRow()));
        AdminProtos.AdminService.BlockingInterface server =
          conn.getAdmin(getLocation().getServerName());
        CompactRegionRequest request =
          RequestConverter.buildCompactRegionRequest(
            getLocation().getRegionInfo().getRegionName(), true, null);
        server.compactRegion(null, request);
        numCompactions.incrementAndGet();
        return null;
      }
    };
    caller.callWithRetries(callable, Integer.MAX_VALUE);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:58,代码来源:TestHRegionServerBulkLoad.java


示例20: bulkLoadHFile

import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.BulkLoadHFileRequest; //导入依赖的package包/类
@Override
public BulkLoadHFileResponse bulkLoadHFile(
    RpcController controller, BulkLoadHFileRequest request)
    throws ServiceException {
  throw new NotImplementedException();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestClientNoCluster.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Presentation类代码示例发布时间:2022-05-22
下一篇:
Java TabItemInterface类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap