-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
160 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...src/test/java/org/apache/hadoop/hdfs/server/namenode/TestRedundantEditLogInputStream.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.hadoop.hdfs.server.namenode; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
import org.junit.Test; | ||
|
||
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.MkdirOp; | ||
import org.apache.hadoop.test.GenericTestUtils.LogCapturer; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class TestRedundantEditLogInputStream { | ||
private static final String FAKE_EDIT_STREAM_NAME = "FAKE_STREAM"; | ||
|
||
@Test | ||
public void testNextOp() throws IOException { | ||
EditLogInputStream fakeStream1 = mock(EditLogInputStream.class); | ||
EditLogInputStream fakeStream2 = mock(EditLogInputStream.class); | ||
ArrayList<EditLogInputStream> list = new ArrayList(); | ||
list.add(fakeStream1); | ||
list.add(fakeStream2); | ||
for (int i = 0; i < list.size(); i++) { | ||
EditLogInputStream stream = list.get(i); | ||
when(stream.getName()).thenReturn(FAKE_EDIT_STREAM_NAME + i); | ||
when(stream.getFirstTxId()).thenReturn(1L); | ||
when(stream.getLastTxId()).thenReturn(2L); | ||
when(stream.length()).thenReturn(1L); | ||
} | ||
when(fakeStream1.skipUntil(1)).thenThrow(new IOException("skipUntil failed.")); | ||
when(fakeStream2.skipUntil(1)).thenReturn(true); | ||
FSEditLogOp op = new MkdirOp(); | ||
op.setTransactionId(100); | ||
when(fakeStream2.readOp()).thenReturn(op); | ||
|
||
LogCapturer capture = LogCapturer.captureLogs(RedundantEditLogInputStream.LOG); | ||
RedundantEditLogInputStream redundantEditLogInputStream = | ||
new RedundantEditLogInputStream(list, 1); | ||
|
||
FSEditLogOp returnOp = redundantEditLogInputStream.nextOp(); | ||
String log = capture.getOutput(); | ||
assertTrue(log.contains("Got error skipUntil edit log input stream FAKE_STREAM0")); | ||
assertTrue(log.contains("Got error reading edit log input stream FAKE_STREAM0; " | ||
+ "failing over to edit log FAKE_STREAM1")); | ||
assertEquals(op, returnOp); | ||
} | ||
} |
Binary file added
BIN
+20 KB
...p-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/.LineRecordReader.java.swp
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters