You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by sh...@apache.org on 2009/10/06 01:08:54 UTC
svn commit: r822080 - in /hadoop/hdfs/trunk: ./
src/java/org/apache/hadoop/hdfs/server/datanode/
src/java/org/apache/hadoop/hdfs/server/protocol/
src/test/hdfs/org/apache/hadoop/hdfs/
src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/
Author: shv
Date: Mon Oct 5 23:08:53 2009
New Revision: 822080
URL: http://svn.apache.org/viewvc?rev=822080&view=rev
Log:
HDFS-660. Remove deprecated methods from InterDatanodeProtocol. Contributed by Konstantin Shvachko.
Removed:
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/BlockMetaDataInfo.java
Modified:
hadoop/hdfs/trunk/CHANGES.txt
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java
hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java
hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Mon Oct 5 23:08:53 2009
@@ -41,6 +41,8 @@
HDFS-658. Block recovery for primary data-node. (shv)
+ HDFS-660. Remove deprecated methods from InterDatanodeProtocol. (shv)
+
NEW FEATURES
HDFS-436. Introduce AspectJ framework for HDFS code and tests.
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java Mon Oct 5 23:08:53 2009
@@ -68,7 +68,6 @@
import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.server.namenode.StreamFile;
import org.apache.hadoop.hdfs.server.protocol.BlockCommand;
-import org.apache.hadoop.hdfs.server.protocol.BlockMetaDataInfo;
import org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand;
import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand;
import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol;
@@ -1508,32 +1507,6 @@
}
}
- // InterDataNodeProtocol implementation
- /** {@inheritDoc} */
- public BlockMetaDataInfo getBlockMetaDataInfo(Block block
- ) throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("block=" + block);
- }
- Block stored = data.getStoredBlock(block.getBlockId());
-
- if (stored == null) {
- return null;
- }
- BlockMetaDataInfo info = new BlockMetaDataInfo(stored,
- blockScanner.getLastScanTime(stored));
- if (LOG.isDebugEnabled()) {
- LOG.debug("getBlockMetaDataInfo successful block=" + stored +
- " length " + stored.getNumBytes() +
- " genstamp " + stored.getGenerationStamp());
- }
-
- // paranoia! verify that the contents of the stored block
- // matches the block file on disk.
- data.validateBlockMetadata(stored);
- return info;
- }
-
public Daemon recoverBlocks(final Collection<RecoveringBlock> blocks) {
Daemon d = new Daemon(threadGroup, new Runnable() {
/** Recover a list of blocks. It is run by the primary datanode. */
@@ -1552,22 +1525,7 @@
return d;
}
- /** {@inheritDoc} */
- public void updateBlock(Block oldblock, Block newblock, boolean finalize) throws IOException {
- LOG.info("oldblock=" + oldblock + "(length=" + oldblock.getNumBytes()
- + "), newblock=" + newblock + "(length=" + newblock.getNumBytes()
- + "), datanode=" + dnRegistration.getName());
- data.updateBlock(oldblock, newblock);
- if (finalize) {
- data.finalizeBlock(newblock);
- myMetrics.blocksWritten.inc();
- notifyNamenodeReceivedBlock(newblock, EMPTY_DEL_HINT);
- LOG.info("Received block " + newblock +
- " of size " + newblock.getNumBytes() +
- " as part of lease recovery.");
- }
- }
-
+ // InterDataNodeProtocol implementation
@Override // InterDatanodeProtocol
public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock)
throws IOException {
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java Mon Oct 5 23:08:53 2009
@@ -960,66 +960,6 @@
return info.unlinkBlock(numLinks);
}
- /** {@inheritDoc} */
- public void updateBlock(Block oldblock, Block newblock) throws IOException {
- if (oldblock.getBlockId() != newblock.getBlockId()) {
- throw new IOException("Cannot update oldblock (=" + oldblock
- + ") to newblock (=" + newblock + ").");
- }
-
- final ReplicaInfo replicaInfo = volumeMap.get(oldblock.getBlockId());
- File blockFile = replicaInfo==null?null:replicaInfo.getBlockFile();
- if (blockFile == null) {
- throw new IOException("Block " + oldblock + " does not exist.");
- }
-
- //check write threads
- if (replicaInfo instanceof ReplicaInPipeline) {
- ((ReplicaInPipeline)replicaInfo).stopWriter();
- }
-
- //No ongoing create threads is alive. Update block.
- File oldMetaFile = replicaInfo.getMetaFile();
- long oldgs = replicaInfo.getGenerationStamp();
-
- //rename meta file to a tmp file
- File tmpMetaFile = new File(oldMetaFile.getParent(),
- oldMetaFile.getName()+"_tmp" + newblock.getGenerationStamp());
- if (!oldMetaFile.renameTo(tmpMetaFile)){
- throw new IOException("Cannot rename block meta file to " + tmpMetaFile);
- }
-
- //update generation stamp
- if (oldgs >= newblock.getGenerationStamp()) {
- throw new IOException("Cannot update block (id=" + newblock.getBlockId()
- + ") generation stamp from " + oldgs
- + " to " + newblock.getGenerationStamp());
- }
-
- //update length
- if (newblock.getNumBytes() > oldblock.getNumBytes()) {
- throw new IOException("Cannot update block file (=" + blockFile
- + ") length from " + oldblock.getNumBytes() + " to " + newblock.getNumBytes());
- }
- if (newblock.getNumBytes() < oldblock.getNumBytes()) {
- truncateBlock(blockFile, tmpMetaFile, oldblock.getNumBytes(), newblock.getNumBytes());
- }
-
- // update replicaInfo
- replicaInfo.setGenerationStamp(newblock.getGenerationStamp());
- replicaInfo.setNumBytes(newblock.getNumBytes());
-
- //rename the tmp file to the new meta file (with new generation stamp)
- File newMetaFile = replicaInfo.getMetaFile();
- if (!tmpMetaFile.renameTo(newMetaFile)) {
- throw new IOException("Cannot rename tmp meta file to " + newMetaFile);
- }
-
- // paranoia! verify that the contents of the stored block
- // matches the block file on disk.
- validateBlockMetadata(newblock);
- }
-
static private void truncateBlock(File blockFile, File metaFile,
long oldlen, long newlen) throws IOException {
DataNode.LOG.info("truncateBlock: blockFile=" + blockFile
@@ -1597,11 +1537,6 @@
return null;
}
- /** {@inheritDoc} */
- public void validateBlockMetadata(Block b) throws IOException {
- checkReplicaFiles(getReplicaInfo(b));
- }
-
/** Check the files of a replica. */
static void checkReplicaFiles(final ReplicaInfo r) throws IOException {
final File f = r.getBlockFile();
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java Mon Oct 5 23:08:53 2009
@@ -252,11 +252,6 @@
long newGS, long expectedBlockLen) throws IOException;
/**
- * Update the block to the new generation stamp and length.
- */
- public void updateBlock(Block oldblock, Block newblock) throws IOException;
-
- /**
* Finalizes the block previously opened for writing using writeToBlock.
* The block size is what is in the parameter b and it must match the amount
* of data written
@@ -333,14 +328,6 @@
long ckOffset) throws IOException;
/**
- * Validate that the contents in the Block matches
- * the file on disk. Returns true if everything is fine.
- * @param b The block to be verified.
- * @throws IOException
- */
- public void validateBlockMetadata(Block b) throws IOException;
-
- /**
* checks how many valid storage volumes are there in the DataNode
* @return true if more then minimum valid volumes left in the FSDataSet
*/
Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java Mon Oct 5 23:08:53 2009
@@ -32,22 +32,9 @@
public static final Log LOG = LogFactory.getLog(InterDatanodeProtocol.class);
/**
- * 4: initReplicaRecovery(), updateReplicaUnderRecovery() added.
+ * 5: getBlockMetaDataInfo(), updateBlock() removed.
*/
- public static final long versionID = 4L;
-
- /** @return the BlockMetaDataInfo of a block;
- * null if the block is not found
- */
- @Deprecated
- BlockMetaDataInfo getBlockMetaDataInfo(Block block) throws IOException;
-
- /**
- * Update the block to the new generation stamp and length.
- */
- @Deprecated
- void updateBlock(Block oldblock, Block newblock, boolean finalize)
- throws IOException;
+ public static final long versionID = 5L;
/**
* Initialize a replica recovery.
Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/TestLeaseRecovery.java Mon Oct 5 23:08:53 2009
@@ -93,7 +93,7 @@
assertTrue(datanodes[i] != null);
}
- //verify BlockMetaDataInfo
+ //verify Block Info
Block lastblock = locatedblock.getBlock();
DataNode.LOG.info("newblocks=" + lastblock);
for(int i = 0; i < REPLICATION_NUM; i++) {
Modified: hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java?rev=822080&r1=822079&r2=822080&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java (original)
+++ hadoop/hdfs/trunk/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java Mon Oct 5 23:08:53 2009
@@ -115,12 +115,6 @@
return theBlock.getGenerationStamp();
}
- synchronized void updateBlock(Block b) {
- theBlock.setGenerationStamp(b.getGenerationStamp());
- setNumBytes(b.getNumBytes());
- setBytesOnDisk(b.getNumBytes());
- }
-
synchronized public long getNumBytes() {
if (!finalized) {
return bytesRcvd;
@@ -415,15 +409,6 @@
return b;
}
- /** {@inheritDoc} */
- public void updateBlock(Block oldblock, Block newblock) throws IOException {
- BInfo binfo = blockMap.get(newblock);
- if (binfo == null) {
- throw new IOException("BInfo not found, b=" + newblock);
- }
- binfo.updateBlock(newblock);
- }
-
public synchronized void invalidate(Block[] invalidBlks) throws IOException {
boolean error = false;
if (invalidBlks == null) {
@@ -578,10 +563,6 @@
throw new IOException("Not supported");
}
- /** No-op */
- public void validateBlockMetadata(Block b) {
- }
-
/**
* Returns metaData of block b as an input stream
* @param b - the block for which the metadata is desired