Skip to content

Commit

Permalink
Merge branch 'trunk' of https://github.com/akshatb1/hadoop into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatb1 committed Jun 23, 2021
2 parents a3283a6 + 11d144d commit c10cb69
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
Expand Down Expand Up @@ -211,8 +212,10 @@ public class Balancer {
@VisibleForTesting
private static volatile boolean serviceRunning = false;

private static volatile int exceptionsSinceLastBalance = 0;
private static volatile int failedTimesSinceLastSuccessfulBalance = 0;
private static final AtomicInteger EXCEPTIONS_SINCE_LAST_BALANCE =
new AtomicInteger(0);
private static final AtomicInteger
FAILED_TIMES_SINCE_LAST_SUCCESSFUL_BALANCE = new AtomicInteger(0);

private final Dispatcher dispatcher;
private final NameNodeConnector nnc;
Expand Down Expand Up @@ -274,11 +277,11 @@ static int getInt(Configuration conf, String key, int defaultValue) {
}

static int getExceptionsSinceLastBalance() {
return exceptionsSinceLastBalance;
return EXCEPTIONS_SINCE_LAST_BALANCE.get();
}

static int getFailedTimesSinceLastSuccessfulBalance() {
return failedTimesSinceLastSuccessfulBalance;
return FAILED_TIMES_SINCE_LAST_SUCCESSFUL_BALANCE.get();
}

/**
Expand Down Expand Up @@ -866,20 +869,21 @@ static int run(Collection<URI> namenodes, Collection<String> nsIds,
int retCode = doBalance(namenodes, nsIds, p, conf);
if (retCode < 0) {
LOG.info("Balance failed, error code: " + retCode);
failedTimesSinceLastSuccessfulBalance++;
FAILED_TIMES_SINCE_LAST_SUCCESSFUL_BALANCE.incrementAndGet();
} else {
LOG.info("Balance succeed!");
failedTimesSinceLastSuccessfulBalance = 0;
FAILED_TIMES_SINCE_LAST_SUCCESSFUL_BALANCE.set(0);
}
exceptionsSinceLastBalance = 0;
EXCEPTIONS_SINCE_LAST_BALANCE.set(0);
} catch (Exception e) {
if (++exceptionsSinceLastBalance > retryOnException) {
if (EXCEPTIONS_SINCE_LAST_BALANCE.incrementAndGet()
> retryOnException) {
// The caller will process and log the exception
throw e;
}
LOG.warn(
"Encounter exception while do balance work. Already tried {} times",
exceptionsSinceLastBalance, e);
EXCEPTIONS_SINCE_LAST_BALANCE, e);
}

// sleep for next round, will retry for next round when it's interrupted
Expand Down
2 changes: 1 addition & 1 deletion hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<goal>install-node-and-yarn</goal>
</goals>
<configuration>
<nodeVersion>v10.23.1</nodeVersion>
<nodeVersion>v12.22.1</nodeVersion>
<yarnVersion>v1.22.5</yarnVersion>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "yarn-ui",
"dependencies": {
"ember": "2.2.0",
"ember": "2.11.3",
"ember-cli-shims": "0.0.6",
"ember-cli-test-loader": "0.2.1",
"ember-data": "2.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@
"dependencies": {
"em-helpers": "^0.8.0",
"em-table": "0.12.0"
},
"resolutions": {
"graceful-fs": "^4.2.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3215,33 +3215,11 @@ globule@^1.0.0:
lodash "~4.17.10"
minimatch "~3.0.2"

graceful-fs@^3.0.5:
version "3.0.12"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.12.tgz#0034947ce9ed695ec8ab0b854bc919e82b1ffaef"
integrity sha512-J55gaCS4iTTJfTXIxSVw3EMQckcqkpdRv3IR7gu6sq0+tbC363Zx6KH/SEwXASK9JRbhyZmVjJEVJIOxYsB3Qg==
dependencies:
natives "^1.1.3"

graceful-fs@^4.1.11, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.2.3"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==

graceful-fs@^4.1.2:
graceful-fs@^3.0.5, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.4, graceful-fs@~2.0.0, graceful-fs@~4.1.2:
version "4.2.6"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee"
integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==

graceful-fs@~2.0.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-2.0.3.tgz#7cd2cdb228a4a3f36e95efa6cc142de7d1a136d0"
integrity sha1-fNLNsiiko/Nule+mzBQt59GhNtA=

graceful-fs@~4.1.2:
version "4.1.15"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00"
integrity sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==

growl@^1.8.1:
version "1.10.5"
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
Expand Down Expand Up @@ -4674,11 +4652,6 @@ nan@^2.13.2:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19"
integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==

natives@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.6.tgz#a603b4a498ab77173612b9ea1acdec4d980f00bb"
integrity sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==

negotiator@0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb"
Expand Down

0 comments on commit c10cb69

Please sign in to comment.