Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes balancing of metadata table #5195

Open
wants to merge 5 commits into
base: 2.1
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1000,20 +1000,22 @@ private SortedMap<TServerInstance,TabletServerStatus> createTServerStatusView(
final Map<String,TableInfo> newTableMap =
new HashMap<>(dl == DataLevel.USER ? oldTableMap.size() : 1);
if (dl == DataLevel.ROOT) {
if (oldTableMap.containsKey(RootTable.NAME)) {
newTableMap.put(RootTable.NAME, oldTableMap.get(RootTable.NAME));
if (oldTableMap.containsKey(RootTable.ID.canonical())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make it a Map<TableId,TableInfo> instead of Map<String,TableInfo>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make it a Map<TableId,TableInfo> instead of Map<String,TableInfo>?

The code is currently manipulating a Thrift object which can not use the TableId type. A larger refactor would be needed to make that change, could open in issue to look into that.

newTableMap.put(RootTable.ID.canonical(), oldTableMap.get(RootTable.ID.canonical()));
}
} else if (dl == DataLevel.METADATA) {
if (oldTableMap.containsKey(MetadataTable.NAME)) {
newTableMap.put(MetadataTable.NAME, oldTableMap.get(MetadataTable.NAME));
if (oldTableMap.containsKey(MetadataTable.ID.canonical())) {
newTableMap.put(MetadataTable.ID.canonical(),
oldTableMap.get(MetadataTable.ID.canonical()));
}
} else if (dl == DataLevel.USER) {
if (!oldTableMap.containsKey(MetadataTable.NAME)
&& !oldTableMap.containsKey(RootTable.NAME)) {
if (!oldTableMap.containsKey(MetadataTable.ID.canonical())
&& !oldTableMap.containsKey(RootTable.ID.canonical())) {
newTableMap.putAll(oldTableMap);
} else {
oldTableMap.forEach((table, info) -> {
if (!table.equals(RootTable.NAME) && !table.equals(MetadataTable.NAME)) {
if (!table.equals(RootTable.ID.canonical())
&& !table.equals(MetadataTable.ID.canonical())) {
newTableMap.put(table, info);
}
});
Expand Down
Loading