Created
May 19, 2010 02:10
-
-
Save toddlipcon/405868 to your computer and use it in GitHub Desktop.
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
commit 081e16ad9cfcba9cdb6d438845c2c60552589c18 | |
Author: Todd Lipcon <todd@lipcon.org> | |
Date: Tue May 18 19:06:17 2010 -0700 | |
HDFS-895. Tighten up assertions on sequence numbering, fix a small bug where the sequence would have "holes" in it | |
diff --git a/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java b/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java | |
index 2460f6a..5bcbaa8 100644 | |
--- a/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java | |
+++ b/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java | |
@@ -2502,7 +2502,7 @@ public class DFSClient implements FSConstants, java.io.Closeable { | |
} | |
synchronized (ackQueue) { | |
- assert ack.getSeqno()> lastAckedSeqno; | |
+ assert ack.getSeqno() == lastAckedSeqno + 1; | |
lastAckedSeqno = ack.getSeqno(); | |
ackQueue.removeFirst(); | |
ackQueue.notifyAll(); | |
@@ -3157,6 +3157,7 @@ public class DFSClient implements FSConstants, java.io.Closeable { | |
* any partial checksum chunk will be sent now and in next packet. | |
*/ | |
long saveOffset = bytesCurBlock; | |
+ Packet oldCurrentPacket = currentPacket; | |
// flush checksum buffer, but keep checksum buffer intact | |
flushBuffer(true); | |
@@ -3176,6 +3177,12 @@ public class DFSClient implements FSConstants, java.io.Closeable { | |
enqueueCurrentPacket(); | |
} else { | |
// just discard the current packet since it is already been sent. | |
+ if (oldCurrentPacket == null && currentPacket != null) { | |
+ // If we didn't previously have a packet queued, and now we do, | |
+ // but we don't plan on sending it, then we should not | |
+ // skip a sequence number for it! | |
+ currentSeqno--; | |
+ } | |
currentPacket = null; | |
} | |
// Restore state of stream. Record the last flush offset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment