Gargi-jais11 commented on PR #8915:
URL: https://github.com/apache/ozone/pull/8915#issuecomment-3318452185

   Here is an analysis of both the approaches to get container Size to **Push 
Replicator**.
   
   1. >  inject ContainerController or OzoneContainer class instance into 
GrpcContainerUploader
   
   - need to pass an instance of **ContainerController** to 
`GrpcContainerUploader`. Using which container size is determined and passed to 
`SendContainerOutputStream`.
   - In the first request containerSize is added to protobuf 
**SendContainerRequest**
   ```
   @Override
     protected void sendPart(boolean eof, int length, ByteString data) {
       SendContainerRequest.Builder requestBuilder = 
SendContainerRequest.newBuilder()
           .setContainerID(getContainerId())
           .setData(data)
           .setOffset(getWrittenBytes())
           .setCompression(compression.toProto());
       
       // Include container size in the first request
       if (getWrittenBytes() == 0 && size != null) {
         requestBuilder.setSize(size);
       }
       getStreamObserver().onNext(requestBuilder.build());
     }
     ```
   - Using which `SendContainerRequestHandler` can simply pass the 
containerSize during first request to **chooseNextVolume**
   ```
   // Use container size if available, otherwise fall back to default
           spaceToReserve = importer.getSpaceToReserve(
               req.hasSize() ? req.getSize() : null);
   
           volume = importer.chooseNextVolume(spaceToReserve);
   ```
   **Now considering Test analysis of this approach :-**
   It requires to only check for **TestSendContainerRequestHandler** that if 
different container size is passed than it properly allocates and releases 
space on the Target DN.


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