HBASE-21052 After restoring a snapshot, table.jsp page for the table gets stuck
This commit is contained in:
parent
b04b4b0fd1
commit
a51c333856
|
@ -3310,9 +3310,16 @@ public class HBaseAdmin implements Admin {
|
|||
@Override
|
||||
public CompactionState getCompactionState(final TableName tableName, CompactType compactType)
|
||||
throws IOException {
|
||||
checkTableExists(tableName);
|
||||
if (!isTableEnabled(tableName)) {
|
||||
// If the table is disabled, the compaction state of the table should always be NONE
|
||||
return ProtobufUtil.createCompactionState(
|
||||
AdminProtos.GetRegionInfoResponse.CompactionState.NONE);
|
||||
}
|
||||
|
||||
AdminProtos.GetRegionInfoResponse.CompactionState state =
|
||||
AdminProtos.GetRegionInfoResponse.CompactionState.NONE;
|
||||
checkTableExists(tableName);
|
||||
|
||||
// TODO: There is no timeout on this controller. Set one!
|
||||
HBaseRpcController rpcController = rpcControllerFactory.newController();
|
||||
switch (compactType) {
|
||||
|
|
|
@ -247,7 +247,8 @@ public class TestRestoreSnapshotFromClient {
|
|||
|
||||
@Test
|
||||
public void testCloneSnapshotOfCloned() throws IOException, InterruptedException {
|
||||
TableName clonedTableName = TableName.valueOf(name.getMethodName() + "-" + System.currentTimeMillis());
|
||||
TableName clonedTableName = TableName.valueOf(name.getMethodName() + "-" +
|
||||
System.currentTimeMillis());
|
||||
admin.cloneSnapshot(snapshotName0, clonedTableName);
|
||||
verifyRowCount(TEST_UTIL, clonedTableName, snapshot0Rows);
|
||||
SnapshotTestingUtils.verifyReplicasCameOnline(clonedTableName, admin, getNumReplicas());
|
||||
|
@ -282,7 +283,8 @@ public class TestRestoreSnapshotFromClient {
|
|||
@Test
|
||||
public void testCorruptedSnapshot() throws IOException, InterruptedException {
|
||||
SnapshotTestingUtils.corruptSnapshot(TEST_UTIL, Bytes.toString(snapshotName0));
|
||||
TableName cloneName = TableName.valueOf(name.getMethodName() + "-" + System.currentTimeMillis());
|
||||
TableName cloneName = TableName.valueOf(name.getMethodName() + "-" +
|
||||
System.currentTimeMillis());
|
||||
try {
|
||||
admin.cloneSnapshot(snapshotName0, cloneName);
|
||||
fail("Expected CorruptedSnapshotException, got succeeded cloneSnapshot()");
|
||||
|
@ -342,6 +344,23 @@ public class TestRestoreSnapshotFromClient {
|
|||
SnapshotTestingUtils.verifyReplicasCameOnline(tableName, admin, getNumReplicas());
|
||||
}
|
||||
|
||||
@Test(timeout = 30000)
|
||||
public void testGetCompactionStateAfterRestoringSnapshot() throws IOException,
|
||||
InterruptedException {
|
||||
// Take a snapshot
|
||||
admin.snapshot(snapshotName1, tableName);
|
||||
|
||||
// Restore the snapshot
|
||||
admin.disableTable(tableName);
|
||||
admin.restoreSnapshot(snapshotName1);
|
||||
|
||||
// Get the compaction state of the restored table
|
||||
CompactionState compactionState = admin.getCompactionState(tableName);
|
||||
|
||||
// The compactionState should be NONE because the table is disabled
|
||||
assertEquals(CompactionState.NONE, compactionState);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Helpers
|
||||
// ==========================================================================
|
||||
|
|
Loading…
Reference in New Issue