Search in sources :

Example 1 with ReconNamespaceSummaryManager

use of org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager in project ozone by apache.

the class TestReconWithOzoneManagerFSO method testNamespaceSummaryAPI.

@Test
public void testNamespaceSummaryAPI() throws Exception {
    // add a vol, bucket and key
    addKeys(0, 10, "dir");
    OzoneManagerServiceProviderImpl impl = (OzoneManagerServiceProviderImpl) cluster.getReconServer().getOzoneManagerServiceProvider();
    impl.syncDataFromOM();
    ReconNamespaceSummaryManager namespaceSummaryManager = cluster.getReconServer().getReconNamespaceSummaryManager();
    ReconOMMetadataManager omMetadataManagerInstance = (ReconOMMetadataManager) cluster.getReconServer().getOzoneManagerServiceProvider().getOMMetadataManagerInstance();
    OzoneStorageContainerManager reconSCM = cluster.getReconServer().getReconStorageContainerManager();
    NSSummaryEndpoint endpoint = new NSSummaryEndpoint(namespaceSummaryManager, omMetadataManagerInstance, reconSCM);
    Response basicInfo = endpoint.getBasicInfo("/vol1/bucket1/dir1");
    NamespaceSummaryResponse entity = (NamespaceSummaryResponse) basicInfo.getEntity();
    Assert.assertSame(entity.getEntityType(), EntityType.DIRECTORY);
    Assert.assertEquals(1, entity.getNumTotalKey());
    Assert.assertEquals(0, entity.getNumTotalDir());
    for (int i = 0; i < 10; i++) {
        Assert.assertNotNull(impl.getOMMetadataManagerInstance().getVolumeTable().get("/vol" + i));
    }
    addKeys(10, 12, "dir");
    impl.syncDataFromOM();
    // test Recon is sync'ed with OM.
    for (int i = 10; i < 12; i++) {
        Assert.assertNotNull(impl.getOMMetadataManagerInstance().getVolumeTable().getSkipCache("/vol" + i));
    }
    // test root response
    Response rootBasicRes = endpoint.getBasicInfo("/");
    NamespaceSummaryResponse rootBasicEntity = (NamespaceSummaryResponse) rootBasicRes.getEntity();
    Assert.assertSame(EntityType.ROOT, rootBasicEntity.getEntityType());
    // one additional dummy volume at creation
    Assert.assertEquals(13, rootBasicEntity.getNumVolume());
    Assert.assertEquals(12, rootBasicEntity.getNumBucket());
    Assert.assertEquals(12, rootBasicEntity.getNumTotalDir());
    Assert.assertEquals(12, rootBasicEntity.getNumTotalKey());
}
Also used : NamespaceSummaryResponse(org.apache.hadoop.ozone.recon.api.types.NamespaceSummaryResponse) Response(javax.ws.rs.core.Response) NSSummaryEndpoint(org.apache.hadoop.ozone.recon.api.NSSummaryEndpoint) ReconNamespaceSummaryManager(org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager) OzoneManagerServiceProviderImpl(org.apache.hadoop.ozone.recon.spi.impl.OzoneManagerServiceProviderImpl) ReconOMMetadataManager(org.apache.hadoop.ozone.recon.recovery.ReconOMMetadataManager) OzoneStorageContainerManager(org.apache.hadoop.hdds.scm.server.OzoneStorageContainerManager) NSSummaryEndpoint(org.apache.hadoop.ozone.recon.api.NSSummaryEndpoint) NamespaceSummaryResponse(org.apache.hadoop.ozone.recon.api.types.NamespaceSummaryResponse) Test(org.junit.Test)

Example 2 with ReconNamespaceSummaryManager

use of org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager in project ozone by apache.

the class TestNSSummaryTask method setUp.

