HBASE-20771 PUT operation fail with "No server address listed in hbase:meta for region xxxxx"
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
99189f284b
commit
0953eb7ed9
|
@ -774,7 +774,7 @@ public class HBaseAdmin implements Admin {
|
|||
|
||||
public CreateTableFuture(final HBaseAdmin admin, final HTableDescriptor desc,
|
||||
final byte[][] splitKeys, final CreateTableResponse response) {
|
||||
super(admin, (response != null && response.hasProcId()) ? response.getProcId() : null);
|
||||
super(admin, (response != null && response.hasProcId()) ? response.getProcId() : null, true);
|
||||
this.splitKeys = splitKeys;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
@ -1199,7 +1199,7 @@ public class HBaseAdmin implements Admin {
|
|||
|
||||
public EnableTableFuture(final HBaseAdmin admin, final TableName tableName,
|
||||
final EnableTableResponse response) {
|
||||
super(admin, (response != null && response.hasProcId()) ? response.getProcId() : null);
|
||||
super(admin, (response != null && response.hasProcId()) ? response.getProcId() : null, true);
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
|
@ -4616,6 +4616,7 @@ public class HBaseAdmin implements Admin {
|
|||
private boolean procResultFound = false;
|
||||
private boolean done = false;
|
||||
private boolean cancelled = false;
|
||||
private boolean waitForOpResult = false;
|
||||
private V result = null;
|
||||
|
||||
private final HBaseAdmin admin;
|
||||
|
@ -4626,6 +4627,13 @@ public class HBaseAdmin implements Admin {
|
|||
this.procId = procId;
|
||||
}
|
||||
|
||||
public ProcedureFuture(final HBaseAdmin admin, final Long procId,
|
||||
final boolean waitForOpResult) {
|
||||
this.admin = admin;
|
||||
this.procId = procId;
|
||||
this.waitForOpResult = waitForOpResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
AbortProcedureRequest abortProcRequest = AbortProcedureRequest.newBuilder()
|
||||
|
@ -4683,7 +4691,7 @@ public class HBaseAdmin implements Admin {
|
|||
result = waitProcedureResult(procId, deadlineTs);
|
||||
}
|
||||
// if we don't have a proc result, try the compatibility wait
|
||||
if (!procResultFound) {
|
||||
if (!procResultFound || waitForOpResult) {
|
||||
result = waitOperationResult(deadlineTs);
|
||||
}
|
||||
result = postOperationResult(result, deadlineTs);
|
||||
|
@ -4740,6 +4748,7 @@ public class HBaseAdmin implements Admin {
|
|||
// and that is always a valid solution.
|
||||
LOG.warn("Proc-v2 is unsupported on this master: " + serviceEx.getMessage(), serviceEx);
|
||||
procResultFound = false;
|
||||
waitForOpResult = false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,10 @@ public class TestProcedureFuture {
|
|||
super(admin, procId);
|
||||
}
|
||||
|
||||
public TestFuture(final HBaseAdmin admin, final Long procId, final boolean waitForOpResult) {
|
||||
super(admin, procId, waitForOpResult);
|
||||
}
|
||||
|
||||
public boolean wasPostOperationResultCalled() {
|
||||
return postOperationResultCalled;
|
||||
}
|
||||
|
@ -182,4 +186,24 @@ public class TestProcedureFuture {
|
|||
assertTrue("expected waitOperationResult() to be called", f.wasWaitOperationResultCalled());
|
||||
assertTrue("expected postOperationResult() to be called", f.wasPostOperationResultCalled());
|
||||
}
|
||||
|
||||
/**
|
||||
* When master return a result by submitting the request asynchronously. we are skipping the
|
||||
* waitOperationResult() call, since we are getting the procedure result.
|
||||
*/
|
||||
@Test(timeout = 60000)
|
||||
public void testWaitOperationResult() throws Exception {
|
||||
HBaseAdmin admin = Mockito.mock(HBaseAdmin.class);
|
||||
TestFuture f = new TestFuture(admin, 100L, true) {
|
||||
@Override
|
||||
protected GetProcedureResultResponse
|
||||
getProcedureResult(final GetProcedureResultRequest request) throws IOException {
|
||||
return GetProcedureResultResponse.newBuilder()
|
||||
.setState(GetProcedureResultResponse.State.FINISHED).build();
|
||||
}
|
||||
};
|
||||
f.get(1, TimeUnit.MINUTES);
|
||||
|
||||
assertTrue("expected waitOperationResult() to be called", f.wasWaitOperationResultCalled());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue