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