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

   > For EC Reconstruction I don't think it exports the entire container like 
this. More it reads the blocks out of the container block by block using the 
normal read path through the datanode.
   
   @sodonnel  My bad I got diverted while exploring. You are correct for 
ECReconstruction, it  reads chunk by chunk per block, over gRPC, using GetBlock 
+ ReadChunk RPCs. The data flows from the source DN's normal read handler 
**(HddsDispatcher → KeyValueHandler.handleReadChunk)** which does a read lock 
per chunk, not a write lock.
   
   > So the question is - can the normal read path be impacted by the balancer 
moving a container from disk 1 to disk 2? 
   
   - DiskBalancer holds readLock during the copy. A concurrent **ReadChunk or 
GetBlock** call for the same container also needs readLock — multiple readers 
allowed simultaneously. So they don't block each other. Reads are safe during 
DB's copy phase.
   - After **updateContainer**, the ContainerSet maps to the new object. The 
read handler calls **containerSet.getContainer(id)** fresh on every RPC — it 
gets the NEW object pointing to Disk2. Reads proceed on Disk2. Safe after the 
swap.
   - The only window: if the gRPC channel had fetched the container reference 
before updateContainer, it still reads from Disk1 files via the OLD object. 
Since read lock doesn't conflict with another read lock, reads work fine. Disk1 
files still exist until **replicaDeletionDelay**.  Safe, but again there can be 
issue if ECReconstruction has still not completed from old container which will 
be deleted eventually after 5mins of movement to new disk then read failure 
will happen for ECReconstruction.
   
   > What scenarios replace the container object in ContainerSet?
   
   What I can see from the codebase is :
   ```
   addContainer()         → called at DN startup (ContainerReader), 
                            incoming replication (importContainer),
                            EC reconstruction target creation
   updateContainer()      → called ONLY by DiskBalancerService (line 557)
   ```
   That's it. `updateContainer` for diskBalancer is the only production path 
that swaps the live container object.
   
   


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