@Before
public void setUp() throws Exception {
    omMetadataManager = initializeNewOmMetadataManager(temporaryFolder.newFolder());
    ozoneManagerServiceProvider = getMockOzoneManagerServiceProviderWithFSO();
    reconOMMetadataManager = getTestReconOmMetadataManager(omMetadataManager, temporaryFolder.newFolder());
    ReconTestInjector reconTestInjector = new ReconTestInjector.Builder(temporaryFolder).withReconOm(reconOMMetadataManager).withOmServiceProvider(ozoneManagerServiceProvider).withReconSqlDb().withContainerDB().build();
    reconNamespaceSummaryManager = reconTestInjector.getInstance(ReconNamespaceSummaryManager.class);
}
Also used : ReconNamespaceSummaryManager(org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager) ReconTestInjector(org.apache.hadoop.ozone.recon.ReconTestInjector) Before(org.junit.Before)

Example 3 with ReconNamespaceSummaryManager

use of org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager in project ozone by apache.

the class TestNSSummaryEndpoint method setUp.

@Before
public void setUp() throws Exception {
    omMetadataManager = initializeNewOmMetadataManager(temporaryFolder.newFolder());
    ozoneManagerServiceProvider = getMockOzoneManagerServiceProviderWithFSO();
    reconOMMetadataManager = getTestReconOmMetadataManager(omMetadataManager, temporaryFolder.newFolder());
    ReconTestInjector reconTestInjector = new ReconTestInjector.Builder(temporaryFolder).withReconOm(reconOMMetadataManager).withOmServiceProvider(ozoneManagerServiceProvider).withReconSqlDb().withContainerDB().addBinding(OzoneStorageContainerManager.class, getMockReconSCM()).addBinding(StorageContainerServiceProvider.class, mock(StorageContainerServiceProviderImpl.class)).addBinding(NSSummaryEndpoint.class).build();
    reconNamespaceSummaryManager = reconTestInjector.getInstance(ReconNamespaceSummaryManager.class);
    nsSummaryEndpoint = reconTestInjector.getInstance(NSSummaryEndpoint.class);
    // populate OM DB and reprocess into Recon RocksDB
    populateOMDB();
    NSSummaryTask nsSummaryTask = new NSSummaryTask(reconNamespaceSummaryManager);
    nsSummaryTask.reprocess(reconOMMetadataManager);
}
Also used : StorageContainerServiceProviderImpl(org.apache.hadoop.ozone.recon.spi.impl.StorageContainerServiceProviderImpl) NSSummaryTask(org.apache.hadoop.ozone.recon.tasks.NSSummaryTask) ReconNamespaceSummaryManager(org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager) ReconTestInjector(org.apache.hadoop.ozone.recon.ReconTestInjector) OzoneStorageContainerManager(org.apache.hadoop.hdds.scm.server.OzoneStorageContainerManager) Before(org.junit.Before)

Aggregations

ReconNamespaceSummaryManager (org.apache.hadoop.ozone.recon.spi.ReconNamespaceSummaryManager)3 OzoneStorageContainerManager (org.apache.hadoop.hdds.scm.server.OzoneStorageContainerManager)2 ReconTestInjector (org.apache.hadoop.ozone.recon.ReconTestInjector)2 Before (org.junit.Before)2 Response (javax.ws.rs.core.Response)1 NSSummaryEndpoint (org.apache.hadoop.ozone.recon.api.NSSummaryEndpoint)1 NamespaceSummaryResponse (org.apache.hadoop.ozone.recon.api.types.NamespaceSummaryResponse)1 ReconOMMetadataManager (org.apache.hadoop.ozone.recon.recovery.ReconOMMetadataManager)1 OzoneManagerServiceProviderImpl (org.apache.hadoop.ozone.recon.spi.impl.OzoneManagerServiceProviderImpl)1 StorageContainerServiceProviderImpl (org.apache.hadoop.ozone.recon.spi.impl.StorageContainerServiceProviderImpl)1 NSSummaryTask (org.apache.hadoop.ozone.recon.tasks.NSSummaryTask)1 Test (org.junit.Test)1