ArafatKhan2198 commented on code in PR #9436:
URL: https://github.com/apache/ozone/pull/9436#discussion_r2593073699
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/updater/ReconTaskStatusUpdaterManager.java:
##########
@@ -17,39 +17,115 @@
package org.apache.hadoop.ozone.recon.tasks.updater;
+import static org.jooq.impl.DSL.name;
+
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.ozone.recon.schema.generated.tables.daos.ReconTaskStatusDao;
import org.apache.ozone.recon.schema.generated.tables.pojos.ReconTaskStatus;
+import org.jooq.DSLContext;
+import org.jooq.impl.DSL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* This class provides caching for ReconTaskStatusUpdater instances.
* For each task we maintain a map of updater instance and provide it to
consumers
* to update.
* Here we also make a single call to the TASK_STATUS_TABLE to check if
previous values are present
- * for a task in the DB to avoid overwrite to initial state
+ * for a task in the DB to avoid overwrite to initial state.
+ *
+ * Note: The initialization is lazy to avoid reading the database during Guice
dependency injection,
+ * which would fail during upgrades when schema changes haven't been applied
yet.
*/
@Singleton
public class ReconTaskStatusUpdaterManager {
+ private static final Logger LOG =
LoggerFactory.getLogger(ReconTaskStatusUpdaterManager.class);
+ private static final String RECON_TASK_STATUS_TABLE_NAME =
"RECON_TASK_STATUS";
+
private final ReconTaskStatusDao reconTaskStatusDao;
- // Act as a cache for the task updater instancesF
+ // Act as a cache for the task updater instances
private final Map<String, ReconTaskStatusUpdater> updaterCache;
+ private volatile boolean initialized = false;
Review Comment:
Thanks for the catch
Will make the change!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]