Guest User

Untitled

a guest
Mar 26th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java
  2. index 312bcce..76d463a 100644
  3. --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java
  4. +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java
  5. @@ -89,37 +89,28 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
  6. }
  7.  
  8. /**
  9. - * Checks if pool can be updated immediately.
  10. + * Checks if pool can be updated. If so, mark for update later.
  11. * @param conf configuration
  12. - * @return true if pool can be updated immediately, false otherwise
  13. */
  14. - synchronized boolean canUpdateImmediately(Configuration conf) {
  15. + synchronized void markUpdate(Configuration conf) {
  16. int newSize = calculatePoolSize(conf.get(CHORE_POOL_SIZE, DEFAULT_CHORE_POOL_SIZE));
  17. if (newSize == size) {
  18. LOG.trace("Size from configuration is same as previous={}, no need to update.", newSize);
  19. - return false;
  20. + return;
  21. }
  22. size = newSize;
  23. - if (pool.getPoolSize() == 0) {
  24. - // chore has no working thread.
  25. - return true;
  26. - }
  27. // Chore is working, update it later.
  28. reconfigNotification.set(true);
  29. - return false;
  30. }
  31.  
  32. /**
  33. * Update pool with new size.
  34. */
  35. synchronized void updatePool(long timeout) {
  36. - while (cleanerLatch != 0) {
  37. - try {
  38. - wait(timeout);
  39. - } catch (InterruptedException ie) {
  40. - // It's ok to ignore
  41. - }
  42. - break;
  43. + try {
  44. + wait(timeout);
  45. + } catch (InterruptedException ie) {
  46. + Thread.currentThread().interrupt();
  47. }
  48. pool.shutdownNow();
  49. LOG.info("Update chore's pool size from {} to {}", pool.getParallelism(), size);
  50. @@ -243,10 +234,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
  51.  
  52. @Override
  53. public void onConfigurationChange(Configuration conf) {
  54. - if (POOL.canUpdateImmediately(conf)) {
  55. - // Can immediately update, no need to wait.
  56. - POOL.updatePool(0);
  57. - }
  58. + POOL.markUpdate(conf);
  59. }
  60.  
  61. /**
Advertisement
Add Comment
Please, Sign In to add comment