HDDS-420. putKey failing with KEY_ALLOCATION_ERROR. Contributed by Shashikant Banerjee.

This commit is contained in:
Mukul Kumar Singh 2018-09-13 11:29:31 +05:30
parent d7c0a08a1c
commit c6e19db197
5 changed files with 14 additions and 5 deletions

View File

@ -280,7 +280,7 @@ public class StateContext {
&& pipelineActionIter.hasClosePipeline() && pipelineAction && pipelineActionIter.hasClosePipeline() && pipelineAction
.hasClosePipeline() .hasClosePipeline()
&& pipelineActionIter.getClosePipeline().getPipelineID() && pipelineActionIter.getClosePipeline().getPipelineID()
== pipelineAction.getClosePipeline().getPipelineID()) { .equals(pipelineAction.getClosePipeline().getPipelineID())) {
return; return;
} }
} }

View File

@ -397,6 +397,9 @@ public final class XceiverServerRatis implements XceiverServerSpi {
.setAction(PipelineAction.Action.CLOSE) .setAction(PipelineAction.Action.CLOSE)
.build(); .build();
context.addPipelineActionIfAbsent(action); context.addPipelineActionIfAbsent(action);
LOG.debug(
"pipeline Action " + action.getAction() + " on pipeline " + pipelineID
+ ".Reason : " + action.getClosePipeline().getDetailedReason());
} }
void handleNodeSlowness( void handleNodeSlowness(

View File

@ -25,6 +25,8 @@ import org.apache.hadoop.hdds.scm.events.SCMEvents;
import org.apache.hadoop.hdds.scm.node.states.Node2ContainerMap; import org.apache.hadoop.hdds.scm.node.states.Node2ContainerMap;
import org.apache.hadoop.hdds.server.events.EventHandler; import org.apache.hadoop.hdds.server.events.EventHandler;
import org.apache.hadoop.hdds.server.events.EventPublisher; import org.apache.hadoop.hdds.server.events.EventPublisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set; import java.util.Set;
@ -32,6 +34,7 @@ import java.util.Set;
* Handles Stale node event. * Handles Stale node event.
*/ */
public class StaleNodeHandler implements EventHandler<DatanodeDetails> { public class StaleNodeHandler implements EventHandler<DatanodeDetails> {
static final Logger LOG = LoggerFactory.getLogger(StaleNodeHandler.class);
private final Node2ContainerMap node2ContainerMap; private final Node2ContainerMap node2ContainerMap;
private final Mapping containerManager; private final Mapping containerManager;
@ -48,6 +51,7 @@ public class StaleNodeHandler implements EventHandler<DatanodeDetails> {
Set<PipelineID> pipelineIDs = Set<PipelineID> pipelineIDs =
containerManager.getPipelineOnDatanode(datanodeDetails); containerManager.getPipelineOnDatanode(datanodeDetails);
for (PipelineID id : pipelineIDs) { for (PipelineID id : pipelineIDs) {
LOG.info("closing pipeline {}.", id);
publisher.fireEvent(SCMEvents.PIPELINE_CLOSE, id); publisher.fireEvent(SCMEvents.PIPELINE_CLOSE, id);
} }
} }

View File

@ -50,6 +50,8 @@ public class PipelineActionEventHandler implements
case CLOSE: case CLOSE:
PipelineID pipelineID = PipelineID. PipelineID pipelineID = PipelineID.
getFromProtobuf(action.getClosePipeline().getPipelineID()); getFromProtobuf(action.getClosePipeline().getPipelineID());
LOG.info("Closing pipeline " + pipelineID + " for reason:" + action
.getClosePipeline().getDetailedReason());
publisher.fireEvent(SCMEvents.PIPELINE_CLOSE, pipelineID); publisher.fireEvent(SCMEvents.PIPELINE_CLOSE, pipelineID);
break; break;
default: default:

View File

@ -110,15 +110,15 @@ public class RatisManagerImpl extends PipelineManager {
* Close the pipeline. * Close the pipeline.
*/ */
public void closePipeline(Pipeline pipeline) throws IOException { public void closePipeline(Pipeline pipeline) throws IOException {
try (XceiverClientRatis client =
XceiverClientRatis.newXceiverClientRatis(pipeline, conf)) {
client.destroyPipeline();
}
super.closePipeline(pipeline); super.closePipeline(pipeline);
for (DatanodeDetails node : pipeline.getMachines()) { for (DatanodeDetails node : pipeline.getMachines()) {
// A node should always be the in ratis members list. // A node should always be the in ratis members list.
Preconditions.checkArgument(ratisMembers.remove(node)); Preconditions.checkArgument(ratisMembers.remove(node));
} }
try (XceiverClientRatis client =
XceiverClientRatis.newXceiverClientRatis(pipeline, conf)) {
client.destroyPipeline();
}
} }
/** /**