From 83c14fbd24353b5e882f065faec81e58449afed3 Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Mon, 17 Sep 2012 21:51:40 +0000 Subject: [PATCH] HDFS-3943. QJM: remove currently-unused md5sum field. Contributed by Todd Lipcon. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-3077@1386863 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt | 2 ++ .../hdfs/qjournal/client/SegmentRecoveryComparator.java | 6 ++---- .../org/apache/hadoop/hdfs/qjournal/server/Journal.java | 5 +---- .../hadoop-hdfs/src/main/proto/QJournalProtocol.proto | 1 - .../hdfs/qjournal/client/TestSegmentRecoveryComparator.java | 5 ----- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt index 3f0c3d7227..b052050856 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-3077.txt @@ -74,3 +74,5 @@ HDFS-3840. JournalNodes log JournalNotFormattedException backtrace error before HDFS-3894. QJM: testRecoverAfterDoubleFailures can be flaky due to IPC client caching (todd) HDFS-3926. QJM: Add user documentation for QJM. (atm) + +HDFS-3943. QJM: remove currently-unused md5sum field (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/SegmentRecoveryComparator.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/SegmentRecoveryComparator.java index b8e6ec3664..61b60aaad8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/SegmentRecoveryComparator.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/client/SegmentRecoveryComparator.java @@ -71,10 +71,8 @@ public int compare( } if (!r1Seg.getIsInProgress()) { - // If both are finalized, they should match lengths, and be considered - // equal - if (r1Seg.getEndTxId() != r2Seg.getEndTxId() || - !r1Seg.getMd5Sum().equals(r2Seg.getMd5Sum())) { + // If both are finalized, they should match lengths + if (r1Seg.getEndTxId() != r2Seg.getEndTxId()) { throw new AssertionError("finalized segs with different lengths: " + r1 + ", " + r2); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java index dd11d3a323..d4953bc9a0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/Journal.java @@ -59,7 +59,6 @@ import com.google.common.base.Stopwatch; import com.google.common.collect.Range; import com.google.common.collect.Ranges; -import com.google.protobuf.ByteString; import com.google.protobuf.TextFormat; /** @@ -628,7 +627,6 @@ private SegmentStateProto getSegmentInfo(long segmentTxId) .setStartTxId(segmentTxId) .setEndTxId(elf.getLastTxId()) .setIsInProgress(elf.isInProgress()) - .setMd5Sum(ByteString.EMPTY) // TODO .build(); LOG.info("getSegmentInfo(" + segmentTxId + "): " + elf + " -> " + TextFormat.shortDebugString(ret)); @@ -655,8 +653,7 @@ public synchronized PrepareRecoveryResponseProto prepareRecovery( if (previouslyAccepted != null && !hasFinalizedSegment) { SegmentStateProto acceptedState = previouslyAccepted.getSegmentState(); - assert acceptedState.getEndTxId() == segInfo.getEndTxId() && - acceptedState.getMd5Sum().equals(segInfo.getMd5Sum()) : + assert acceptedState.getEndTxId() == segInfo.getEndTxId() : "prev accepted: " + TextFormat.shortDebugString(previouslyAccepted)+ "\n" + "on disk: " + TextFormat.shortDebugString(segInfo); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/QJournalProtocol.proto b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/QJournalProtocol.proto index 9c448ce3c8..d188f2beca 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/QJournalProtocol.proto +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/proto/QJournalProtocol.proto @@ -44,7 +44,6 @@ message SegmentStateProto { required uint64 startTxId = 1; required uint64 endTxId = 2; required bool isInProgress = 3; - required bytes md5sum = 4; } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestSegmentRecoveryComparator.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestSegmentRecoveryComparator.java index b49b68049a..ecd6a2cd46 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestSegmentRecoveryComparator.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/client/TestSegmentRecoveryComparator.java @@ -28,7 +28,6 @@ import org.mockito.Mockito; import com.google.common.collect.Maps; -import com.google.protobuf.ByteString; import static org.apache.hadoop.hdfs.qjournal.client.SegmentRecoveryComparator.INSTANCE; @@ -46,7 +45,6 @@ public void testComparisons() { .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(3L) - .setMd5Sum(ByteString.EMPTY) .setIsInProgress(true)) .setLastWriterEpoch(0L) .build()); @@ -55,7 +53,6 @@ public void testComparisons() { .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(4L) - .setMd5Sum(ByteString.EMPTY) .setIsInProgress(true)) .setLastWriterEpoch(0L) .build()); @@ -64,7 +61,6 @@ public void testComparisons() { .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(4L) - .setMd5Sum(ByteString.EMPTY) .setIsInProgress(true)) .setLastWriterEpoch(0L) .setAcceptedInEpoch(1L) @@ -75,7 +71,6 @@ public void testComparisons() { .setSegmentState(SegmentStateProto.newBuilder() .setStartTxId(1L) .setEndTxId(3L) - .setMd5Sum(ByteString.EMPTY) .setIsInProgress(false)) .setLastWriterEpoch(0L) .build());