HDFS-10485. Fix findbugs warning in FSEditLog.java. (aajisaka)
(cherry picked from commite620530301
) (cherry picked from commitb8c1db6f63
)
This commit is contained in:
parent
e327325a37
commit
a17fc1dca3
|
@ -27,6 +27,7 @@
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
@ -175,7 +176,7 @@ private enum State {
|
||||||
|
|
||||||
// these are statistics counters.
|
// these are statistics counters.
|
||||||
private long numTransactions; // number of transactions
|
private long numTransactions; // number of transactions
|
||||||
private long numTransactionsBatchedInSync;
|
private final AtomicLong numTransactionsBatchedInSync = new AtomicLong();
|
||||||
private long totalTimeTransactions; // total time for all transactions
|
private long totalTimeTransactions; // total time for all transactions
|
||||||
private NameNodeMetrics metrics;
|
private NameNodeMetrics metrics;
|
||||||
|
|
||||||
|
@ -673,7 +674,7 @@ protected void logSync(long mytxid) {
|
||||||
if (metrics != null) { // Metrics non-null only when used inside name node
|
if (metrics != null) { // Metrics non-null only when used inside name node
|
||||||
metrics.addSync(elapsed);
|
metrics.addSync(elapsed);
|
||||||
metrics.incrTransactionsBatchedInSync(editsBatchedInSync);
|
metrics.incrTransactionsBatchedInSync(editsBatchedInSync);
|
||||||
numTransactionsBatchedInSync += editsBatchedInSync;
|
numTransactionsBatchedInSync.addAndGet(editsBatchedInSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -713,7 +714,7 @@ private void printStatistics(boolean force) {
|
||||||
buf.append(" Total time for transactions(ms): ");
|
buf.append(" Total time for transactions(ms): ");
|
||||||
buf.append(totalTimeTransactions);
|
buf.append(totalTimeTransactions);
|
||||||
buf.append(" Number of transactions batched in Syncs: ");
|
buf.append(" Number of transactions batched in Syncs: ");
|
||||||
buf.append(numTransactionsBatchedInSync);
|
buf.append(numTransactionsBatchedInSync.get());
|
||||||
buf.append(" Number of syncs: ");
|
buf.append(" Number of syncs: ");
|
||||||
buf.append(editLogStream.getNumSync());
|
buf.append(editLogStream.getNumSync());
|
||||||
buf.append(" SyncTimes(ms): ");
|
buf.append(" SyncTimes(ms): ");
|
||||||
|
@ -1251,7 +1252,9 @@ synchronized void startLogSegment(final long segmentTxId,
|
||||||
"Cannot start log segment at txid %s when next expected " +
|
"Cannot start log segment at txid %s when next expected " +
|
||||||
"txid is %s", segmentTxId, txid + 1);
|
"txid is %s", segmentTxId, txid + 1);
|
||||||
|
|
||||||
numTransactions = totalTimeTransactions = numTransactionsBatchedInSync = 0;
|
numTransactions = 0;
|
||||||
|
totalTimeTransactions = 0;
|
||||||
|
numTransactionsBatchedInSync.set(0L);
|
||||||
|
|
||||||
// TODO no need to link this back to storage anymore!
|
// TODO no need to link this back to storage anymore!
|
||||||
// See HDFS-2174.
|
// See HDFS-2174.
|
||||||
|
|
Loading…
Reference in New Issue