-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-26163 Better logging in RSGroupInfoManagerImpl #3610
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 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
61450e6
HBASE-26163 Better logging in RSGroupInfoManagerImpl
caroliney14 c8145e0
move long messages to debug level
caroliney14 80e7bf7
Merge branch 'master' of https://github.com/caroliney14/hbase into HB…
caroliney14 e7aeb13
pr rev
caroliney14 4ecd3ed
Merge branch 'master' of https://github.com/caroliney14/hbase into HB…
caroliney14 608893b
remove tostring
caroliney14 fb2282e
Merge branch 'master' of https://github.com/caroliney14/hbase into HB…
caroliney14 1c7711a
move lists to debug
caroliney14 6847cce
Merge branch 'master' of https://github.com/caroliney14/hbase into HB…
caroliney14 87d6d71
Merge branch 'master' of https://github.com/caroliney14/hbase into HB…
caroliney14 a8720f8
Merge branch 'master' of https://github.com/caroliney14/hbase into HB…
caroliney14 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,6 +257,9 @@ private synchronized void updateDefaultServers() { | |
| // do not need to persist, as we do not persist default group. | ||
| resetRSGroupMap(newGroupMap); | ||
| LOG.info("Updated default servers, {} servers", newDefaultGroupInfo.getServers().size()); | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("New default servers list: {}", newDefaultGroupInfo.getServers()); | ||
| } | ||
| } | ||
|
|
||
| private synchronized void init() throws IOException { | ||
|
|
@@ -298,6 +301,7 @@ public synchronized void addRSGroup(RSGroupInfo rsGroupInfo) throws IOException | |
| Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap); | ||
| newGroupMap.put(rsGroupInfo.getName(), rsGroupInfo); | ||
| flushConfig(newGroupMap); | ||
| LOG.info("Add group {} done.", rsGroupInfo.getName()); | ||
| } | ||
|
|
||
| private RSGroupInfo getRSGroupInfo(final String groupName) throws ConstraintException { | ||
|
|
@@ -331,7 +335,7 @@ public synchronized Set<Address> moveServers(Set<Address> servers, String srcGro | |
| if (onlineServers != null) { | ||
| if (!onlineServers.contains(el)) { | ||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("Dropping " + el + " during move-to-default rsgroup because not online"); | ||
| LOG.debug("Dropping " + el + " during move-to-default RSGroup because not online"); | ||
| } | ||
| continue; | ||
| } | ||
|
|
@@ -373,8 +377,8 @@ public synchronized void removeRSGroup(String groupName) throws IOException { | |
| for (TableDescriptor td : masterServices.getTableDescriptors().getAll().values()) { | ||
| if (td.getRegionServerGroup().map(groupName::equals).orElse(false)) { | ||
| throw new ConstraintException("RSGroup " + groupName + " is already referenced by " + | ||
| td.getTableName() + "; you must remove all the tables from the rsgroup before " + | ||
| "the rsgroup can be removed."); | ||
| td.getTableName() + "; you must remove all the tables from the RSGroup before " + | ||
| "the RSGroup can be removed."); | ||
| } | ||
| } | ||
| for (NamespaceDescriptor ns : masterServices.getClusterSchema().getNamespaces()) { | ||
|
|
@@ -392,6 +396,7 @@ public synchronized void removeRSGroup(String groupName) throws IOException { | |
| Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(rsGroupMap); | ||
| newGroupMap.remove(groupName); | ||
| flushConfig(newGroupMap); | ||
| LOG.info("Remove group {} done", groupName); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -639,6 +644,8 @@ private synchronized void flushConfig(Map<String, RSGroupInfo> newGroupMap) thro | |
| return; | ||
| } | ||
|
|
||
| LOG.debug("Offline mode, cannot persist to {}", RSGROUP_TABLE_NAME); | ||
|
|
||
| Map<String, RSGroupInfo> oldGroupMap = Maps.newHashMap(holder.groupName2Group); | ||
| RSGroupInfo oldDefaultGroup = oldGroupMap.remove(RSGroupInfo.DEFAULT_GROUP); | ||
| RSGroupInfo newDefaultGroup = newGroupMap.remove(RSGroupInfo.DEFAULT_GROUP); | ||
|
|
@@ -655,22 +662,27 @@ private synchronized void flushConfig(Map<String, RSGroupInfo> newGroupMap) thro | |
| // according to the inputted newGroupMap (an updated copy of rsGroupMap) | ||
| this.holder = new RSGroupInfoHolder(newGroupMap); | ||
|
|
||
| LOG.debug("New RSGroup map: {}", newGroupMap); | ||
|
|
||
| // Do not need to update tableMap | ||
| // because only the update on servers in default group is allowed above, | ||
| // or IOException will be thrown | ||
| return; | ||
| } | ||
|
|
||
| /* For online mode, persist to hbase:rsgroup and Zookeeper */ | ||
| LOG.debug("Online mode, persisting to {} and ZK", RSGROUP_TABLE_NAME); | ||
| flushConfigTable(newGroupMap); | ||
|
|
||
| // Make changes visible after having been persisted to the source of truth | ||
| resetRSGroupMap(newGroupMap); | ||
| saveRSGroupMapToZK(newGroupMap); | ||
| updateCacheOfRSGroups(newGroupMap.keySet()); | ||
| LOG.info("Flush config done, new RSGroup map: {}", newGroupMap); | ||
| } | ||
|
|
||
| private void saveRSGroupMapToZK(Map<String, RSGroupInfo> newGroupMap) throws IOException { | ||
| LOG.debug("Saving RSGroup info to ZK"); | ||
| try { | ||
| String groupBasePath = | ||
| ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, RS_GROUP_ZNODE); | ||
|
|
@@ -800,6 +812,7 @@ private void createRSGroupTable() throws IOException { | |
| if (optProcId.isPresent()) { | ||
| procId = optProcId.getAsLong(); | ||
| } else { | ||
| LOG.debug("Creating group table {}", RSGROUP_TABLE_NAME); | ||
| procId = masterServices.createSystemTable(RSGROUP_TABLE_DESC); | ||
| } | ||
| // wait for region to be online | ||
|
|
@@ -849,9 +862,11 @@ private void multiMutate(List<Mutation> mutations) throws IOException { | |
| } | ||
| MutateRowsRequest request = builder.build(); | ||
| AsyncTable<?> table = conn.getTable(RSGROUP_TABLE_NAME); | ||
| LOG.debug("Multimutating {} with {} mutations", RSGROUP_TABLE_NAME, mutations.size()); | ||
| FutureUtils.get(table.<MultiRowMutationService, MutateRowsResponse> coprocessorService( | ||
| MultiRowMutationService::newStub, | ||
| (stub, controller, done) -> stub.mutateRows(controller, request, done), ROW_KEY)); | ||
| LOG.info("Multimutating {} with {} mutations done", RSGROUP_TABLE_NAME, mutations.size()); | ||
| } | ||
|
|
||
| private void checkGroupName(String groupName) throws ConstraintException { | ||
|
|
@@ -871,7 +886,7 @@ public RSGroupInfo getRSGroupForTable(TableName tableName) throws IOException { | |
| * @param servers servers to remove | ||
| */ | ||
| private void checkForDeadOrOnlineServers(Set<Address> servers) throws IOException { | ||
| // This uglyness is because we only have Address, not ServerName. | ||
| // This ugliness is because we only have Address, not ServerName. | ||
| Set<Address> onlineServers = new HashSet<>(); | ||
| List<ServerName> drainingServers = masterServices.getServerManager().getDrainingServersList(); | ||
| for (ServerName server : masterServices.getServerManager().getOnlineServers().keySet()) { | ||
|
|
@@ -1001,7 +1016,7 @@ private <T> void moveRegionsBetweenGroups(Set<T> regionsOwners, Set<Address> new | |
| // Get regions that are associated with this server and filter regions by group tables. | ||
| for (RegionInfo region : getRegionsInfo.apply((T) owner.getAddress())) { | ||
| if (!validation.apply(region)) { | ||
| LOG.info("Moving region {}, which do not belong to RSGroup {}", | ||
| LOG.info("Moving region {}, which does not belong to RSGroup {}", | ||
| region.getShortNameToLog(), targetGroupName); | ||
| // Move region back to source RSGroup servers | ||
| ServerName dest = | ||
|
|
@@ -1186,6 +1201,7 @@ public boolean balanceRSGroup(String groupName) throws IOException { | |
| } | ||
|
|
||
| private void moveTablesAndWait(Set<TableName> tables, String targetGroup) throws IOException { | ||
| LOG.debug("Moving {} tables to target group {}", tables.size(), targetGroup); | ||
| List<Long> procIds = new ArrayList<Long>(); | ||
| for (TableName tableName : tables) { | ||
| TableDescriptor oldTd = masterServices.getTableDescriptors().get(tableName); | ||
|
|
@@ -1205,6 +1221,7 @@ private void moveTablesAndWait(Set<TableName> tables, String targetGroup) throws | |
| ProcedureSyncWait.waitForProcedureToCompleteIOE(masterServices.getMasterProcedureExecutor(), | ||
| proc, Long.MAX_VALUE); | ||
| } | ||
| LOG.info("Move tables done. Moved {} tables to {}: {}", tables.size(), targetGroup, tables); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -1270,7 +1287,8 @@ public void moveServers(Set<Address> servers, String targetGroupName) throws IOE | |
| Set<Address> movedServers = moveServers(servers, srcGrp.getName(), | ||
| targetGroupName); | ||
| moveServerRegionsFromGroup(movedServers, srcGrp.getServers(), targetGroupName, srcGrp.getName()); | ||
| LOG.info("Move servers done: {} => {}", srcGrp.getName(), targetGroupName); | ||
| LOG.info("Move servers done. Moved {} servers from {} => {}: {}", movedServers.size(), | ||
|
||
| srcGrp.getName(), targetGroupName, movedServers); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1304,6 +1322,7 @@ public synchronized void renameRSGroup(String oldName, String newName) throws IO | |
| .map(TableDescriptor::getTableName) | ||
| .collect(Collectors.toSet()); | ||
| setRSGroup(updateTables, newName); | ||
| LOG.info("Rename RSGroup done: {} => {}", oldName, newName); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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.
We will log too much if the level is info here? Can we just info the size and the target group, and add another debug log to log all the tables?
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