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

   ## What changes were proposed in this pull request?
   
   This PR is adding more snapshot metrics in `OMMetrics` to keep track of the 
count of each snapshot status. 
   Right now there is no implementation for snapshot delete or reclaim and 
therefore these metrics are not getting a value anywhere in the code. 
   
   We are going over the snapshot table on OM `start()`, `restart()` and 
`reloadOMState()` and get a count for every snapshot status. Also we are 
incrementing the number of active snapshots during every create request. In the 
future we might want to decrement the number of active when incrementing the 
number of delete and similarly decrement number of delete when incrementing 
number of reclaimed.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-7506
   
   ## How was this patch tested?
   
   A new test was added in `TestOmMetrics` under `integration-test` package. 
Also we might want to expand this test method in the future as more snapshot 
features are made available.
   
   This patch was also tested manually in a docker cluster like so
   
   create a snapshot
   ```
   ❯ docker-compose up --scale datanode=3 -d
   Creating network "ozone_default" with the default driver
   Creating ozone_recon_1    ... done
   Creating ozone_om_1       ... done
   Creating ozone_s3g_1      ... done
   Creating ozone_scm_1      ... done
   Creating ozone_datanode_1 ... done
   Creating ozone_datanode_2 ... done
   Creating ozone_datanode_3 ... done
   
   ❯ docker exec -it ozone_om_1 bash
   bash-4.2$ ozone sh volume create /vol1
   bash-4.2$ ozone sh bucket create /vol1/bucket1 
   bash-4.2$ ozone sh key put /vol1/bucket1/key1 README.md
   bash-4.2$ ozone sh snapshot create /vol1/bucket1 snap1
   ```
   on `0.0.0.0:9874/jmx`
   ```
       "NumSnapshotActive" : 1,
       "NumSnapshotCreateFails" : 0,
       "NumSnapshotCreates" : 1,
   ```
   
   create another snapshot
   ```
   bash-4.2$ ozone sh key put /vol1/bucket1/key2 /etc/hosts
   bash-4.2$ ozone sh snapshot create /vol1/bucket1 snap2
   bash-4.2$ exit
   exit
   ```
   
   check `0.0.0.0:9874/jmx` again
   ```
       "NumSnapshotActive" : 2,
       "NumSnapshotCreateFails" : 0,
       "NumSnapshotCreates" : 2,
   ```
   
   restart the OM
   ```
   ❯ docker restart ozone_om_1 
   ozone_om_1
   ```
   
   after a minute, on `0.0.0.0:9874/jmx`
   ```
       "NumSnapshotActive" : 2,
       "NumSnapshotCreateFails" : 0,
       "NumSnapshotCreates" : 0,
   ```
   
   


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