private void checkTableExists(final TableName tableName) throws IOException, TableNotFoundException { if (!MetaTableAccessor.tableExists(getConnection(), tableName)) { throw new TableNotFoundException(tableName); } }
public SnapshotQuotaObserverChore(HMaster master, MetricsMaster metrics) { this( master.getConnection(), master.getConfiguration(), master.getFileSystem(), master, metrics); }
public QuotaObserverChore(HMaster master, MetricsMaster metrics) { this( master.getConnection(), master.getConfiguration(), master.getSpaceQuotaSnapshotNotifier(), master.getMasterQuotaManager(), master, metrics); }
List<RSGroupInfo> groups = RSGroupTableAccessor.getAllRSGroupInfo(master.getConnection());
/** * Return the region and current deployment for the region containing the given row. If the region * cannot be found, returns null. If it is found, but not currently deployed, the second element * of the pair may be null. */ private Pair<RegionInfo, ServerName> getTableRegionForRow(HMaster master, TableName tableName, byte[] rowKey) throws IOException { final AtomicReference<Pair<RegionInfo, ServerName>> result = new AtomicReference<>(null); MetaTableAccessor.Visitor visitor = new MetaTableAccessor.Visitor() { @Override public boolean visit(Result data) throws IOException { if (data == null || data.size() <= 0) { return true; } Pair<RegionInfo, ServerName> pair = new Pair<>(MetaTableAccessor.getRegionInfo(data), MetaTableAccessor.getServerName(data, 0)); if (!pair.getFirst().getTable().equals(tableName)) { return false; } result.set(pair); return true; } }; MetaTableAccessor.scanMeta(master.getConnection(), visitor, tableName, rowKey, 1); return result.get(); }
MetaTableAccessor.scanMetaForTableRegions(master.getConnection(), visitor, tableName); return actualRegCount.get();
getChoreService().scheduleChore(hfileCleaner); replicationBarrierCleaner = new ReplicationBarrierCleaner(conf, this, getConnection(), replicationPeerManager); getChoreService().scheduleChore(replicationBarrierCleaner);
@Override public RevokeResponse revoke(RpcController controller, RevokeRequest request) throws ServiceException { try { final UserPermission userPermission = ShadedAccessControlUtil.toUserPermission(request.getUserPermission()); if (master.cpHost != null) { master.cpHost.preRevoke(userPermission); } try (Table table = master.getConnection().getTable(AccessControlLists.ACL_TABLE_NAME)) { AccessControlLists.removeUserPermission(master.getConfiguration(), userPermission, table); } if (master.cpHost != null) { master.cpHost.postRevoke(userPermission); } return RevokeResponse.getDefaultInstance(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
m.getConnection(), TABLENAME); LOG.info("Regions after load: " + Joiner.on(',').join(tableRegions)); assertEquals(1, tableRegions.size()); tableRegions = MetaTableAccessor.getTableRegionsAndLocations(m.getConnection(), TABLENAME, false); Thread.sleep(100); LOG.info("Result is: " + pair); Pair<RegionInfo, ServerName> tableRegionFromName = MetaTableAccessor.getRegion(m.getConnection(), pair.getFirst().getRegionName()); assertTrue(RegionInfo.COMPARATOR.compare(tableRegionFromName.getFirst(), pair.getFirst()) == 0);
if (quotaManager != null) { if (quotaManager.isQuotaInitialized()) { Quotas quotaForTable = QuotaUtil.getTableQuota(getConnection(), tableName); if (quotaForTable != null && quotaForTable.hasSpace()) { SpaceViolationPolicy policy = quotaForTable.getSpace().getViolationPolicy();
@Override public FileArchiveNotificationResponse reportFileArchival(RpcController controller, FileArchiveNotificationRequest request) throws ServiceException { try { master.checkInitialized(); if (!QuotaUtil.isQuotaEnabled(master.getConfiguration())) { return FileArchiveNotificationResponse.newBuilder().build(); } master.getMasterQuotaManager().processFileArchivals(request, master.getConnection(), master.getConfiguration(), master.getFileSystem()); return FileArchiveNotificationResponse.newBuilder().build(); } catch (Exception e) { throw new ServiceException(e); } }
@Override public GrantResponse grant(RpcController controller, GrantRequest request) throws ServiceException { try { final UserPermission perm = ShadedAccessControlUtil.toUserPermission(request.getUserPermission()); boolean mergeExistingPermissions = request.getMergeExistingPermissions(); if (master.cpHost != null) { master.cpHost.preGrant(perm, mergeExistingPermissions); } try (Table table = master.getConnection().getTable(AccessControlLists.ACL_TABLE_NAME)) { AccessControlLists.addUserPermission(getConfiguration(), perm, table, mergeExistingPermissions); } if (master.cpHost != null) { master.cpHost.postGrant(perm, mergeExistingPermissions); } return GrantResponse.getDefaultInstance(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
assertTrue(MetaTableAccessor.tableExists(master.getConnection(), tableName)); assertEquals(regions.length, countMetaRegions(master, tableName));
MetaTableAccessor.getRegion(master.getConnection(), regionName); if (Bytes.equals(RegionInfoBuilder.FIRST_META_REGIONINFO.getRegionName(), regionName)) { pair = new Pair<>(RegionInfoBuilder.FIRST_META_REGIONINFO,
UTIL.getMiniHBaseCluster().getMaster().getConnection().close(); RESUME.countDown(); UTIL.waitFor(30000, () -> procExec.isFinished(dummyProcId));
public static void validateTableDeletion( final HMaster master, final TableName tableName) throws IOException { // check filesystem final FileSystem fs = master.getMasterFileSystem().getFileSystem(); final Path tableDir = FSUtils.getTableDir(master.getMasterFileSystem().getRootDir(), tableName); assertFalse(fs.exists(tableDir)); // check meta assertFalse(MetaTableAccessor.tableExists(master.getConnection(), tableName)); assertEquals(0, countMetaRegions(master, tableName)); // check htd assertTrue("found htd of deleted table", master.getTableDescriptors().get(tableName) == null); }
master.getConnection()); snapshot.initialize(); Map<RegionInfo, ServerName> regionToRegionServerMap snapshot = new SnapshotOfRegionAssignmentFromMeta(master.getConnection()); snapshot.initialize(); Map<RegionInfo, ServerName> newRegionToRegionServerMap =
.getTableRegionsAndLocations(MASTER.getConnection(), tableName); RegionInfo mergedRegionInfo = tableRegions.get(0).getFirst(); TableDescriptor tableDescriptor = MASTER.getTableDescriptors().get( tableName); Result mergedRegionResult = MetaTableAccessor.getRegionResult( MASTER.getConnection(), mergedRegionInfo.getRegionName());
hbaseAdmin = master.getConnection().getAdmin(); hbaseAdmin.createTable(desc);
boolean tableExists = false; if(snapshotName != null) { try (Admin admin = master.getConnection().getAdmin()) { for (SnapshotDescription snapshotDesc: admin.listSnapshots()) { if (snapshotName.equals(snapshotDesc.getName())) {