HDFS-9467. Fix data race accessing writeLockHeldTimeStamp in FSNamesystem. Contributed by Mingliang Liu.
(cherry picked from commite556c35b05
) (cherry picked from commit288cf8437b
)
This commit is contained in:
parent
0d8a1636ef
commit
8aa18534d9
|
@ -1503,14 +1503,13 @@ 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) {
|
||||
LOG.info("FSNamesystem write lock held for " + writeLockInterval +
|
||||
" ms via\n" + StringUtils.getStackTrace(Thread.currentThread()));
|
||||
}
|
||||
if (needReport && writeLockInterval >= WRITELOCK_REPORTING_THRESHOLD) {
|
||||
LOG.info("FSNamesystem write lock held for " + writeLockInterval +
|
||||
" ms via\n" + StringUtils.getStackTrace(Thread.currentThread()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue