Skip to content

Commit 06211e7

Browse files
committed
Fix bugs.
Change-Id: Iedb11b51244968ff4f7c147301af266f926759e4
1 parent 663bc23 commit 06211e7

5 files changed

Lines changed: 9 additions & 11 deletions

File tree

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public SCMStateMachine(final StorageContainerManager scm,
9696
this.scm = scm;
9797
this.handlers = new EnumMap<>(RequestType.class);
9898
this.transactionBuffer = buffer;
99-
this.metrics = StorageContainerManager.getMetrics();
99+
this.metrics = scm.getMetrics();
100100
TransactionInfo latestTrxInfo = this.transactionBuffer.getLatestTrxInfo();
101101
if (!latestTrxInfo.isDefault()) {
102102
updateLastAppliedTermIndex(latestTrxInfo.getTerm(),

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes.IO_EXCEPTION;
2626
import static org.apache.hadoop.hdds.scm.net.NetConstants.NODE_COST_DEFAULT;
2727
import static org.apache.hadoop.hdds.scm.net.NetConstants.ROOT;
28-
import static org.apache.hadoop.hdds.scm.server.StorageContainerManager.getPerfMetrics;
2928
import static org.apache.hadoop.hdds.scm.server.StorageContainerManager.startRpcServer;
3029
import static org.apache.hadoop.hdds.server.ServerUtils.getRemoteUserName;
3130
import static org.apache.hadoop.hdds.server.ServerUtils.updateRPCListenAddress;
@@ -108,7 +107,7 @@ public class SCMBlockProtocolServer implements
108107
public SCMBlockProtocolServer(OzoneConfiguration conf,
109108
StorageContainerManager scm) throws IOException {
110109
this.scm = scm;
111-
this.perfMetrics = getPerfMetrics();
110+
this.perfMetrics = scm.getPerfMetrics();
112111
final int handlerCount = conf.getInt(OZONE_SCM_BLOCK_HANDLER_COUNT_KEY,
113112
OZONE_SCM_HANDLER_COUNT_KEY, OZONE_SCM_HANDLER_COUNT_DEFAULT,
114113
LOG::info);

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
224224
/**
225225
* SCM metrics.
226226
*/
227-
private static SCMMetrics metrics;
228-
private static SCMPerformanceMetrics perfMetrics;
227+
private SCMMetrics metrics;
228+
private SCMPerformanceMetrics perfMetrics;
229229
private SCMHAMetrics scmHAMetrics;
230230
private final NettyMetrics nettyMetrics;
231231

@@ -1427,21 +1427,21 @@ public void initMetrics() {
14271427
/**
14281428
* Return SCM metrics instance.
14291429
*/
1430-
public static SCMMetrics getMetrics() {
1430+
public SCMMetrics getMetrics() {
14311431
return metrics;
14321432
}
14331433

14341434
/**
14351435
* Initialize SCMPerformance metrics.
14361436
*/
1437-
public static void initPerfMetrics() {
1437+
public void initPerfMetrics() {
14381438
perfMetrics = SCMPerformanceMetrics.create();
14391439
}
14401440

14411441
/**
14421442
* Return SCMPerformance metrics instance.
14431443
*/
1444-
public static SCMPerformanceMetrics getPerfMetrics() {
1444+
public SCMPerformanceMetrics getPerfMetrics() {
14451445
return perfMetrics == null ? SCMPerformanceMetrics.create() : perfMetrics;
14461446
}
14471447

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMDbCheckpointServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void init() throws Exception {
8787
.build();
8888
cluster.waitForClusterToBeReady();
8989
StorageContainerManager scm = cluster.getStorageContainerManager();
90-
scmMetrics = StorageContainerManager.getMetrics();
90+
scmMetrics = scm.getMetrics();
9191

9292
requestMock = mock(HttpServletRequest.class);
9393
when(requestMock.getParameter(OZONE_DB_CHECKPOINT_REQUEST_FLUSH))

hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDiffManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ public class TestSnapshotDiffManager {
188188
private final List<String> snapshotNames = new ArrayList<>();
189189
private final List<SnapshotInfo> snapshotInfoList = new ArrayList<>();
190190
private final List<SnapshotDiffJob> snapDiffJobs = new ArrayList<>();
191-
private OMMetrics omMetrics;
192191
@TempDir
193192
private File dbDir;
194193
@Mock
@@ -230,7 +229,7 @@ public void init() throws RocksDBException, IOException, ExecutionException {
230229
ExitUtil.disableSystemExit();
231230

232231
OzoneConfiguration conf = new OzoneConfiguration();
233-
omMetrics = OMMetrics.create(conf);
232+
OMMetrics omMetrics = OMMetrics.create(conf);
234233

235234
dbOptions = new ManagedDBOptions();
236235
dbOptions.setCreateIfMissing(true);

0 commit comments

Comments
 (0)