siddhantsangwan commented on code in PR #8492:
URL: https://github.com/apache/ozone/pull/8492#discussion_r2099363486


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/HddsDispatcher.java:
##########
@@ -435,6 +451,37 @@ && getMissingContainerSet().contains(containerID)) {
     }
   }
 
+  /**
+   * If the volume is full, we need to inform SCM about the latest volume 
usage stats and send the close container
+   * action for this container immediately. {@link 
HddsDispatcher#sendCloseContainerActionIfNeeded(Container, boolean)}
+   * just adds the action to the heartbeat. Here, we get the latest storage 
statistics for this node, add them to the
+   * heartbeat, and then send the heartbeat (including container close action) 
immediately.
+   * @param volume the volume being written to
+   */
+  private void handleFullVolume(HddsVolume volume) throws 
StorageContainerException {
+    long current = System.currentTimeMillis();
+    long last = fullVolumeLastHeartbeatTriggerMs.get();
+    boolean isFirstTrigger = last == -1;
+    boolean allowedToTrigger = (current - 
fullVolumeHeartbeatThrottleIntervalMs) >= last;
+    if (isFirstTrigger || allowedToTrigger) {
+      if (fullVolumeLastHeartbeatTriggerMs.compareAndSet(last, current)) {
+        StorageContainerDatanodeProtocolProtos.NodeReportProto nodeReport;
+        try {
+          nodeReport = context.getParent().getContainer().getNodeReport();
+          context.refreshFullReport(nodeReport);
+          context.getParent().triggerHeartbeat();
+          LOG.info("Triggering heartbeat for full volume {}, with node report: 
{}.", volume, nodeReport);

Review Comment:
   This is on the write path, so we must be extra careful about performance. An 
info log will reduce performance, but I wonder if it's ok in this case because 
this won't happen often? What do others think?



-- 
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: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to