Search in sources :

Example 16 with ReconTaskStatus

use of org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus in project ozone by apache.

the class ReconTaskControllerImpl method reInitializeTasks.

@Override
public synchronized void reInitializeTasks(ReconOMMetadataManager omMetadataManager) throws InterruptedException {
    try {
        Collection<Callable<Pair<String, Boolean>>> tasks = new ArrayList<>();
        for (Map.Entry<String, ReconOmTask> taskEntry : reconOmTasks.entrySet()) {
            ReconOmTask task = taskEntry.getValue();
            tasks.add(() -> task.reprocess(omMetadataManager));
        }
        List<Future<Pair<String, Boolean>>> results = executorService.invokeAll(tasks);
        for (Future<Pair<String, Boolean>> f : results) {
            String taskName = f.get().getLeft();
            if (!f.get().getRight()) {
                LOG.info("Init failed for task {}.", taskName);
            } else {
                // store the timestamp for the task
                ReconTaskStatus reconTaskStatusRecord = new ReconTaskStatus(taskName, System.currentTimeMillis(), omMetadataManager.getLastSequenceNumberFromDB());
                reconTaskStatusDao.update(reconTaskStatusRecord);
            }
        }
    } catch (ExecutionException e) {
        LOG.error("Unexpected error : ", e);
    }
}
Also used : ArrayList(java.util.ArrayList) Callable(java.util.concurrent.Callable) Future(java.util.concurrent.Future) ExecutionException(java.util.concurrent.ExecutionException) HashMap(java.util.HashMap) Map(java.util.Map) ReconTaskStatus(org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus) Pair(org.apache.commons.lang3.tuple.Pair)

Example 17 with ReconTaskStatus

use of org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus in project ozone by apache.

the class OzoneManagerServiceProviderImpl method registerOMDBTasks.

public void registerOMDBTasks() {
    ReconTaskStatus reconTaskStatusRecord = new ReconTaskStatus(OmSnapshotTaskName.OmDeltaRequest.name(), System.currentTimeMillis(), getCurrentOMDBSequenceNumber());
    if (!reconTaskStatusDao.existsById(OmSnapshotTaskName.OmDeltaRequest.name())) {
        reconTaskStatusDao.insert(reconTaskStatusRecord);
        LOG.info("Registered {} task ", OmSnapshotTaskName.OmDeltaRequest.name());
    }
    reconTaskStatusRecord = new ReconTaskStatus(OmSnapshotTaskName.OmSnapshotRequest.name(), System.currentTimeMillis(), getCurrentOMDBSequenceNumber());
    if (!reconTaskStatusDao.existsById(OmSnapshotTaskName.OmSnapshotRequest.name())) {
        reconTaskStatusDao.insert(reconTaskStatusRecord);
        LOG.info("Registered {} task ", OmSnapshotTaskName.OmSnapshotRequest.name());
    }
}
Also used : ReconTaskStatus(org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus)

Example 18 with ReconTaskStatus

use of org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus in project ozone by apache.

the class TestSqlSchemaSetup method testSchemaSetup.

/**
 * Make sure schema was created correctly.
 * @throws SQLException
 */
@Test
public void testSchemaSetup() throws SQLException {
    assertNotNull(getInjector());
    assertNotNull(getConfiguration());
    assertNotNull(getDslContext());
    assertNotNull(getConnection());
    RECON_DAO_LIST.forEach(dao -> {
        assertNotNull(getDao(dao));
    });
    ReconTaskStatusDao dao = getDao(ReconTaskStatusDao.class);
    dao.insert(new ReconTaskStatus("TestTask", 1L, 2L));
    assertEquals(1, dao.findAll().size());
}
Also used : ReconTaskStatusDao(org.hadoop.ozone.recon.schema.tables.daos.ReconTaskStatusDao) ReconTaskStatus(org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus) Test(org.junit.Test)

Example 19 with ReconTaskStatus

use of org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus in project ozone by apache.

the class ReconScmTask method register.

private void register() {
    String taskName = getTaskName();
    if (!reconTaskStatusDao.existsById(taskName)) {
        ReconTaskStatus reconTaskStatusRecord = new ReconTaskStatus(taskName, 0L, 0L);
        reconTaskStatusDao.insert(reconTaskStatusRecord);
        LOG.info("Registered {} task ", taskName);
    }
}
Also used : ReconTaskStatus(org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus)

Aggregations

ReconTaskStatus (org.hadoop.ozone.recon.schema.tables.pojos.ReconTaskStatus)19 Test (org.junit.Test)12 ReconTaskStatusDao (org.hadoop.ozone.recon.schema.tables.daos.ReconTaskStatusDao)11 AbstractReconSqlDBTest (org.apache.hadoop.ozone.recon.persistence.AbstractReconSqlDBTest)7 ReconOMMetadataManager (org.apache.hadoop.ozone.recon.recovery.ReconOMMetadataManager)6 OMMetadataManager (org.apache.hadoop.ozone.om.OMMetadataManager)4 ArrayList (java.util.ArrayList)2 ContainerInfo (org.apache.hadoop.hdds.scm.container.ContainerInfo)2 ContainerManager (org.apache.hadoop.hdds.scm.container.ContainerManager)2 ContainerWithPipeline (org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline)2 ReconUtils (org.apache.hadoop.ozone.recon.ReconUtils)2 OzoneManagerSyncMetrics (org.apache.hadoop.ozone.recon.metrics.OzoneManagerSyncMetrics)2 ContainerHealthSchemaManager (org.apache.hadoop.ozone.recon.persistence.ContainerHealthSchemaManager)2 ReconStorageContainerManagerFacade (org.apache.hadoop.ozone.recon.scm.ReconStorageContainerManagerFacade)2 StorageContainerServiceProvider (org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider)2 OMUpdateEventBatch (org.apache.hadoop.ozone.recon.tasks.OMUpdateEventBatch)2 ReconTaskConfig (org.apache.hadoop.ozone.recon.tasks.ReconTaskConfig)2 ReconTaskController (org.apache.hadoop.ozone.recon.tasks.ReconTaskController)2 ContainerSchemaDefinition (org.hadoop.ozone.recon.schema.ContainerSchemaDefinition)2 UnhealthyContainersDao (org.hadoop.ozone.recon.schema.tables.daos.UnhealthyContainersDao)2