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

   ## What changes were proposed in this pull request?
   Release the reserved container space when a container leaves RECOVERING 
state, not only OPEN.
   
   ## Please describe your PR in detail:
   After HDDS-12810, creating a container reserves its full size on the volume. 
This also happens for RECOVERING containers created during EC reconstruction. 
But`ContainerData#setState` only releases the reservation when a container 
leaves OPEN, so a RECOVERING container keeps it after being closed, deleted or 
marked unhealthy. The space is only given back on datanode restart, so after 
many reconstructions a volume can reject new containers even though it is 
mostly empty.
   So what we changed is :
   - setState now releases the reservation when leaving OPEN or RECOVERING
   - commitSpace accepts the same states, so if a state change fails and rolls 
back to RECOVERING, the space is reserved  again.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/HDDS-17022
   
   ## How was this patch tested?
    - Added unit tests in TestKeyValueContainer to verify a RECOVERING 
container releases its reserved space when closed, deleted or marked unhealthy, 
and reserves it again if closing fails.
    
    - Also was able to repro in using docker compose with 6 datanodes, and 
tested with rs-3-2-1024k and 1 GB container
   size: wrote a key, closed its container and stopped one replica datanode to 
trigger EC reconstruction onto the spare datanode. After the rebuilt replica 
became CLOSED, verified ozone admin datanode usageinfo on the spare datanode 
showed:
   
   **Before Fix**
   
   > bash-5.1$ ozone admin datanode usageinfo --address=172.20.0.12
   > Usage Information (1 Datanodes)
   > 
   > ID                      : ac024fd6-5ed6-4ae2-ae98-cd637bd47740 
   > IP Address              : 172.20.0.12 
   > Hostname                : ozone-datanode-5.ozone_default 
   > Filesystem Capacity     : 485473984512 B (452.13 GB) 
   > Filesystem Used         : 57228976128 B (53.30 GB) 
   > Filesystem Used %       : 11.79% (Filesystem Used/Filesystem Capacity) 
   > Filesystem Available    : 428245008384 B (398.83 GB) 
   > Filesystem Available %  : 88.21% (Filesystem Available/Filesystem 
Capacity) 
   > Ozone Capacity          : 485425437116 B (452.09 GB) 
   > Ozone Used              : 8577024 B (8.18 MB) 
   > Ozone Used %            : 0.00% (Ozone Used/Ozone Capacity) 
   > Ozone Available         : 428245008384 B (398.83 GB) 
   > Ozone Available %       : 88.22% (Ozone Available/Ozone capacity) 
   > Pipeline(s)             : 2 
   > Container(s)            : 1 
   > **Container Pre-allocated : 1069547520 B (1020 MB)** 
   > Remaining Allocatable   : 427175460864 B (397.84 GB) 
   > Free Space To Spare     : 104857600 B (100 MB) 
   > Reserved                : 48547396 B (46.30 MB) 
   
   - **here Container Pre-allocation shows - 1069547520 B and only after 
datanode restart it become 0** 
   
   > bash-5.1$ ozone admin datanode usageinfo 
--uuid=ac024fd6-5ed6-4ae2-ae98-cd637bd47740
   > Usage Information (1 Datanodes)
   > 
   > ID                      : ac024fd6-5ed6-4ae2-ae98-cd637bd47740 
   > IP Address              : 172.20.0.3 
   > Hostname                : ozone-datanode-5.ozone_default 
   > Filesystem Capacity     : 485473984512 B (452.13 GB) 
   > Filesystem Used         : 56885751808 B (52.98 GB) 
   > Filesystem Used %       : 11.72% (Filesystem Used/Filesystem Capacity) 
   > Filesystem Available    : 428588232704 B (399.15 GB) 
   > Filesystem Available %  : 88.28% (Filesystem Available/Filesystem 
Capacity) 
   > Ozone Capacity          : 485425437116 B (452.09 GB) 
   > Ozone Used              : 8785920 B (8.38 MB) 
   > Ozone Used %            : 0.00% (Ozone Used/Ozone Capacity) 
   > Ozone Available         : 428588232704 B (399.15 GB) 
   > Ozone Available %       : 88.29% (Ozone Available/Ozone capacity) 
   > Pipeline(s)             : 2 
   > Container(s)            : 1 
   > **Container Pre-allocated : 0 B (0 B)** 
   > Remaining Allocatable   : 428588232704 B (399.15 GB) 
   > Free Space To Spare     : 104857600 B (100 MB) 
   > Reserved                : 48547396 B (46.30 MB) 
   
   **After Fix:** 
   **We find Container Pre-allocated : 0 B (0 B) as below and dn restart not 
needed.**
   
   > bash-5.1$ ozone admin datanode usageinfo --address=172.20.0.11
   > Usage Information (1 Datanodes)
   > 
   > ID                      : 0f72b7fd-6ea8-45ad-9911-2471730d589a 
   > IP Address              : 172.20.0.11 
   > Hostname                : ozone-datanode-3.ozone_default 
   > Filesystem Capacity     : 485473984512 B (452.13 GB) 
   > Filesystem Used         : 57163980800 B (53.24 GB) 
   > Filesystem Used %       : 11.77% (Filesystem Used/Filesystem Capacity) 
   > Filesystem Available    : 428310003712 B (398.89 GB) 
   > Filesystem Available %  : 88.23% (Filesystem Available/Filesystem 
Capacity) 
   > Ozone Capacity          : 485425437116 B (452.09 GB) 
   > Ozone Used              : 7528448 B (7.18 MB) 
   > Ozone Used %            : 0.00% (Ozone Used/Ozone Capacity) 
   > Ozone Available         : 428310003712 B (398.89 GB) 
   > Ozone Available %       : 88.23% (Ozone Available/Ozone capacity) 
   > Pipeline(s)             : 2 
   > Container(s)            : 1 
   > **Container Pre-allocated : 0 B (0 B)** 
   > Remaining Allocatable   : 428310003712 B (398.89 GB) 
   > Free Space To Spare     : 104857600 B (100 MB) 
   > Reserved                : 48547396 B (46.30 MB) 
   
   Successful CI BUILD: TBD


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