HDFS-9467. Fix data race accessing writeLockHeldTimeStamp in FSNamesystem. Contributed by Mingliang Liu.
This commit is contained in:
parent
fc799ab16c
commit
e556c35b05
|
@ -2400,6 +2400,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-9407. TestFileTruncate should not use fixed NN port.
|
HDFS-9407. TestFileTruncate should not use fixed NN port.
|
||||||
(Brahma Reddy Battula via shv)
|
(Brahma Reddy Battula via shv)
|
||||||
|
|
||||||
|
HDFS-9467. Fix data race accessing writeLockHeldTimeStamp in FSNamesystem.
|
||||||
|
(Mingliang Liu via jing9)
|
||||||
|
|
||||||
Release 2.7.3 - UNRELEASED
|
Release 2.7.3 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -1498,16 +1498,15 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
|
||||||
public void writeUnlock() {
|
public void writeUnlock() {
|
||||||
final boolean needReport = fsLock.getWriteHoldCount() == 1 &&
|
final boolean needReport = fsLock.getWriteHoldCount() == 1 &&
|
||||||
fsLock.isWriteLockedByCurrentThread();
|
fsLock.isWriteLockedByCurrentThread();
|
||||||
|
final long writeLockInterval = monotonicNow() - writeLockHeldTimeStamp;
|
||||||
|
|
||||||
this.fsLock.writeLock().unlock();
|
this.fsLock.writeLock().unlock();
|
||||||
|
|
||||||
if (needReport) {
|
if (needReport && writeLockInterval >= WRITELOCK_REPORTING_THRESHOLD) {
|
||||||
long writeLockInterval = monotonicNow() - writeLockHeldTimeStamp;
|
|
||||||
if (writeLockInterval >= WRITELOCK_REPORTING_THRESHOLD) {
|
|
||||||
LOG.info("FSNamesystem write lock held for " + writeLockInterval +
|
LOG.info("FSNamesystem write lock held for " + writeLockInterval +
|
||||||
" ms via\n" + StringUtils.getStackTrace(Thread.currentThread()));
|
" ms via\n" + StringUtils.getStackTrace(Thread.currentThread()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasWriteLock() {
|
public boolean hasWriteLock() {
|
||||||
return this.fsLock.isWriteLockedByCurrentThread();
|
return this.fsLock.isWriteLockedByCurrentThread();
|
||||||
|
|
Loading…
Reference in New Issue