Apache9 commented on code in PR #6447: URL: https://github.com/apache/hbase/pull/6447#discussion_r1835317777
########## hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RpcObserver.java: ########## @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.coprocessor; + +import java.io.IOException; +import java.security.cert.X509Certificate; +import org.apache.hadoop.hbase.HBaseInterfaceAudience; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; + +/** + * Coprocessors implement this interface to observe and mediate RPC events in Master and RS + * instances. + * <p> + * Since most implementations will be interested in only a subset of hooks, this class uses + * 'default' functions to avoid having to add unnecessary overrides. When the functions are + * non-empty, it's simply to satisfy the compiler by returning value of expected (non-void) type. It + * is done in a way that these default definitions act as no-op. So our suggestion to implementation + * would be to not call these 'default' methods from overrides. + * <p> + * <h3>Exception Handling</h3><br> + * For all functions, exception handling is done as follows: + * <ul> + * <li>Exceptions of type {@link IOException} are reported back to client.</li> + * <li>For any other kind of exception: + * <ul> + * <li>Be aware that this coprocessor doesn't support abortion. If the configuration + * {@link CoprocessorHost#ABORT_ON_ERROR_KEY} is set to true, the event will be logged, but the RPC + * server won't be aborted.</li> + * <li>Otherwise, coprocessor is removed from the server.</li> + * </ul> + * </li> + * </ul> + */ [email protected](HBaseInterfaceAudience.COPROC) [email protected] +public interface RpcObserver { + /** + * Called after successfully authorizing connection + * @param ctx the coprocessor instance's environment + * @param userName the user name + * @param clientCertificateChain list of peer certificates from SSL connection + */ + default void postAuthorizeConnection(ObserverContext<RpcCoprocessorEnvironment> ctx, Review Comment: Only post, no pre? ########## hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java: ########## @@ -324,6 +330,13 @@ public void onConfigurationChange(Configuration newConf) { refreshAuthManager(newConf, new HBasePolicyProvider()); } refreshSlowLogConfiguration(newConf); + if ( + CoprocessorConfigurationUtil.checkConfigurationChange(getConf(), newConf, + CoprocessorHost.RPC_COPROCESSOR_CONF_KEY) + ) { + LOG.info("Update the RPC coprocessor(s) because the configuration has changed"); + initializeCoprocessorHost(newConf); Review Comment: Is a Configuration object enough for your usage? I see the RpcCoprossesorEnvironment is also empty? ########## hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java: ########## @@ -898,4 +911,14 @@ protected boolean needAuthorization() { public List<BlockingServiceAndInterface> getServices() { return services; } + + private void initializeCoprocessorHost(Configuration conf) { + // initialize master side coprocessors before we start handling requests Review Comment: Not only for master? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
