org.apache.hadoop.hbase.coprocessor.MasterObserver Java Examples

The following examples show how to use org.apache.hadoop.hbase.coprocessor.MasterObserver. 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: PhoenixAccessController.java    From phoenix with Apache License 2.0 6 votes vote down vote up
private List<MasterObserver> getAccessControllers() throws IOException {
    ArrayList<MasterObserver> oldAccessControllers = accessControllers.get();
    if (oldAccessControllers == null) {
        oldAccessControllers = new ArrayList<>();
        RegionCoprocessorHost cpHost = this.env.getCoprocessorHost();
        for (RegionCoprocessor cp : cpHost.findCoprocessors(RegionCoprocessor.class)) {
            if (cp instanceof AccessControlService.Interface && cp instanceof MasterObserver) {
                oldAccessControllers.add((MasterObserver)cp);
                if(cp.getClass().getName().equals(org.apache.hadoop.hbase.security.access.AccessController.class.getName())) {
                    hbaseAccessControllerEnabled = true;
                }
            }
        }
        accessControllers.set(oldAccessControllers);
    }
    return accessControllers.get();
}
 
Example #2
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 6 votes vote down vote up
public void preStopMaster() throws IOException {
  // While stopping master all coprocessors method should be executed first then the coprocessor
  // environment should be cleaned up.
  if (coprocEnvironments.isEmpty()) {
    return;
  }
  execShutdown(new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preStopMaster(this);
    }
    @Override
    public void postEnvCall() {
      // invoke coprocessor stop method
      shutdown(this.getEnvironment());
    }
  });
}
 
Example #3
Source File: PhoenixAccessController.java    From phoenix with Apache License 2.0 6 votes vote down vote up
@Override
public void preIndexUpdate(ObserverContext<PhoenixMetaDataControllerEnvironment> ctx, String tenantId,
        String indexName, TableName physicalTableName, TableName parentPhysicalTableName, PIndexState newState)
        throws IOException {
    if (!accessCheckEnabled) { return; }
    for (MasterObserver observer : getAccessControllers()) {
        observer.preModifyTable(getMasterObsevrverContext(), physicalTableName,
                TableDescriptorBuilder.newBuilder(physicalTableName).build());
    }
    // Check for read access in case of rebuild
    if (newState == PIndexState.BUILDING) {
        if(execPermissionsCheckEnabled) {
            requireAccess("Rebuild:", parentPhysicalTableName, Action.READ, Action.EXEC);
        } else {
            requireAccess("Rebuild:", parentPhysicalTableName, Action.READ);
        }
    }
}
 
Example #4
Source File: PhoenixAccessController.java    From phoenix with Apache License 2.0 6 votes vote down vote up
@Override
public void preAlterTable(ObserverContext<PhoenixMetaDataControllerEnvironment> ctx, String tenantId,
        String tableName, TableName physicalTableName, TableName parentPhysicalTableName, PTableType tableType) throws IOException {
    if (!accessCheckEnabled) { return; }
    for (MasterObserver observer : getAccessControllers()) {
        if (tableType != PTableType.VIEW) {
        observer.preModifyTable(getMasterObsevrverContext(), physicalTableName,
                TableDescriptorBuilder.newBuilder(physicalTableName).build());
        }
    }
    if (tableType == PTableType.VIEW) {
        if(execPermissionsCheckEnabled) {
            requireAccess("Alter "+tableType, parentPhysicalTableName, Action.READ, Action.EXEC);
        } else {
            requireAccess("Alter "+tableType, parentPhysicalTableName, Action.READ);
        }
    }
}
 
Example #5
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preMoveServersAndTables(final Set<Address> servers, final Set<TableName> tables,
    final String targetGroup) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preMoveServersAndTables(this, servers, tables, targetGroup);
    }
  });
}
 
Example #6
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postAssign(final RegionInfo regionInfo) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postAssign(this, regionInfo);
    }
  });
}
 
Example #7
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preBalanceRSGroup(final String name)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preBalanceRSGroup(this, name);
    }
  });
}
 
Example #8
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preSetUserQuota(
    final String user, final TableName table, final GlobalQuotaSettings quotas)
        throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preSetUserQuota(this, user, table, quotas);
    }
  });
}
 
