You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/08/24 08:56:08 UTC
[hbase] branch branch-2.4 updated: HBASE-27246 RSGroupMappingScript#getRSGroup has thread safety problem (#4657)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new c8969e18599 HBASE-27246 RSGroupMappingScript#getRSGroup has thread safety problem (#4657)
c8969e18599 is described below
commit c8969e18599b8954e64d6cfc0b869f1efe332a0e
Author: Yutong Xiao <yu...@gmail.com>
AuthorDate: Wed Aug 24 15:23:21 2022 +0800
HBASE-27246 RSGroupMappingScript#getRSGroup has thread safety problem (#4657)
Co-authored-by: Sean Xiao Yutong <se...@shopee.com>
Signed-off-by: Duo Zhang <zh...@apache.org>
(cherry picked from commit b44bfc52cc9b1d46a15f2dbca0caa220c2f0828b)
Conflicts:
hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
---
.../hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
index 08baab22abb..79d6ffdd605 100644
--- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
+++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
@@ -147,23 +147,21 @@ final class RSGroupInfoManagerImpl implements RSGroupInfoManager {
static final String RS_GROUP_MAPPING_SCRIPT_TIMEOUT =
"hbase.rsgroup.table.mapping.script.timeout";
- private Shell.ShellCommandExecutor rsgroupMappingScript;
+ private final String script;
+ private final long scriptTimeout;
RSGroupMappingScript(Configuration conf) {
- String script = conf.get(RS_GROUP_MAPPING_SCRIPT);
- if (script == null || script.isEmpty()) {
- return;
- }
-
- rsgroupMappingScript = new Shell.ShellCommandExecutor(new String[] { script, "", "" }, null,
- null, conf.getLong(RS_GROUP_MAPPING_SCRIPT_TIMEOUT, 5000) // 5 seconds
- );
+ script = conf.get(RS_GROUP_MAPPING_SCRIPT);
+ scriptTimeout = conf.getLong(RS_GROUP_MAPPING_SCRIPT_TIMEOUT, 5000); // 5 seconds
}
String getRSGroup(String namespace, String tablename) {
- if (rsgroupMappingScript == null) {
+ if (script == null || script.isEmpty()) {
return null;
}
+ Shell.ShellCommandExecutor rsgroupMappingScript =
+ new Shell.ShellCommandExecutor(new String[] { script, "", "" }, null, null, scriptTimeout);
+
String[] exec = rsgroupMappingScript.getExecString();
exec[1] = namespace;
exec[2] = tablename;