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);
}
}
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());
}
}
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());
}
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);
}
}
Aggregations