elek commented on pull request #1208:
URL: https://github.com/apache/hadoop-ozone/pull/1208#issuecomment-680882568
Thanks for the help from @maobaolong , it's ready to review.
The key points of the patch:
1. o3fs/ofs are not changed just ozone sh.
Instead of:
```
ozone sh key put -r THREE -t RATIS ....
```
you can use:
```
ozone sh key put --storage-class STANDARD ...
```
2. Storage classes are hard coded in this version (see
`StaticStorageClassRegistry.java`). There is no way to configure or introduce
new one.
3. Should be backward compatible. If storage class is not used but the old
factory/type is sent from the client, it's converted to storage class:
```
+ String storageClass = null;
+ if (info.hasStorageClass()) {
+ storageClass = info.getStorageClass();
+ }
+ if (StringUtils.isBlank(storageClass)) {
+ storageClass = StorageClassConverter.convert(
+ null, info.getReplicationFactor(),
+ info.getReplicationType()).getName();
+ }
```
4. But under the hood, the storage class abstraction is used.
5. SCM allocates block as before (`BlockManagerImpl.java`)
```
+ final ReplicationFactor factor =
+ storageClass.getOpenStateConfiguration().getReplicationFactor();
+
+ final ReplicationType type =
+ storageClass.getOpenStateConfiguration().getReplicationType();
```
Remaining logic is the same.
6. `ReplicationManager` works as before, but the expected number of the
replicas are got from the storage class:
```
+ StorageClass storageClass =
+ storageClassRegistry.getStorageClass(container.getStorageClass());
```
7. `ContainerStateManager` is slightly modified. Until containers are sorted
by "owner" now they are sorted by "owner" and "storageClass". Logic is the
same. If there is a container with the same owner and storageClass it can be
returned.
8. `storageClasss` is stored and send as string (make it possible to use ANY
storage class in the future), but inside the services type-safe objects are
used.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]