@@ -66,6 +66,8 @@ public class WorkloadGroup implements Writable, GsonPostProcessable {
6666
6767 public static final String MIN_MEMORY_PERCENT = "min_memory_percent" ;
6868
69+ public static final String ENABLE_MEMORY_OVERCOMMIT = "enable_memory_overcommit" ;
70+
6971 public static final String MAX_CONCURRENCY = "max_concurrency" ;
7072
7173 public static final String MAX_QUEUE_SIZE = "max_queue_size" ;
@@ -99,13 +101,13 @@ public class WorkloadGroup implements Writable, GsonPostProcessable {
99101 // NOTE(wb): all property is not required, some properties default value is set in be
100102 // default value is as followed
101103 private static final ImmutableSet <String > ALL_PROPERTIES_NAME = new ImmutableSet .Builder <String >()
102- .add (MAX_CPU_PERCENT ).add (MIN_CPU_PERCENT )
103- .add (MAX_MEMORY_PERCENT ).add (MIN_MEMORY_PERCENT )
104- .add (MAX_CONCURRENCY ).add (MAX_QUEUE_SIZE ).add (QUEUE_TIMEOUT )
105- .add (SCAN_THREAD_NUM ).add (MAX_REMOTE_SCAN_THREAD_NUM ).add (MIN_REMOTE_SCAN_THREAD_NUM )
106- .add (MEMORY_LOW_WATERMARK ).add (MEMORY_HIGH_WATERMARK )
107- .add (COMPUTE_GROUP ).add (READ_BYTES_PER_SECOND ).add (REMOTE_READ_BYTES_PER_SECOND )
108- .add (SLOT_MEMORY_POLICY ).build ();
104+ .add (MAX_CPU_PERCENT ).add (MIN_CPU_PERCENT )
105+ .add (MAX_MEMORY_PERCENT ).add (MIN_MEMORY_PERCENT )
106+ .add (MAX_CONCURRENCY ).add (MAX_QUEUE_SIZE ).add (QUEUE_TIMEOUT )
107+ .add (SCAN_THREAD_NUM ).add (MAX_REMOTE_SCAN_THREAD_NUM ).add (MIN_REMOTE_SCAN_THREAD_NUM )
108+ .add (MEMORY_LOW_WATERMARK ).add (MEMORY_HIGH_WATERMARK )
109+ .add (COMPUTE_GROUP ).add (READ_BYTES_PER_SECOND ).add (REMOTE_READ_BYTES_PER_SECOND )
110+ .add (SLOT_MEMORY_POLICY ).build ();
109111
110112
111113 public static final int MAX_CPU_PERCENT_DEFAULT_VALUE = 100 ;
@@ -133,10 +135,10 @@ public class WorkloadGroup implements Writable, GsonPostProcessable {
133135
134136 public static final String SLOT_MEMORY_POLICY_DEFAULT_VALUE = "none" ;
135137 public static final HashSet <String > AVAILABLE_SLOT_MEMORY_POLICY_VALUES = new HashSet <String >() {{
136- add ("none" );
137- add ("fixed" );
138- add ("dynamic" );
139- }};
138+ add ("none" );
139+ add ("fixed" );
140+ add ("dynamic" );
141+ }};
140142
141143 @ SerializedName (value = "id" )
142144 private long id ;
@@ -240,16 +242,16 @@ public static WorkloadGroup create(String name, Map<String, String> properties)
240242
241243 // alter resource group
242244 public static WorkloadGroup copyAndUpdate (WorkloadGroup currentWorkloadGroup , Map <String , String > updateProperties )
243- throws DdlException {
245+ throws DdlException {
244246 Map <String , String > newProperties = new HashMap <>(currentWorkloadGroup .getProperties ());
245247 for (Map .Entry <String , String > kv : updateProperties .entrySet ()) {
246248 newProperties .put (kv .getKey (), kv .getValue ());
247249 }
248250
249251 checkProperties (newProperties );
250252 WorkloadGroup newWorkloadGroup = new WorkloadGroup (
251- currentWorkloadGroup .getId (), currentWorkloadGroup .getName (),
252- newProperties , currentWorkloadGroup .getVersion () + 1 );
253+ currentWorkloadGroup .getId (), currentWorkloadGroup .getName (),
254+ newProperties , currentWorkloadGroup .getVersion () + 1 );
253255 return newWorkloadGroup ;
254256 }
255257
@@ -275,8 +277,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
275277 }
276278 } catch (NumberFormatException e ) {
277279 throw new DdlException (
278- "The allowed " + MIN_CPU_PERCENT + " value has to be in [0,100], but input value is "
279- + inputValue );
280+ "The allowed " + MIN_CPU_PERCENT + " value has to be in [0,100], but input value is "
281+ + inputValue );
280282 }
281283 } else {
282284 properties .put (MIN_CPU_PERCENT , "0" );
@@ -297,8 +299,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
297299 }
298300 } catch (NumberFormatException e ) {
299301 throw new DdlException (
300- "The allowed " + MAX_CPU_PERCENT + " value has to be in [1,100], but input value is "
301- + inputValue );
302+ "The allowed " + MAX_CPU_PERCENT + " value has to be in [1,100], but input value is "
303+ + inputValue );
302304 }
303305 } else {
304306 properties .put (MAX_CPU_PERCENT , "100" );
@@ -307,8 +309,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
307309
308310 if (maxCpuPercent < minCpuPercent ) {
309311 throw new DdlException (MAX_CPU_PERCENT + "'s value " + maxCpuPercent
310- + " has to be great or equal than "
311- + MIN_CPU_PERCENT + " " + minCpuPercent );
312+ + " has to be great or equal than "
313+ + MIN_CPU_PERCENT + " " + minCpuPercent );
312314 }
313315
314316 int maxMemPercent = 0 ;
@@ -326,8 +328,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
326328 }
327329 } catch (NumberFormatException e ) {
328330 throw new DdlException (
329- "The allowed " + MAX_MEMORY_PERCENT + " value has to be in [1,100], but input value is "
330- + inputValue );
331+ "The allowed " + MAX_MEMORY_PERCENT + " value has to be in [1,100], but input value is "
332+ + inputValue );
331333 }
332334 } else {
333335 properties .put (MAX_MEMORY_PERCENT , "100" );
@@ -349,8 +351,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
349351 }
350352 } catch (NumberFormatException e ) {
351353 throw new DdlException (
352- "The allowed " + MIN_MEMORY_PERCENT + " value has to be in [0,100], but input value is "
353- + inputValue );
354+ "The allowed " + MIN_MEMORY_PERCENT + " value has to be in [0,100], but input value is "
355+ + inputValue );
354356 }
355357 } else {
356358 properties .put (MIN_MEMORY_PERCENT , "0" );
@@ -359,15 +361,15 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
359361
360362 if (maxMemPercent < minMemPercent ) {
361363 throw new DdlException (MAX_MEMORY_PERCENT + "'s value " + maxMemPercent
362- + " has to be great or equal than "
363- + MIN_MEMORY_PERCENT + " " + minMemPercent );
364+ + " has to be great or equal than "
365+ + MIN_MEMORY_PERCENT + " " + minMemPercent );
364366 }
365367
366368 if (properties .containsKey (SLOT_MEMORY_POLICY )) {
367369 String value = properties .get (SLOT_MEMORY_POLICY ).toLowerCase ();
368370 if (!AVAILABLE_SLOT_MEMORY_POLICY_VALUES .contains (value )) {
369371 throw new DdlException ("The value of '" + SLOT_MEMORY_POLICY
370- + "' must be one of none, fixed, dynamic." );
372+ + "' must be one of none, fixed, dynamic." );
371373 }
372374 }
373375
@@ -380,8 +382,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
380382 }
381383 } catch (NumberFormatException e ) {
382384 throw new DdlException (
383- "The allowed " + SCAN_THREAD_NUM + " value is -1 or a positive integer. but input value is "
384- + value );
385+ "The allowed " + SCAN_THREAD_NUM + " value is -1 or a positive integer. but input value is "
386+ + value );
385387 }
386388 }
387389
@@ -396,8 +398,8 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
396398 maxRemoteScanNum = intValue ;
397399 } catch (NumberFormatException e ) {
398400 throw new DdlException (
399- "The allowed " + MAX_REMOTE_SCAN_THREAD_NUM
400- + " value is -1 or a positive integer. but input value is " + value );
401+ "The allowed " + MAX_REMOTE_SCAN_THREAD_NUM
402+ + " value is -1 or a positive integer. but input value is " + value );
401403 }
402404 }
403405
@@ -412,14 +414,14 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
412414 minRemoteScanNum = intValue ;
413415 } catch (NumberFormatException e ) {
414416 throw new DdlException (
415- "The allowed " + MIN_REMOTE_SCAN_THREAD_NUM
416- + " value is -1 or a positive integer. but input value is " + value );
417+ "The allowed " + MIN_REMOTE_SCAN_THREAD_NUM
418+ + " value is -1 or a positive integer. but input value is " + value );
417419 }
418420 }
419421
420422 if ((maxRemoteScanNum == -1 && minRemoteScanNum != -1 ) || (maxRemoteScanNum != -1 && minRemoteScanNum == -1 )) {
421423 throw new DdlException (MAX_REMOTE_SCAN_THREAD_NUM + " and " + MIN_REMOTE_SCAN_THREAD_NUM
422- + " must be specified simultaneously" );
424+ + " must be specified simultaneously" );
423425 } else if (maxRemoteScanNum < minRemoteScanNum ) {
424426 throw new DdlException (MAX_REMOTE_SCAN_THREAD_NUM + " must bigger or equal " + MIN_REMOTE_SCAN_THREAD_NUM );
425427 }
@@ -433,9 +435,9 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
433435 }
434436 } catch (NumberFormatException e ) {
435437 throw new DdlException (
436- "The allowed " + MAX_CONCURRENCY
437- + " value is an integer greater than or equal to 0, but input value is "
438- + inputValue );
438+ "The allowed " + MAX_CONCURRENCY
439+ + " value is an integer greater than or equal to 0, but input value is "
440+ + inputValue );
439441 }
440442 }
441443 if (properties .containsKey (MAX_QUEUE_SIZE )) {
@@ -446,9 +448,9 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
446448 }
447449 } catch (NumberFormatException e ) {
448450 throw new DdlException (
449- "The allowed " + MAX_QUEUE_SIZE
450- + " value is an integer greater than or equal to 0, but input value is "
451- + inputValue );
451+ "The allowed " + MAX_QUEUE_SIZE
452+ + " value is an integer greater than or equal to 0, but input value is "
453+ + inputValue );
452454 }
453455 }
454456 if (properties .containsKey (QUEUE_TIMEOUT )) {
@@ -459,9 +461,9 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
459461 }
460462 } catch (NumberFormatException e ) {
461463 throw new DdlException (
462- "The allowed " + QUEUE_TIMEOUT
463- + " value is an integer greater than or equal to 0, but input value is "
464- + inputValue );
464+ "The allowed " + QUEUE_TIMEOUT
465+ + " value is an integer greater than or equal to 0, but input value is "
466+ + inputValue );
465467 }
466468 }
467469
@@ -479,9 +481,9 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
479481 lowWaterMark = intValue ;
480482 } catch (NumberFormatException e ) {
481483 throw new DdlException (
482- "The allowed " + MEMORY_LOW_WATERMARK
483- + " value is an integer value between 1 and 100, but input value is "
484- + lowVal );
484+ "The allowed " + MEMORY_LOW_WATERMARK
485+ + " value is an integer value between 1 and 100, but input value is "
486+ + lowVal );
485487 }
486488 }
487489
@@ -499,15 +501,15 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
499501 highWaterMark = intValue ;
500502 } catch (NumberFormatException e ) {
501503 throw new DdlException (
502- "The allowed " + MEMORY_HIGH_WATERMARK
503- + " value is an integer value between 1 and 100, but input value is "
504- + highVal );
504+ "The allowed " + MEMORY_HIGH_WATERMARK
505+ + " value is an integer value between 1 and 100, but input value is "
506+ + highVal );
505507 }
506508 }
507509
508510 if (lowWaterMark > highWaterMark ) {
509511 throw new DdlException (MEMORY_HIGH_WATERMARK + "(" + highWaterMark + ") should bigger than "
510- + MEMORY_LOW_WATERMARK + "(" + lowWaterMark + ")" );
512+ + MEMORY_LOW_WATERMARK + "(" + lowWaterMark + ")" );
511513 }
512514
513515 if (properties .containsKey (READ_BYTES_PER_SECOND )) {
@@ -519,9 +521,9 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
519521 }
520522 } catch (NumberFormatException e ) {
521523 throw new DdlException (
522- "The allowed " + READ_BYTES_PER_SECOND
523- + " value should be -1 or an positive integer, but input value is "
524- + readBytesVal );
524+ "The allowed " + READ_BYTES_PER_SECOND
525+ + " value should be -1 or an positive integer, but input value is "
526+ + readBytesVal );
525527 }
526528 }
527529
@@ -534,7 +536,7 @@ private static void checkProperties(Map<String, String> properties) throws DdlEx
534536 }
535537 } catch (NumberFormatException e ) {
536538 throw new DdlException ("The allowed " + REMOTE_READ_BYTES_PER_SECOND
537- + " value should be -1 or an positive integer, but input value is " + readBytesVal );
539+ + " value should be -1 or an positive integer, but input value is " + readBytesVal );
538540 }
539541 }
540542 }
@@ -583,7 +585,7 @@ public int getMinMemoryPercent() {
583585 String minMemPercentStr = properties .get (MIN_MEMORY_PERCENT );
584586 if (minMemPercentStr .endsWith ("%" )) {
585587 return Integer .valueOf (minMemPercentStr .substring (0 ,
586- minMemPercentStr .length () - 1 ));
588+ minMemPercentStr .length () - 1 ));
587589 }
588590 return Integer .valueOf (minMemPercentStr );
589591 }
@@ -592,7 +594,7 @@ public int getMaxMemoryPercent() {
592594 String maxMemPercentStr = properties .get (MAX_MEMORY_PERCENT );
593595 if (maxMemPercentStr .endsWith ("%" )) {
594596 return Integer .valueOf (maxMemPercentStr .substring (0 ,
595- maxMemPercentStr .length () - 1 ));
597+ maxMemPercentStr .length () - 1 ));
596598 }
597599 return Integer .valueOf (maxMemPercentStr );
598600 }
@@ -626,7 +628,7 @@ public void getProcNodeData(BaseProcResult result) {
626628 if (!StringUtils .isEmpty (val ) && Config .isCloudMode ()) {
627629 try {
628630 String cgName = ((CloudSystemInfoService ) Env .getCurrentSystemInfo ()).getClusterNameByClusterId (
629- val );
631+ val );
630632 if (!StringUtils .isEmpty (cgName )) {
631633 val = cgName ;
632634 }
@@ -640,11 +642,11 @@ public void getProcNodeData(BaseProcResult result) {
640642 if (StringUtils .isEmpty (val )) {
641643 row .add (ALL_PROPERTIES_DEFAULT_VALUE_MAP .get (key ));
642644 } else if (MIN_CPU_PERCENT .equals (key )
643- || MAX_CPU_PERCENT .equals (key )
644- || MIN_MEMORY_PERCENT .equals (key )
645- || MAX_MEMORY_PERCENT .equals (key )
646- || MEMORY_LOW_WATERMARK .equals (key )
647- || MEMORY_HIGH_WATERMARK .equals (key )) {
645+ || MAX_CPU_PERCENT .equals (key )
646+ || MIN_MEMORY_PERCENT .equals (key )
647+ || MAX_MEMORY_PERCENT .equals (key )
648+ || MEMORY_LOW_WATERMARK .equals (key )
649+ || MEMORY_HIGH_WATERMARK .equals (key )) {
648650 row .add (val + "%" );
649651 } else {
650652 row .add (val );
0 commit comments