Example #9
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postGetUserPermissions(String userName, String namespace, TableName tableName,
    byte[] family, byte[] qualifier) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postGetUserPermissions(this, userName, namespace, tableName, family, qualifier);
    }
  });
}
 
Example #10
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postGetRSGroupInfoOfTable(final TableName tableName) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postGetRSGroupInfoOfTable(this, tableName);
    }
  });
}
 
Example #11
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preDecommissionRegionServers(List<ServerName> servers, boolean offload)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preDecommissionRegionServers(this, servers, offload);
    }
  });
}
 
Example #12
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postGetRSGroupInfo(final String groupName) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postGetRSGroupInfo(this, groupName);
    }
  });
}
 
Example #13
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preIsRpcThrottleEnabled() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preIsRpcThrottleEnabled(this);
    }
  });
}
 
Example #14
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preHasUserPermissions(String userName, List<Permission> permissions)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preHasUserPermissions(this, userName, permissions);
    }
  });
}
 
Example #15
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postClearDeadServers(List<ServerName> servers,
    List<ServerName> notClearedServers) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postClearDeadServers(this, servers, notClearedServers);
    }
  });
}
 
Example #16
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preUpdateReplicationPeerConfig(final String peerId,
    final ReplicationPeerConfig peerConfig) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preUpdateReplicationPeerConfig(this, peerId, peerConfig);
    }
  });
}
 
Example #17
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
/**
 * This will be called before update META step as part of split table region procedure.
 * @param splitKey
 * @param metaEntries
 * @param user the user
 * @throws IOException
 */
public void preSplitBeforeMETAAction(
    final byte[] splitKey,
    final List<Mutation> metaEntries,
    final User user) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation(user) {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preSplitRegionBeforeMETAAction(this, splitKey, metaEntries);
    }
  });
}
 
Example #18
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preGetConfiguredNamespacesAndTablesInRSGroup(final String groupName)
  throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {

    @Override
    protected void call(MasterObserver observer) throws IOException {
      observer.preGetConfiguredNamespacesAndTablesInRSGroup(this, groupName);
    }
  });
}
 
Example #19
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postRemoveServers(final Set<Address> servers)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postRemoveServers(this, servers);
    }
  });
}
 
Example #20
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preSwitchRpcThrottle(boolean enable) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null :new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preSwitchRpcThrottle(this, enable);
    }
  });
}
 
Example #21
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preAddReplicationPeer(final String peerId, final ReplicationPeerConfig peerConfig)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preAddReplicationPeer(this, peerId, peerConfig);
    }
  });
}
 
Example #22
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postGetProcedures(final List<Procedure<?>> procInfoList) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postGetProcedures(this);
    }
  });
}
 
Example #23
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postRemoveRSGroup(final String name)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postRemoveRSGroup(this, name);
    }
  });
}
 
Example #24
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preDeleteSnapshot(final SnapshotDescription snapshot) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preDeleteSnapshot(this, snapshot);
    }
  });
}
 
Example #25
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preAbortProcedure(
    final ProcedureExecutor<MasterProcedureEnv> procEnv,
    final long procId) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preAbortProcedure(this,  procId);
    }
  });
}
 
Example #26
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postRecommissionRegionServer(ServerName server, List<byte[]> encodedRegionNames)
    throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postRecommissionRegionServer(this, server, encodedRegionNames);
    }
  });
}
 
Example #27
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preDisableTableAction(final TableName tableName, final User user) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation(user) {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preDisableTableAction(this, tableName);
    }
  });
}
 
Example #28
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postDisableTable(final TableName tableName) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postDisableTable(this, tableName);
    }
  });
}
 
Example #29
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void preListDecommissionedRegionServers() throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.preListDecommissionedRegionServers(this);
    }
  });
}
 
Example #30
Source File: MasterCoprocessorHost.java    From hbase with Apache License 2.0 5 votes vote down vote up
public void postCompletedSnapshotAction(SnapshotDescription snapshot,
    TableDescriptor hTableDescriptor) throws IOException {
  execOperation(coprocEnvironments.isEmpty() ? null : new MasterObserverOperation() {
    @Override
    public void call(MasterObserver observer) throws IOException {
      observer.postCompletedSnapshotAction(this, snapshot, hTableDescriptor);
    }
  });
}