Package org.apache.hadoop.hdfs
Class DFSStripedOutputStream
java.lang.Object
java.io.OutputStream
org.apache.hadoop.fs.FSOutputSummer
org.apache.hadoop.hdfs.DFSOutputStream
org.apache.hadoop.hdfs.DFSStripedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,org.apache.hadoop.fs.CanSetDropBehind,org.apache.hadoop.fs.StreamCapabilities,org.apache.hadoop.fs.Syncable
@Private
public class DFSStripedOutputStream
extends DFSOutputStream
implements org.apache.hadoop.fs.StreamCapabilities
This class supports writing files in striped layout and erasure coded format.
Each stripe contains a sequence of cells.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.fs.StreamCapabilities
org.apache.hadoop.fs.StreamCapabilities.StreamCapability -
Field Summary
Fields inherited from class org.apache.hadoop.hdfs.DFSOutputStream
blockSize, byteArrayManager, bytesPerChecksum, cachingStrategy, chunksPerPacket, closed, currentPacket, dfsClient, fileId, initialFileSize, lastFlushOffset, packetSize, shouldSyncBlock, src, streamerFields inherited from interface org.apache.hadoop.fs.StreamCapabilities
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO, VECTOREDIO_BUFFERS_SLICED -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidcloseThreads(boolean force) booleanhasCapability(String capability) voidhflush()Flushes out to all replicas of the block.voidhsync()voidhsync(EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags) The expected semantics is all data have flushed out to all replicas and all replicas have done posix fsync equivalent - ie the OS has flushed it to the disk device (but the disk may have it in its cache).protected voidstart()protected voidwriteChunk(byte[] bytes, int offset, int len, byte[] checksum, int ckoff, int cklen) Methods inherited from class org.apache.hadoop.hdfs.DFSOutputStream
adjustChunkBoundary, checkClosed, close, completeFile, computePacketChunkSize, createPacket, createWriteTraceScope, flushInternal, flushInternalWithoutWaitingAck, getAddBlockFlags, getCurrentBlockReplication, getFileEncryptionInfo, getFileId, getInitialLen, getNamespace, getNumCurrentReplicas, getPipeline, getStreamer, getUniqKey, recoverLease, setArtificialSlowdown, setChunksPerPacket, setDropBehind, toString, writeChunkMethods inherited from class org.apache.hadoop.fs.FSOutputSummer
convertToByteStream, flush, flushBuffer, flushBuffer, getBufferedDataSize, getChecksumSize, getDataChecksum, resetChecksumBufSize, setChecksumBufSize, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream, write
-
Method Details
-
writeChunk
protected void writeChunk(byte[] bytes, int offset, int len, byte[] checksum, int ckoff, int cklen) throws IOException - Overrides:
writeChunkin classDFSOutputStream- Throws:
IOException
-
hasCapability
- Specified by:
hasCapabilityin interfaceorg.apache.hadoop.fs.StreamCapabilities- Overrides:
hasCapabilityin classDFSOutputStream
-
hflush
public void hflush()Description copied from class:DFSOutputStreamFlushes out to all replicas of the block. The data is in the buffers of the DNs but not necessarily in the DN's OS buffers. It is a synchronous operation. When it returns, it guarantees that flushed data become visible to new readers. It is not guaranteed that data has been flushed to persistent store on the datanode. Block allocations are persisted on namenode.- Specified by:
hflushin interfaceorg.apache.hadoop.fs.Syncable- Overrides:
hflushin classDFSOutputStream
-
hsync
public void hsync()- Specified by:
hsyncin interfaceorg.apache.hadoop.fs.Syncable- Overrides:
hsyncin classDFSOutputStream
-
hsync
Description copied from class:DFSOutputStreamThe expected semantics is all data have flushed out to all replicas and all replicas have done posix fsync equivalent - ie the OS has flushed it to the disk device (but the disk may have it in its cache). Note that only the current block is flushed to the disk device. To guarantee durable sync across block boundaries the stream should be created withCreateFlag.SYNC_BLOCK.- Overrides:
hsyncin classDFSOutputStream- Parameters:
syncFlags- Indicate the semantic of the sync. Currently used to specify whether or not to update the block length in NameNode.
-
start
protected void start()- Overrides:
startin classDFSOutputStream
-
closeThreads
- Overrides:
closeThreadsin classDFSOutputStream- Throws:
IOException
-
closeImpl
- Overrides:
closeImplin classDFSOutputStream- Throws:
IOException
-