Skip to content

Commit

Permalink
FSDataset bypass create temp for mlec repair
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajunmao committed Aug 25, 2024
1 parent 4426deb commit c017460
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
* a. # of live replicas >= # of min replication for maintenance.
* b. # of live replicas <= # of expected redundancy.
* c. # of live replicas and maintenance replicas >= # of expected
* redundancy.
* redundancy.C
*
* For regular replication, # of min live replicas for maintenance is determined
* by {@link DFSConfigKeys#DFS_NAMENODE_MAINTENANCE_REPLICATION_MIN_KEY}. This number has to <=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtilClient;
import org.apache.hadoop.hdfs.ExtendedBlockId;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
import org.apache.hadoop.hdfs.server.common.AutoCloseDataSetLock;
import org.apache.hadoop.hdfs.server.common.DataNodeLockManager;
import org.apache.hadoop.hdfs.server.common.DataNodeLockManager.LockLevel;
import org.apache.hadoop.hdfs.server.datanode.DataSetLockManager;
import org.apache.hadoop.hdfs.server.datanode.FileIoProvider;
import org.apache.hadoop.hdfs.server.datanode.FinalizedReplica;
import org.apache.hadoop.hdfs.server.datanode.LocalReplica;
import org.apache.hadoop.hdfs.server.datanode.erasurecode.ErasureCodingWorker;
import org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeMetrics;
import org.apache.hadoop.util.AutoCloseableLock;
import org.apache.hadoop.hdfs.protocol.Block;
Expand Down Expand Up @@ -1912,8 +1914,18 @@ public ReplicaHandler createTemporary(StorageType storageType,
.getNumBytes());
FsVolumeImpl v = (FsVolumeImpl) ref.getVolume();
ReplicaInPipeline newReplicaInfo;

LOG.info("Creating temporary block for block {} of type {}", b.getBlockId(), storageType);
try (AutoCloseableLock lock = lockManager.writeLock(LockLevel.VOLUME,
b.getBlockPoolId(), v.getStorageID())) {

Block storedBlock = this.getStoredBlock(b.getBlockPoolId(), b.getBlockId());
LOG.info("stored block is {}", storedBlock.getBlockId());
// MLEC logic, if the block we are writing to belongs to a MLEC repair
if (storageType == StorageType.ZFS && ErasureCodingWorker.ongoingRepairs.containsKey(b.getBlockId())) {
LOG.warn("This is a MLEC reconstruction write");
}

try {
newReplicaInfo = v.createTemporary(b);
LOG.info("creating temporary for block: {} on volume: {}",
Expand Down

0 comments on commit c017460

Please sign in to comment.