-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-22903 : Table to RegionStatesCount metrics - Use for broken alter_status command #611
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 167 additions & 0 deletions
167
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionStatesCount.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| /* | ||
| * | ||
| * 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.client; | ||
|
|
||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
||
| @InterfaceAudience.Private | ||
| public final class RegionStatesCount { | ||
|
|
||
| private int openRegions; | ||
| private int splitRegions; | ||
| private int closedRegions; | ||
| private int regionsInTransition; | ||
| private int totalRegions; | ||
|
|
||
| private RegionStatesCount() { | ||
| } | ||
|
|
||
| public int getClosedRegions() { | ||
| return closedRegions; | ||
| } | ||
|
|
||
| private void setClosedRegions(int closedRegions) { | ||
| this.closedRegions = closedRegions; | ||
| } | ||
|
|
||
| public int getOpenRegions() { | ||
| return openRegions; | ||
| } | ||
|
|
||
| public int getSplitRegions() { | ||
| return splitRegions; | ||
| } | ||
|
|
||
| public int getRegionsInTransition() { | ||
| return regionsInTransition; | ||
| } | ||
|
|
||
| public int getTotalRegions() { | ||
| return totalRegions; | ||
| } | ||
|
|
||
| private void setOpenRegions(int openRegions) { | ||
| this.openRegions = openRegions; | ||
| } | ||
|
|
||
| private void setSplitRegions(int splitRegions) { | ||
| this.splitRegions = splitRegions; | ||
| } | ||
|
|
||
| private void setRegionsInTransition(int regionsInTransition) { | ||
| this.regionsInTransition = regionsInTransition; | ||
| } | ||
|
|
||
| private void setTotalRegions(int totalRegions) { | ||
| this.totalRegions = totalRegions; | ||
| } | ||
|
|
||
| public static class RegionStatesCountBuilder { | ||
| private int openRegions; | ||
| private int splitRegions; | ||
| private int closedRegions; | ||
| private int regionsInTransition; | ||
| private int totalRegions; | ||
|
|
||
| public RegionStatesCountBuilder setOpenRegions(int openRegions) { | ||
| this.openRegions = openRegions; | ||
| return this; | ||
| } | ||
|
|
||
| public RegionStatesCountBuilder setSplitRegions(int splitRegions) { | ||
| this.splitRegions = splitRegions; | ||
| return this; | ||
| } | ||
|
|
||
| public RegionStatesCountBuilder setClosedRegions(int closedRegions) { | ||
| this.closedRegions = closedRegions; | ||
| return this; | ||
| } | ||
|
|
||
| public RegionStatesCountBuilder setRegionsInTransition(int regionsInTransition) { | ||
| this.regionsInTransition = regionsInTransition; | ||
| return this; | ||
| } | ||
|
|
||
| public RegionStatesCountBuilder setTotalRegions(int totalRegions) { | ||
| this.totalRegions = totalRegions; | ||
| return this; | ||
| } | ||
|
|
||
| public RegionStatesCount build() { | ||
| RegionStatesCount regionStatesCount=new RegionStatesCount(); | ||
| regionStatesCount.setOpenRegions(openRegions); | ||
| regionStatesCount.setClosedRegions(closedRegions); | ||
| regionStatesCount.setRegionsInTransition(regionsInTransition); | ||
| regionStatesCount.setSplitRegions(splitRegions); | ||
| regionStatesCount.setTotalRegions(totalRegions); | ||
| return regionStatesCount; | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| final StringBuilder sb = new StringBuilder("RegionStatesCount{"); | ||
| sb.append("openRegions=").append(openRegions); | ||
| sb.append(", splitRegions=").append(splitRegions); | ||
| sb.append(", closedRegions=").append(closedRegions); | ||
| sb.append(", regionsInTransition=").append(regionsInTransition); | ||
| sb.append(", totalRegions=").append(totalRegions); | ||
| sb.append('}'); | ||
| return sb.toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (o == null || getClass() != o.getClass()) { | ||
| return false; | ||
| } | ||
|
|
||
| RegionStatesCount that = (RegionStatesCount) o; | ||
|
|
||
| if (openRegions != that.openRegions) { | ||
| return false; | ||
| } | ||
| if (splitRegions != that.splitRegions) { | ||
| return false; | ||
| } | ||
| if (closedRegions != that.closedRegions) { | ||
| return false; | ||
| } | ||
| if (regionsInTransition != that.regionsInTransition) { | ||
| return false; | ||
| } | ||
| return totalRegions == that.totalRegions; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| int result = openRegions; | ||
| result = 31 * result + splitRegions; | ||
| result = 31 * result + closedRegions; | ||
| result = 31 * result + regionsInTransition; | ||
| result = 31 * result + totalRegions; | ||
| return result; | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's try to align the get & set placement ? all getXX first, then setXX ? or getXX & setXX one by one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done @openinx
Thanks