HDFS-7854. Separate class DataStreamer out of DFSOutputStream. Contributed by Li Bo.
This commit is contained in:
parent
570a83ae80
commit
a16bfff71b
@ -332,6 +332,9 @@ Release 2.8.0 - UNRELEASED
|
||||
|
||||
HDFS-7829. Code clean up for LocatedBlock. (Takanobu Asanuma via jing9)
|
||||
|
||||
HDFS-7854. Separate class DataStreamer out of DFSOutputStream. (Li Bo via
|
||||
jing9)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
@ -77,7 +77,7 @@
|
||||
ResponseProccessor is thread that is designed to catch RuntimeException.
|
||||
-->
|
||||
<Match>
|
||||
<Class name="org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer$ResponseProcessor" />
|
||||
<Class name="org.apache.hadoop.hdfs.DataStreamer$ResponseProcessor" />
|
||||
<Method name="run" />
|
||||
<Bug pattern="REC_CATCH_EXCEPTION" />
|
||||
</Match>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -905,7 +905,7 @@ public static byte[] loadFile(String filename) throws IOException {
|
||||
public static BlockOpResponseProto transferRbw(final ExtendedBlock b,
|
||||
final DFSClient dfsClient, final DatanodeInfo... datanodes) throws IOException {
|
||||
assertEquals(2, datanodes.length);
|
||||
final Socket s = DFSOutputStream.createSocketForPipeline(datanodes[0],
|
||||
final Socket s = DataStreamer.createSocketForPipeline(datanodes[0],
|
||||
datanodes.length, dfsClient);
|
||||
final long writeTimeout = dfsClient.getDatanodeWriteTimeout(datanodes.length);
|
||||
final DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
|
||||
|
@ -51,8 +51,11 @@ public void testCloseTwice() throws IOException {
|
||||
DFSOutputStream dos = (DFSOutputStream) Whitebox.getInternalState(os,
|
||||
"wrappedStream");
|
||||
@SuppressWarnings("unchecked")
|
||||
DataStreamer streamer = (DataStreamer) Whitebox
|
||||
.getInternalState(dos, "streamer");
|
||||
@SuppressWarnings("unchecked")
|
||||
AtomicReference<IOException> ex = (AtomicReference<IOException>) Whitebox
|
||||
.getInternalState(dos, "lastException");
|
||||
.getInternalState(streamer, "lastException");
|
||||
Assert.assertEquals(null, ex.get());
|
||||
|
||||
dos.close();
|
||||
|
@ -43,6 +43,8 @@
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
@ -603,7 +605,8 @@ public void testFileCreationError3() throws IOException {
|
||||
* Test that file leases are persisted across namenode restarts.
|
||||
*/
|
||||
@Test
|
||||
public void testFileCreationNamenodeRestart() throws IOException {
|
||||
public void testFileCreationNamenodeRestart()
|
||||
throws IOException, NoSuchFieldException, IllegalAccessException {
|
||||
Configuration conf = new HdfsConfiguration();
|
||||
final int MAX_IDLE_TIME = 2000; // 2s
|
||||
conf.setInt("ipc.client.connection.maxidletime", MAX_IDLE_TIME);
|
||||
@ -702,11 +705,18 @@ public void testFileCreationNamenodeRestart() throws IOException {
|
||||
// new blocks for files that were renamed.
|
||||
DFSOutputStream dfstream = (DFSOutputStream)
|
||||
(stm.getWrappedStream());
|
||||
dfstream.setTestFilename(file1.toString());
|
||||
|
||||
Field f = DFSOutputStream.class.getDeclaredField("src");
|
||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
||||
modifiersField.setAccessible(true);
|
||||
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
|
||||
f.setAccessible(true);
|
||||
|
||||
f.set(dfstream, file1.toString());
|
||||
dfstream = (DFSOutputStream) (stm3.getWrappedStream());
|
||||
dfstream.setTestFilename(file3new.toString());
|
||||
f.set(dfstream, file3new.toString());
|
||||
dfstream = (DFSOutputStream) (stm4.getWrappedStream());
|
||||
dfstream.setTestFilename(file4new.toString());
|
||||
f.set(dfstream, file4new.toString());
|
||||
|
||||
// write 1 byte to file. This should succeed because the
|
||||
// namenode should have persisted leases.
|
||||
|
Loading…
Reference in New Issue
Block a user