HBASE-17705 Procedure execution must fail fast if procedure is not registered (Vladimir Rodionov)

This commit is contained in:
tedyu 2017-07-10 09:04:56 -07:00
parent 351703455a
commit 7d007eac98
3 changed files with 49 additions and 3 deletions

View File

@ -109,7 +109,11 @@ public class RpcRetryingCallerImpl<T> implements RpcRetryingCaller<T> {
} catch (Throwable t) {
Throwable e = t.getCause();
ExceptionUtil.rethrowIfInterrupt(t);
Throwable cause = t.getCause();
if (cause instanceof DoNotRetryIOException) {
// Fail fast
throw (DoNotRetryIOException) cause;
}
// translateException throws exception when should not retry: i.e. when request is bad.
interceptor.handleFailure(context, t);
t = translateException(t);

View File

@ -702,8 +702,8 @@ public class MasterRpcServices extends RSRpcServices
MasterProcedureManager mpm = master.getMasterProcedureManagerHost().getProcedureManager(
desc.getSignature());
if (mpm == null) {
throw new ServiceException("The procedure is not registered: "
+ desc.getSignature());
throw new ServiceException(new DoNotRetryIOException("The procedure is not registered: "
+ desc.getSignature()));
}
LOG.info(master.getClientIdAuditPrefix() + " procedure request for: "

View File

@ -0,0 +1,42 @@
/**
* 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.master.procedure;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({MasterTests.class, MediumTests.class})
public class TestFastFailOnProcedureNotRegistered extends TestTableDDLProcedureBase {
@Test(expected=DoNotRetryIOException.class, timeout = 3000)
public void testFastFailOnProcedureNotRegistered() throws IOException {
Admin admin = UTIL.getAdmin();
Map<String, String> props = new HashMap<String, String>();
admin.execProcedure("fake1","fake2", props);
}
}