HDFS-2240. Fix a deadlock in LeaseRenewer by enforcing lock acquisition ordering.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1156977 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1c2ab728f5
commit
d5ef72e8c1
|
@ -961,6 +961,9 @@ Trunk (unreleased changes)
|
||||||
|
|
||||||
HDFS-2186. DN volume failures on startup are not counted. (eli)
|
HDFS-2186. DN volume failures on startup are not counted. (eli)
|
||||||
|
|
||||||
|
HDFS-2240. Fix a deadlock in LeaseRenewer by enforcing lock acquisition
|
||||||
|
ordering. (szetszwo)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-1073 SUBTASKS
|
BREAKDOWN OF HDFS-1073 SUBTASKS
|
||||||
|
|
||||||
HDFS-1521. Persist transaction ID on disk between NN restarts.
|
HDFS-1521. Persist transaction ID on disk between NN restarts.
|
||||||
|
|
|
@ -75,7 +75,9 @@ class LeaseRenewer {
|
||||||
/** Get a {@link LeaseRenewer} instance */
|
/** Get a {@link LeaseRenewer} instance */
|
||||||
static LeaseRenewer getInstance(final String authority,
|
static LeaseRenewer getInstance(final String authority,
|
||||||
final UserGroupInformation ugi, final DFSClient dfsc) throws IOException {
|
final UserGroupInformation ugi, final DFSClient dfsc) throws IOException {
|
||||||
return Factory.INSTANCE.get(authority, ugi, dfsc);
|
final LeaseRenewer r = Factory.INSTANCE.get(authority, ugi);
|
||||||
|
r.addClient(dfsc);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,14 +134,13 @@ class LeaseRenewer {
|
||||||
|
|
||||||
/** Get a renewer. */
|
/** Get a renewer. */
|
||||||
private synchronized LeaseRenewer get(final String authority,
|
private synchronized LeaseRenewer get(final String authority,
|
||||||
final UserGroupInformation ugi, final DFSClient dfsc) {
|
final UserGroupInformation ugi) {
|
||||||
final Key k = new Key(authority, ugi);
|
final Key k = new Key(authority, ugi);
|
||||||
LeaseRenewer r = renewers.get(k);
|
LeaseRenewer r = renewers.get(k);
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
r = new LeaseRenewer(k);
|
r = new LeaseRenewer(k);
|
||||||
renewers.put(k, r);
|
renewers.put(k, r);
|
||||||
}
|
}
|
||||||
r.addClient(dfsc);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +197,7 @@ class LeaseRenewer {
|
||||||
|
|
||||||
private LeaseRenewer(Factory.Key factorykey) {
|
private LeaseRenewer(Factory.Key factorykey) {
|
||||||
this.factorykey = factorykey;
|
this.factorykey = factorykey;
|
||||||
setGraceSleepPeriod(LEASE_RENEWER_GRACE_DEFAULT);
|
unsyncSetGraceSleepPeriod(LEASE_RENEWER_GRACE_DEFAULT);
|
||||||
|
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
instantiationTrace = StringUtils.stringifyException(
|
instantiationTrace = StringUtils.stringifyException(
|
||||||
|
@ -251,6 +252,10 @@ class LeaseRenewer {
|
||||||
|
|
||||||
/** Set the grace period and adjust the sleep period accordingly. */
|
/** Set the grace period and adjust the sleep period accordingly. */
|
||||||
synchronized void setGraceSleepPeriod(final long gracePeriod) {
|
synchronized void setGraceSleepPeriod(final long gracePeriod) {
|
||||||
|
unsyncSetGraceSleepPeriod(gracePeriod);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unsyncSetGraceSleepPeriod(final long gracePeriod) {
|
||||||
if (gracePeriod < 100L) {
|
if (gracePeriod < 100L) {
|
||||||
throw new HadoopIllegalArgumentException(gracePeriod
|
throw new HadoopIllegalArgumentException(gracePeriod
|
||||||
+ " = gracePeriod < 100ms is too small.");
|
+ " = gracePeriod < 100ms is too small.");
|
||||||
|
|
Loading…
Reference in New Issue