HBASE-20097 Merge TableDescriptors#getAll and TableDescriptors#getAllDescriptors into one
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
e50e6f7ce9
commit
f71c00c02e
|
@ -54,15 +54,6 @@ public interface TableDescriptors {
|
||||||
Map<String, TableDescriptor> getAll()
|
Map<String, TableDescriptor> getAll()
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Map of all TableDescriptors. Populates the descriptor cache as a
|
|
||||||
* side effect.
|
|
||||||
* @return Map of all descriptors.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
Map<String, TableDescriptor> getAllDescriptors()
|
|
||||||
throws IOException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or update descriptor
|
* Add or update descriptor
|
||||||
* @param htd Descriptor to set into TableDescriptors
|
* @param htd Descriptor to set into TableDescriptors
|
||||||
|
|
|
@ -223,7 +223,7 @@ public class TableStateManager {
|
||||||
|
|
||||||
private void fixTableStates(TableDescriptors tableDescriptors, Connection connection)
|
private void fixTableStates(TableDescriptors tableDescriptors, Connection connection)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final Map<String, TableDescriptor> allDescriptors = tableDescriptors.getAllDescriptors();
|
final Map<String, TableDescriptor> allDescriptors = tableDescriptors.getAll();
|
||||||
final Map<String, TableState> states = new HashMap<>();
|
final Map<String, TableState> states = new HashMap<>();
|
||||||
// NOTE: Ful hbase:meta table scan!
|
// NOTE: Ful hbase:meta table scan!
|
||||||
MetaTableAccessor.fullScanTables(connection, new MetaTableAccessor.Visitor() {
|
MetaTableAccessor.fullScanTables(connection, new MetaTableAccessor.Visitor() {
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class FSTableDescriptors implements TableDescriptors {
|
||||||
* Returns a map from table name to table descriptor for all tables.
|
* Returns a map from table name to table descriptor for all tables.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, TableDescriptor> getAllDescriptors()
|
public Map<String, TableDescriptor> getAll()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Map<String, TableDescriptor> tds = new TreeMap<>();
|
Map<String, TableDescriptor> tds = new TreeMap<>();
|
||||||
|
|
||||||
|
@ -281,20 +281,6 @@ public class FSTableDescriptors implements TableDescriptors {
|
||||||
return tds;
|
return tds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a map from table name to table descriptor for all tables.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Map<String, TableDescriptor> getAll() throws IOException {
|
|
||||||
Map<String, TableDescriptor> htds = new TreeMap<>();
|
|
||||||
Map<String, TableDescriptor> allDescriptors = getAllDescriptors();
|
|
||||||
for (Map.Entry<String, TableDescriptor> entry : allDescriptors
|
|
||||||
.entrySet()) {
|
|
||||||
htds.put(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
return htds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find descriptors by namespace.
|
* Find descriptors by namespace.
|
||||||
* @see #get(org.apache.hadoop.hbase.TableName)
|
* @see #get(org.apache.hadoop.hbase.TableName)
|
||||||
|
|
|
@ -327,11 +327,6 @@ public class MockMasterServices extends MockNoopMasterServices {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Map<String, TableDescriptor> getAllDescriptors() throws IOException {
|
|
||||||
// noop
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDescriptor get(TableName tablename) throws IOException {
|
public TableDescriptor get(TableName tablename) throws IOException {
|
||||||
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tablename);
|
TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tablename);
|
||||||
|
|
Loading…
Reference in New Issue