devmadhuu opened a new pull request, #12178:
URL: https://github.com/apache/ozone/pull/12178

   ## What changes were proposed in this pull request?
   
   Since HDDS-16653, the Container Balancer moves containers separately for 
each storage type (SSD, DISK, ARCHIVE).
   But `ozone admin containerbalancer status` and the balancer metrics still 
show only one total for all types.
   An administrator cannot see which storage type was moved, failed or timed 
out.
   
   This PR reports the results of every iteration separately for each storage 
type. The existing overall values
   and metric names do not change.
   
   ### Example
   
   A cluster has two datanodes, `dn-1` (over-used) and `dn-2` (under-used). In 
one iteration the balancer moves:
   - an SSD container of 2 GB from `dn-1` to `dn-2`. It completes.
   - a DISK container of 4 GB from `dn-1` to `dn-2`. It times out.
   
   Before this PR, `status --verbose` showed only the totals:
   
   ```
   Size scheduled to move                             6 GB
   Moved data size                                    2 GB
   Scheduled to move containers                       2
   Already moved containers                           1
   Failed to move containers by timeout               1
   ```
   
   An administrator could not tell that the timed-out move was a DISK move. 
With this PR, the same output also
   has one section for each storage type:
   
   ```
   Storage type: SSD
     Size scheduled to move                           2 GB
     Moved data size                                  2 GB
     Scheduled to move containers                     1
     Already moved containers                         1
     Failed to move containers by timeout             0
     Unique datanodes involved                        2
     Entered data to nodes
       dn-2 <- 2 GB
     Exited data from nodes
      dn-1 -> 2 GB
   Storage type: DISK
     Size scheduled to move                           4 GB
     Moved data size                                  0 B
     Scheduled to move containers                     1
     Already moved containers                         0
     Failed to move containers by timeout             1
     Unique datanodes involved                        2
     ...
   ```
   
   The same numbers are available as metrics with a `storagetype` label, for 
example
   
`container_balancer_storage_type_metrics_num_container_moves_completed_in_latest_iteration{storagetype="SSD"}
 1`.
   Each series has a value for the latest iteration and a running total across 
iterations.
   
   ### How it works
   
   1. When an iteration starts, every storage type gets a new "generation" 
number and its latest values are reset.
   2. When the balancer schedules a move, the move remembers its storage type 
and the generation. Scheduled
      containers and bytes are counted under that type.
   3. When the move finishes (completed, failed or timed out), the result is 
added to the type that scheduled
      it, even if the balancer is already working on another type. This is the 
case of an SSD move that finishes
      while DISK has its turn.
   4. When the iteration ends, its numbers are copied into the iteration 
status, so history does not change
      when the next iteration resets the counters, and they are added to the 
running totals.
   
   **Two rules keep the numbers correct:**
   
   - A move is counted once. A move that timed out is not counted again as 
completed.
   - A result that arrives after its iteration has ended is not counted. This 
can happen when the iteration is
     interrupted. Without this rule, a late result of iteration 1 would change 
the numbers of iteration 2. The
     same rule now applies to the overall counters and the failure breakdown.
   
   The overall counters and the new per-type counters use the same 
`Outcome.of(MoveResult)` rule to decide if a
   result is completed, timed out or failed, so per-type counts add up to the 
overall counts. The only exception is
   datanodes: the overall "involved" count counts each datanode once, and a 
datanode can appear in several
   storage types, so per-type counts can add up to more than the overall count.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17590
   
   ## How was this patch tested?
   
   - New unit tests:
     - `TestContainerBalancerStorageTypeMetrics` (32): counts per type, results 
of an earlier or finished
       iteration are dropped, a move is counted once, totals add up over 
iterations, the `StorageType` label,
       UNKNOWN, and every `MoveResult` counts the same way in the overall and 
the per-type counters.
     - `TestContainerBalancerTask`: an SSD result that arrives during the DISK 
turn is counted under SSD, for
       both success and failure. A timed-out move is not counted again when it 
completes. A move of iteration 1
       that completes during iteration 2 does not change iteration 2. A move 
that completes after its iteration
       was interrupted is not counted. The per-type counts add up to the 
overall counts.
     - `TestContainerBalancerStatusInfo`: per-type status matches the overall 
status and is part of the proto.
     - `TestContainerBalancerSubCommand`: per-type output in the last iteration 
and in the history, and no
       "Storage type:" output for an old response.


-- 
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]

Reply via email to