HDFS-2992. svn merge -c 1295227 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1295231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dacaa424df
commit
d9ca467266
|
@ -90,6 +90,9 @@ Release 0.23.3 - UNRELEASED
|
||||||
HDFS-2895. Remove Writable wire protocol types and translators to
|
HDFS-2895. Remove Writable wire protocol types and translators to
|
||||||
complete transition to protocol buffers. (suresh)
|
complete transition to protocol buffers. (suresh)
|
||||||
|
|
||||||
|
HDFS-2992. Edit log failure trace should include transaction ID of
|
||||||
|
error. (Colin Patrick McCabe via eli)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -117,21 +117,20 @@ public class FSEditLogLoader {
|
||||||
long recentOpcodeOffsets[] = new long[4];
|
long recentOpcodeOffsets[] = new long[4];
|
||||||
Arrays.fill(recentOpcodeOffsets, -1);
|
Arrays.fill(recentOpcodeOffsets, -1);
|
||||||
|
|
||||||
|
long txId = expectedStartingTxId - 1;
|
||||||
try {
|
try {
|
||||||
long txId = expectedStartingTxId - 1;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FSEditLogOp op;
|
FSEditLogOp op;
|
||||||
while ((op = in.readOp()) != null) {
|
while ((op = in.readOp()) != null) {
|
||||||
recentOpcodeOffsets[numEdits % recentOpcodeOffsets.length] =
|
recentOpcodeOffsets[numEdits % recentOpcodeOffsets.length] =
|
||||||
in.getPosition();
|
in.getPosition();
|
||||||
if (LayoutVersion.supports(Feature.STORED_TXIDS, logVersion)) {
|
if (LayoutVersion.supports(Feature.STORED_TXIDS, logVersion)) {
|
||||||
long thisTxId = op.txid;
|
long expectedTxId = txId + 1;
|
||||||
if (thisTxId != txId + 1) {
|
txId = op.txid;
|
||||||
|
if (txId != expectedTxId) {
|
||||||
throw new IOException("Expected transaction ID " +
|
throw new IOException("Expected transaction ID " +
|
||||||
(txId + 1) + " but got " + thisTxId);
|
expectedTxId + " but got " + txId);
|
||||||
}
|
}
|
||||||
txId = thisTxId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
numEdits++;
|
numEdits++;
|
||||||
|
@ -415,6 +414,7 @@ public class FSEditLogLoader {
|
||||||
// sort of error might be thrown (NumberFormat, NullPointer, EOF, etc.)
|
// sort of error might be thrown (NumberFormat, NullPointer, EOF, etc.)
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Error replaying edit log at offset " + in.getPosition());
|
sb.append("Error replaying edit log at offset " + in.getPosition());
|
||||||
|
sb.append("On transaction ID ").append(txId);
|
||||||
if (recentOpcodeOffsets[0] != -1) {
|
if (recentOpcodeOffsets[0] != -1) {
|
||||||
Arrays.sort(recentOpcodeOffsets);
|
Arrays.sort(recentOpcodeOffsets);
|
||||||
sb.append("\nRecent opcode offsets:");
|
sb.append("\nRecent opcode offsets:");
|
||||||
|
|
|
@ -90,15 +90,17 @@ public class TestFSEditLogLoader {
|
||||||
}
|
}
|
||||||
rwf.close();
|
rwf.close();
|
||||||
|
|
||||||
String expectedErrorMessage = "^Error replaying edit log at offset \\d+\n";
|
StringBuilder bld = new StringBuilder();
|
||||||
expectedErrorMessage += "Recent opcode offsets: (\\d+\\s*){4}$";
|
bld.append("^Error replaying edit log at offset \\d+");
|
||||||
|
bld.append("On transaction ID \\d+\n");
|
||||||
|
bld.append("Recent opcode offsets: (\\d+\\s*){4}$");
|
||||||
try {
|
try {
|
||||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATA_NODES)
|
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATA_NODES)
|
||||||
.format(false).build();
|
.format(false).build();
|
||||||
fail("should not be able to start");
|
fail("should not be able to start");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
assertTrue("error message contains opcodes message",
|
assertTrue("error message contains opcodes message",
|
||||||
e.getMessage().matches(expectedErrorMessage));
|
e.getMessage().matches(bld.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue