Class DfsClientShm
java.lang.Object
org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm
org.apache.hadoop.hdfs.shortcircuit.DfsClientShm
- All Implemented Interfaces:
org.apache.hadoop.net.unix.DomainSocketWatcher.Handler
public class DfsClientShm
extends ShortCircuitShm
implements org.apache.hadoop.net.unix.DomainSocketWatcher.Handler
DfsClientShm is a subclass of ShortCircuitShm which is used by the
DfsClient.
When the UNIX domain socket associated with this shared memory segment
closes unexpectedly, we mark the slots inside this segment as disconnected.
ShortCircuitReplica objects that contain disconnected slots are stale,
and will not be used to service new reads or mmap operations.
However, in-progress read or mmap operations will continue to proceed.
Once the last slot is deallocated, the segment can be safely munmapped.
Slots may also become stale because the associated replica has been deleted
on the DataNode. In this case, the DataNode will clear the 'valid' bit.
The client will then see these slots as stale (see
#{ShortCircuitReplica#isStale}).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm
ShortCircuitShm.ShmId, ShortCircuitShm.Slot, ShortCircuitShm.SlotId, ShortCircuitShm.SlotIterator -
Field Summary
Fields inherited from class org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm
BYTES_PER_SLOT -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.shortcircuit.DfsClientShmManager.EndpointShmManagergetPeer()booleanhandle(org.apache.hadoop.net.unix.DomainSocket sock) Handle the closure of the UNIX domain socket associated with this shared memory segment by marking this segment as stale.booleanDetermine if the shared memory segment is disconnected from the DataNode.Methods inherited from class org.apache.hadoop.hdfs.shortcircuit.ShortCircuitShm
allocAndRegisterSlot, free, getShmId, getSlot, isEmpty, isFull, registerSlot, slotIterator, toString, unregisterSlot
-
Method Details
-
getEndpointShmManager
public org.apache.hadoop.hdfs.shortcircuit.DfsClientShmManager.EndpointShmManager getEndpointShmManager() -
getPeer
-
isDisconnected
public boolean isDisconnected()Determine if the shared memory segment is disconnected from the DataNode. This must be called with the DfsClientShmManager lock held.- Returns:
- True if the shared memory segment is stale.
-
handle
public boolean handle(org.apache.hadoop.net.unix.DomainSocket sock) Handle the closure of the UNIX domain socket associated with this shared memory segment by marking this segment as stale. If there are no slots associated with this shared memory segment, it will be freed immediately in this function.- Specified by:
handlein interfaceorg.apache.hadoop.net.unix.DomainSocketWatcher.Handler
-