Java Code Examples for org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos#TableName
The following examples show how to use
org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos#TableName .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BackupManifest.java From hbase with Apache License 2.0 | 6 votes |
static BackupImage fromProto(BackupProtos.BackupImage im) { String backupId = im.getBackupId(); String rootDir = im.getBackupRootDir(); long startTs = im.getStartTs(); long completeTs = im.getCompleteTs(); List<HBaseProtos.TableName> tableListList = im.getTableListList(); List<TableName> tableList = new ArrayList<>(); for (HBaseProtos.TableName tn : tableListList) { tableList.add(ProtobufUtil.toTableName(tn)); } List<BackupProtos.BackupImage> ancestorList = im.getAncestorsList(); BackupType type = im.getBackupType() == BackupProtos.BackupType.FULL ? BackupType.FULL : BackupType.INCREMENTAL; BackupImage image = new BackupImage(backupId, type, rootDir, tableList, startTs, completeTs); for (BackupProtos.BackupImage img : ancestorList) { image.addAncestor(fromProto(img)); } image.setIncrTimeRanges(loadIncrementalTimestampMap(im)); return image; }
Example 2
Source File: RegionServerSpaceQuotaManager.java From hbase with Apache License 2.0 | 6 votes |
/** * Builds the protobuf message to inform the Master of files being archived. * * @param tn The table the files previously belonged to. * @param archivedFiles The files and their size in bytes that were archived. * @return The protobuf representation */ public RegionServerStatusProtos.FileArchiveNotificationRequest buildFileArchiveRequest( TableName tn, Collection<Entry<String,Long>> archivedFiles) { RegionServerStatusProtos.FileArchiveNotificationRequest.Builder builder = RegionServerStatusProtos.FileArchiveNotificationRequest.newBuilder(); HBaseProtos.TableName protoTn = ProtobufUtil.toProtoTableName(tn); for (Entry<String,Long> archivedFile : archivedFiles) { RegionServerStatusProtos.FileArchiveNotificationRequest.FileWithSize fws = RegionServerStatusProtos.FileArchiveNotificationRequest.FileWithSize.newBuilder() .setName(archivedFile.getKey()) .setSize(archivedFile.getValue()) .setTableName(protoTn) .build(); builder.addArchivedFiles(fws); } final RegionServerStatusProtos.FileArchiveNotificationRequest request = builder.build(); if (LOG.isTraceEnabled()) { LOG.trace("Reporting file archival to Master: " + TextFormat.shortDebugString(request)); } return request; }
Example 3
Source File: RSGroupAdminServiceImpl.java From hbase with Apache License 2.0 | 6 votes |
@Override public void moveTables(RpcController controller, MoveTablesRequest request, RpcCallback<MoveTablesResponse> done) { MoveTablesResponse.Builder builder = MoveTablesResponse.newBuilder(); Set<TableName> tables = new HashSet<>(request.getTableNameList().size()); for (HBaseProtos.TableName tableName : request.getTableNameList()) { tables.add(ProtobufUtil.toTableName(tableName)); } LOG.info(master.getClientIdAuditPrefix() + " move tables " + tables + " to rsgroup " + request.getTargetGroup()); try { if (master.getMasterCoprocessorHost() != null) { master.getMasterCoprocessorHost().preMoveTables(tables, request.getTargetGroup()); } moveTablesAndWait(tables, request.getTargetGroup()); if (master.getMasterCoprocessorHost() != null) { master.getMasterCoprocessorHost().postMoveTables(tables, request.getTargetGroup()); } } catch (IOException e) { CoprocessorRpcUtils.setControllerException(controller, e); } done.run(builder.build()); }
Example 4
Source File: ProtobufUtil.java From hbase with Apache License 2.0 | 6 votes |
public static RSGroupProtos.RSGroupInfo toProtoGroupInfo(RSGroupInfo pojo) { List<HBaseProtos.TableName> tables = new ArrayList<>(pojo.getTables().size()); for (TableName arg : pojo.getTables()) { tables.add(ProtobufUtil.toProtoTableName(arg)); } List<HBaseProtos.ServerName> hostports = new ArrayList<>(pojo.getServers().size()); for (Address el : pojo.getServers()) { hostports.add(HBaseProtos.ServerName.newBuilder().setHostName(el.getHostname()) .setPort(el.getPort()).build()); } List<NameStringPair> configuration = pojo.getConfiguration().entrySet() .stream().map(entry -> NameStringPair.newBuilder() .setName(entry.getKey()).setValue(entry.getValue()).build()) .collect(Collectors.toList()); return RSGroupProtos.RSGroupInfo.newBuilder().setName(pojo.getName()).addAllServers(hostports) .addAllTables(tables).addAllConfiguration(configuration).build(); }
Example 5
Source File: MasterRpcServices.java From hbase with Apache License 2.0 | 5 votes |
/** * Get list of TableDescriptors for requested tables. * @param c Unused (set to null). * @param req GetTableDescriptorsRequest that contains: * - tableNames: requested tables, or if empty, all are requested. * @return GetTableDescriptorsResponse * @throws ServiceException */ @Override public GetTableDescriptorsResponse getTableDescriptors(RpcController c, GetTableDescriptorsRequest req) throws ServiceException { try { master.checkInitialized(); final String regex = req.hasRegex() ? req.getRegex() : null; final String namespace = req.hasNamespace() ? req.getNamespace() : null; List<TableName> tableNameList = null; if (req.getTableNamesCount() > 0) { tableNameList = new ArrayList<TableName>(req.getTableNamesCount()); for (HBaseProtos.TableName tableNamePB: req.getTableNamesList()) { tableNameList.add(ProtobufUtil.toTableName(tableNamePB)); } } List<TableDescriptor> descriptors = master.listTableDescriptors(namespace, regex, tableNameList, req.getIncludeSysTables()); GetTableDescriptorsResponse.Builder builder = GetTableDescriptorsResponse.newBuilder(); if (descriptors != null && descriptors.size() > 0) { // Add the table descriptors to the response for (TableDescriptor htd: descriptors) { builder.addTableSchema(ProtobufUtil.toTableSchema(htd)); } } return builder.build(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
Example 6
Source File: RSGroupAdminServiceImpl.java From hbase with Apache License 2.0 | 5 votes |
@Override public void moveServersAndTables(RpcController controller, MoveServersAndTablesRequest request, RpcCallback<MoveServersAndTablesResponse> done) { MoveServersAndTablesResponse.Builder builder = MoveServersAndTablesResponse.newBuilder(); Set<Address> hostPorts = Sets.newHashSet(); for (HBaseProtos.ServerName el : request.getServersList()) { hostPorts.add(Address.fromParts(el.getHostName(), el.getPort())); } Set<TableName> tables = new HashSet<>(request.getTableNameList().size()); for (HBaseProtos.TableName tableName : request.getTableNameList()) { tables.add(ProtobufUtil.toTableName(tableName)); } LOG.info(master.getClientIdAuditPrefix() + " move servers " + hostPorts + " and tables " + tables + " to rsgroup" + request.getTargetGroup()); try { if (master.getMasterCoprocessorHost() != null) { master.getMasterCoprocessorHost().preMoveServersAndTables(hostPorts, tables, request.getTargetGroup()); } rsGroupInfoManager.moveServers(hostPorts, request.getTargetGroup()); moveTablesAndWait(tables, request.getTargetGroup()); if (master.getMasterCoprocessorHost() != null) { master.getMasterCoprocessorHost().postMoveServersAndTables(hostPorts, tables, request.getTargetGroup()); } } catch (IOException e) { CoprocessorRpcUtils.setControllerException(controller, e); } done.run(builder.build()); }
Example 7
Source File: ProtobufUtil.java From hbase with Apache License 2.0 | 5 votes |
public static TableName[] getTableNameArray(List<HBaseProtos.TableName> tableNamesList) { if (tableNamesList == null) { return new TableName[0]; } TableName[] tableNames = new TableName[tableNamesList.size()]; for (int i = 0; i < tableNamesList.size(); i++) { tableNames[i] = toTableName(tableNamesList.get(i)); } return tableNames; }
Example 8
Source File: ProtobufUtil.java From hbase with Apache License 2.0 | 5 votes |
public static RSGroupInfo toGroupInfo(RSGroupProtos.RSGroupInfo proto) { RSGroupInfo rsGroupInfo = new RSGroupInfo(proto.getName()); for (HBaseProtos.ServerName el : proto.getServersList()) { rsGroupInfo.addServer(Address.fromParts(el.getHostName(), el.getPort())); } for (HBaseProtos.TableName pTableName : proto.getTablesList()) { rsGroupInfo.addTable(ProtobufUtil.toTableName(pTableName)); } proto.getConfigurationList().forEach(pair -> rsGroupInfo.setConfiguration(pair.getName(), pair.getValue())); return rsGroupInfo; }
Example 9
Source File: RawAsyncHBaseAdmin.java From hbase with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<SpaceQuotaSnapshot> getCurrentSpaceQuotaSnapshot(TableName tableName) { HBaseProtos.TableName protoTableName = ProtobufUtil.toProtoTableName(tableName); return getCurrentSpaceQuotaSnapshot(resp -> resp.getTableSnapshotsList().stream() .filter(s -> s.getTableName().equals(protoTableName)).findFirst() .map(s -> SpaceQuotaSnapshot.toSpaceQuotaSnapshot(s.getSnapshot())).orElse(null)); }
Example 10
Source File: ShadedAccessControlUtil.java From hbase with Apache License 2.0 | 4 votes |
public static org.apache.hadoop.hbase.TableName toTableName(HBaseProtos.TableName tableNamePB) { return org.apache.hadoop.hbase.TableName.valueOf( tableNamePB.getNamespace().asReadOnlyByteBuffer(), tableNamePB.getQualifier().asReadOnlyByteBuffer()); }
Example 11
Source File: ShadedAccessControlUtil.java From hbase with Apache License 2.0 | 4 votes |
public static HBaseProtos.TableName toProtoTableName(TableName tableName) { return HBaseProtos.TableName.newBuilder() .setNamespace(ByteString.copyFrom(tableName.getNamespace())) .setQualifier(ByteString.copyFrom(tableName.getQualifier())).build(); }
Example 12
Source File: ProtobufUtil.java From hbase with Apache License 2.0 | 4 votes |
public static TableName toTableName(HBaseProtos.TableName tableNamePB) { return TableName.valueOf(tableNamePB.getNamespace().asReadOnlyByteBuffer(), tableNamePB.getQualifier().asReadOnlyByteBuffer()); }
Example 13
Source File: ProtobufUtil.java From hbase with Apache License 2.0 | 4 votes |
public static HBaseProtos.TableName toProtoTableName(TableName tableName) { return HBaseProtos.TableName.newBuilder() .setNamespace(UnsafeByteOperations.unsafeWrap(tableName.getNamespace())) .setQualifier(UnsafeByteOperations.unsafeWrap(tableName.getQualifier())).build(); }
Example 14
Source File: ProtobufUtil.java From hbase with Apache License 2.0 | 4 votes |
public static List<TableName> toTableNameList(List<HBaseProtos.TableName> tableNamesList) { if (tableNamesList == null) { return new ArrayList<>(); } return tableNamesList.stream().map(ProtobufUtil::toTableName).collect(Collectors.toList()); }