@Override public void start(CoprocessorEnvironment env) throws IOException { // At start, we get base CoprocessorEnvironment Type, not RegionCoprocessorEnvironment, checkShared(((RegionCoprocessorEnvironment) env).getConnection()); checkShortCircuit( ((RegionCoprocessorEnvironment) env).createConnection(env.getConfiguration())); } }
try (Table t = e.getConnection().getTable(AccessControlLists.ACL_TABLE_NAME)) { for (byte[] entry : entries) { currentEntry = entry;
@Override public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put, final WALEdit edit, final Durability durability) throws IOException { try (Table table = e.getEnvironment().getConnection().getTable(otherTable, getPool())) { Put p = new Put(new byte[]{'a'}); p.addColumn(family, null, new byte[]{'a'}); try { table.batch(Collections.singletonList(put), null); } catch (InterruptedException e1) { throw new IOException(e1); } completedWithPool[0] = true; } } }
@Override public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e, final Put put, final WALEdit edit, final Durability durability) throws IOException { try (Table table = e.getEnvironment().getConnection(). getTable(otherTable)) { table.put(put); completed[0] = true; } }
regionEnv.getConnection().getAdmin().revoke(perm); if (AUDITLOG.isTraceEnabled()) {
regionEnv.getConnection().getAdmin().grant(perm, request.getMergeExistingPermissions()); if (AUDITLOG.isTraceEnabled()) {
Connection getConnection() { return env.getConnection(); }
private void throwFailureIfDone() throws SingleIndexWriteFailureException { if (stopped.isStopped() || (env != null && (env.getConnection() == null || env.getConnection().isClosed() || env.getConnection().isAborted())) || Thread.currentThread().isInterrupted()) { throw new SingleIndexWriteFailureException( "Pool closed, not attempting to write to the index!", null); } } });
public static Table getHTableForCoprocessorScan (RegionCoprocessorEnvironment env, TableName tableName) throws IOException { if (coprocessorScanWorks(env)) { return env.getConnection().getTable(tableName); } return getTableFromSingletonPool(env, tableName); }
ReadOnlyProps props=new ReadOnlyProps(env.getConfiguration().iterator()); Thread.sleep(1000); metaTable = env.getConnection().getTable( SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, props)); statsTable = env.getConnection().getTable( SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_STATS_NAME_BYTES, props)); final Table mTable=metaTable;
@Before public void setupMocks() throws Exception { this.config = new Configuration(false); // Create all of the mocks this.region = mock(Region.class); this.rsServices = mock(RegionServerServices.class); this.statsWriter = mock(StatisticsWriter.class); this.callable = mock(StatisticsScannerCallable.class); this.runTracker = mock(StatisticsCollectionRunTracker.class); this.mockScanner = mock(StatisticsScanner.class); this.tracker = mock(StatisticsCollector.class); this.delegate = mock(InternalScanner.class); this.regionInfo = mock(RegionInfo.class); this.env = mock(RegionCoprocessorEnvironment.class); this.conn = mock(Connection.class); // Wire up the mocks to the mock StatisticsScanner when(mockScanner.getStatisticsWriter()).thenReturn(statsWriter); when(mockScanner.createCallable()).thenReturn(callable); when(mockScanner.getStatsCollectionRunTracker(any(Configuration.class))).thenReturn(runTracker); when(mockScanner.getRegion()).thenReturn(region); when(mockScanner.getConfig()).thenReturn(config); when(mockScanner.getTracker()).thenReturn(tracker); when(mockScanner.getDelegate()).thenReturn(delegate); when(env.getConnection()).thenReturn(conn); when(mockScanner.getConnection()).thenReturn(conn); // Wire up the HRegionInfo mock to the Region mock when(region.getRegionInfo()).thenReturn(regionInfo); // Always call close() on the mock StatisticsScanner doCallRealMethod().when(mockScanner).close(); }
Mockito.when(mockTableDesc.getTableName()).thenReturn(TableName.valueOf("test")); Connection mockConnection = Mockito.mock(Connection.class); Mockito.when(e.getConnection()).thenReturn(mockConnection); Mockito.when(mockRegion.getTableDescriptor()).thenReturn(mockTableDesc); Stoppable stop = Mockito.mock(Stoppable.class);
Mockito.when(mockTableDesc.getTableName()).thenReturn(TableName.valueOf("test")); Connection mockConnection = Mockito.mock(Connection.class); Mockito.when(e.getConnection()).thenReturn(mockConnection); ImmutableBytesPtr tableName = new ImmutableBytesPtr(this.test.getTableName()); Put m = new Put(row);
Mockito.when(mockTableDesc.getTableName()).thenReturn(TableName.valueOf("test")); Connection mockConnection = Mockito.mock(Connection.class); Mockito.when(e.getConnection()).thenReturn(mockConnection); FakeTableFactory factory = new FakeTableFactory(tables);
List<PTable> indexesToPartiallyRebuild = Lists.newArrayListWithExpectedSize(pairs.size()); try ( Table metaTable = env.getConnection().getTable( SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, props))) { long earliestDisableTimestamp = Long.MAX_VALUE;
Mockito.when(mockTableDesc.getTableName()).thenReturn(mockTN); Connection mockConnection = Mockito.mock(Connection.class); Mockito.when(e.getConnection()).thenReturn(mockConnection); ExecutorService exec = Executors.newFixedThreadPool(1); Map<ImmutableBytesPtr, Table> tables = new HashMap<ImmutableBytesPtr, Table>();
env.getRegionInfo().getStartKey(), env.getRegionInfo().getEndKey()); try (Table htable = env.getConnection().getTable(env.getRegionInfo().getTable())) {
Table table = null; try { table = environment.getConnection().getTable(dataTable); joinResult = table.get(get); } finally {
private void throwFailureIfDone() throws SingleIndexWriteFailureException { if (stopped.isStopped() || (env != null && (env.getConnection() == null || env.getConnection().isClosed() || env.getConnection().isAborted())) || Thread.currentThread().isInterrupted()) { throw new SingleIndexWriteFailureException( "Pool closed, not attempting to write to the index!", null); } } });
MetaTableAccessor.getRegionsFromMergeQualifier(ctx.getEnvironment().getConnection(), region.getRegionInfo().getRegionName()); if (mergeRegions == null || mergeRegions.getFirst() == null) return reader;