Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,12 @@ public class OmMetadataManagerImpl implements OMMetadataManager,
*/
public OmMetadataManagerImpl(OzoneConfiguration conf,
OzoneManager ozoneManager) throws IOException {
this(conf, ozoneManager, null);
}

public OmMetadataManagerImpl(OzoneConfiguration conf,
OzoneManager ozoneManager,
OMPerformanceMetrics perfMetrics)
throws IOException {
this.ozoneManager = ozoneManager;
this.perfMetrics = perfMetrics;
if (this.ozoneManager == null) {
this.perfMetrics = null;
} else {
this.perfMetrics = this.ozoneManager.getPerfMetrics();
}
Comment on lines +344 to +348
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: reduce verbosity

Suggested change
if (this.ozoneManager == null) {
this.perfMetrics = null;
} else {
this.perfMetrics = this.ozoneManager.getPerfMetrics();
}
perfMetrics = ozoneManager != null ? ozoneManager.getPerfMetrics() : null;

this.lock = new OzoneManagerLock(conf);
this.omEpoch = OmUtils.getOMEpoch();
// For test purpose only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.mockito.Mockito.when;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.om.OMPerformanceMetrics;
import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.response.OMClientResponse;
Expand Down Expand Up @@ -60,8 +61,12 @@ public void setUp() throws Exception {
final OzoneConfiguration conf = new OzoneConfiguration();
conf.set(OMConfigKeys.OZONE_OM_DB_DIRS,
folder.toAbsolutePath().toString());
OmMetadataManagerImpl omMetadataManager = new OmMetadataManagerImpl(conf,
ozoneManager);
when(ozoneManager.getMetadataManager())
.thenReturn(new OmMetadataManagerImpl(conf, ozoneManager));
.thenReturn(omMetadataManager);
OMPerformanceMetrics omPerformanceMetrics = mock(OMPerformanceMetrics.class);
when(ozoneManager.getPerfMetrics()).thenReturn(omPerformanceMetrics);
}

@AfterEach
Expand Down
Loading