devmadhuu commented on code in PR #8962:
URL: https://github.com/apache/ozone/pull/8962#discussion_r2299966706
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OMUpdateEventBuffer.java:
##########
@@ -43,41 +43,41 @@ public OMUpdateEventBuffer(int maxCapacity) {
}
/**
- * Add an event batch to the buffer.
+ * Add an event to the buffer.
*
- * @param eventBatch The event batch to buffer
+ * @param event The event to buffer
* @return true if successfully buffered, false if queue full
*/
- public boolean offer(OMUpdateEventBatch eventBatch) {
- boolean added = eventQueue.offer(eventBatch);
+ public boolean offer(ReconEvent event) {
+ boolean added = eventQueue.offer(event);
if (added) {
- totalBufferedEvents.addAndGet(eventBatch.getEvents().size());
- LOG.debug("Buffered event batch with {} events. Queue size: {}, Total
buffered events: {}",
- eventBatch.getEvents().size(), eventQueue.size(),
totalBufferedEvents.get());
+ totalBufferedEvents.addAndGet(event.getEventCount());
+ LOG.debug("Buffered event {} with {} events. Queue size: {}, Total
buffered events: {}",
Review Comment:
No, we are counting the size of events here in
`org.apache.hadoop.ozone.recon.tasks.OMUpdateEventBatch#getEventCount`
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java:
##########
@@ -672,21 +676,30 @@ public boolean syncDataFromOM() {
boolean tasksFailed = reconTaskController.hasDeltaTasksFailed();
if (bufferOverflowed || tasksFailed) {
- String reason = bufferOverflowed ? "Event buffer overflow" :
"Delta tasks failed after retry";
- LOG.warn("{}, triggering task reinitialization", reason);
+ ReconTaskReInitializationEvent.ReInitializationReason reason =
bufferOverflowed ?
+
ReconTaskReInitializationEvent.ReInitializationReason.BUFFER_OVERFLOW :
+
ReconTaskReInitializationEvent.ReInitializationReason.TASK_FAILURES;
+
+ LOG.warn("Detected condition for task reinitialization: {},
queueing async reinitialization event",
+ reason);
metrics.incrNumDeltaRequestsFailed();
deltaReconTaskStatusUpdater.setLastTaskRunStatus(-1);
deltaReconTaskStatusUpdater.recordRunCompletion();
- reconTaskController.reInitializeTasks(omMetadataManager, null);
-
- // Reset appropriate flags after reinitialization
- if (bufferOverflowed) {
- reconTaskController.resetEventBufferOverflowFlag();
- }
- if (tasksFailed) {
- reconTaskController.resetDeltaTasksFailureFlag();
+ // Queue async reinitialization event instead of blocking call
+ boolean queued =
reconTaskController.queueReInitializationEvent(reason);
Review Comment:
done.
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java:
##########
@@ -672,21 +676,30 @@ public boolean syncDataFromOM() {
boolean tasksFailed = reconTaskController.hasDeltaTasksFailed();
if (bufferOverflowed || tasksFailed) {
- String reason = bufferOverflowed ? "Event buffer overflow" :
"Delta tasks failed after retry";
- LOG.warn("{}, triggering task reinitialization", reason);
+ ReconTaskReInitializationEvent.ReInitializationReason reason =
bufferOverflowed ?
+
ReconTaskReInitializationEvent.ReInitializationReason.BUFFER_OVERFLOW :
+
ReconTaskReInitializationEvent.ReInitializationReason.TASK_FAILURES;
+
+ LOG.warn("Detected condition for task reinitialization: {},
queueing async reinitialization event",
+ reason);
metrics.incrNumDeltaRequestsFailed();
deltaReconTaskStatusUpdater.setLastTaskRunStatus(-1);
deltaReconTaskStatusUpdater.recordRunCompletion();
- reconTaskController.reInitializeTasks(omMetadataManager, null);
-
- // Reset appropriate flags after reinitialization
- if (bufferOverflowed) {
- reconTaskController.resetEventBufferOverflowFlag();
- }
- if (tasksFailed) {
- reconTaskController.resetDeltaTasksFailureFlag();
+ // Queue async reinitialization event instead of blocking call
+ boolean queued =
reconTaskController.queueReInitializationEvent(reason);
+ if (!queued) {
Review Comment:
done.
--
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]