amaliujia commented on a change in pull request #1785:
URL: https://github.com/apache/ozone/pull/1785#discussion_r556236623
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateManagerV2Impl.java
##########
@@ -242,14 +242,35 @@ public void updatePipelineState(
throws IOException {
lock.writeLock().lock();
try {
+ PipelineID pipelineID = PipelineID.getFromProtobuf(pipelineIDProto);
+ Pipeline.PipelineState state = getPipeline(pipelineID)
+ .getPipelineState();
pipelineStateMap.updatePipelineState(
PipelineID.getFromProtobuf(pipelineIDProto),
Pipeline.PipelineState.fromProtobuf(newState));
+ updatePipelineStateInDb(pipelineID, state);
} finally {
lock.writeLock().unlock();
}
}
+ private void updatePipelineStateInDb(PipelineID pipelineId,
+ Pipeline.PipelineState state)
+ throws IOException {
+ // null check is here to prevent the case where SCM store
+ // is closed but the staleNode handlers/pipleine creations
+ // still try to access it.
+ if (pipelineStore != null) {
+ try {
+ pipelineStore.put(pipelineId, getPipeline(pipelineId));
+ } catch (IOException ex) {
+ LOG.info("Pipeline {} state update failed", pipelineId);
Review comment:
Will LOG.warning better for printing an caught exception?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]