ystaticy commented on a change in pull request #1588:
URL: https://github.com/apache/hbase/pull/1588#discussion_r420827744



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/throttle/CompactionThroughputControllerFactory.java
##########
@@ -47,24 +53,35 @@ private CompactionThroughputControllerFactory() {
 
   public static ThroughputController create(RegionServerServices server,
       Configuration conf) {
-    Class<? extends ThroughputController> clazz = 
getThroughputControllerClass(conf);
-    ThroughputController controller = ReflectionUtils.newInstance(clazz, conf);
-    controller.setup(server);
+    Class<? extends ThroughputController> clazz =
+        getThroughputControllerClass(conf);
+    ThroughputController controller = controllerMap.get(clazz);
+    if (controller == null) {
+      controller = ReflectionUtils.newInstance(clazz, conf);
+      controller.setup(server);
+      controllerMap.put(clazz, controller);
+    } else {

Review comment:
       > why change it into this?
   
   if the situation is as follows:
   1.we start RS with PressureAwareCompactionThroughputController
   2.then change the conf to NoLimitThroughputController ,and execute 
'update_config'
   3.then change back the conf to 
PressureAwareCompactionThroughputController,and execute 'update_config'
   
   In master branch now , step 2 and step 3 all create the new contoller object.
   But the compaction started before step1 is still use the old Controller 
object(can not be update).
   
   So I want to cache the controller to a map ,
   so that we can execute 'update_config' to update the controller of the 
compaction started before step1。
   
   step 1 and step 3 will use the same controller object in this patch.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to