Skip to content

Commit 60af879

Browse files
committed
YARN-9821. NM hangs at serviceStop when ATSV2 Backend Hbase is Down. Contributed by Prabhu Joseph.
1 parent 387c332 commit 60af879

File tree

1 file changed

+42
-32
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage

1 file changed

+42
-32
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -630,39 +630,49 @@ public void flush() throws IOException {
630630
*/
631631
@Override
632632
protected void serviceStop() throws Exception {
633-
if (entityTable != null) {
634-
LOG.info("closing the entity table");
635-
// The close API performs flushing and releases any resources held
636-
entityTable.close();
633+
boolean isStorageUp = true;
634+
try {
635+
storageMonitor.checkStorageIsUp();
636+
} catch (IOException e) {
637+
LOG.warn("Failed to close the timeline tables as Hbase is down", e);
638+
isStorageUp = false;
637639
}
638-
if (appToFlowTable != null) {
639-
LOG.info("closing the app_flow table");
640-
// The close API performs flushing and releases any resources held
641-
appToFlowTable.close();
642-
}
643-
if (applicationTable != null) {
644-
LOG.info("closing the application table");
645-
applicationTable.close();
646-
}
647-
if (flowRunTable != null) {
648-
LOG.info("closing the flow run table");
649-
// The close API performs flushing and releases any resources held
650-
flowRunTable.close();
651-
}
652-
if (flowActivityTable != null) {
653-
LOG.info("closing the flowActivityTable table");
654-
// The close API performs flushing and releases any resources held
655-
flowActivityTable.close();
656-
}
657-
if (subApplicationTable != null) {
658-
subApplicationTable.close();
659-
}
660-
if (domainTable != null) {
661-
domainTable.close();
662-
}
663-
if (conn != null) {
664-
LOG.info("closing the hbase Connection");
665-
conn.close();
640+
641+
if (isStorageUp) {
642+
if (entityTable != null) {
643+
LOG.info("closing the entity table");
644+
// The close API performs flushing and releases any resources held
645+
entityTable.close();
646+
}
647+
if (appToFlowTable != null) {
648+
LOG.info("closing the app_flow table");
649+
// The close API performs flushing and releases any resources held
650+
appToFlowTable.close();
651+
}
652+
if (applicationTable != null) {
653+
LOG.info("closing the application table");
654+
applicationTable.close();
655+
}
656+
if (flowRunTable != null) {
657+
LOG.info("closing the flow run table");
658+
// The close API performs flushing and releases any resources held
659+
flowRunTable.close();
660+
}
661+
if (flowActivityTable != null) {
662+
LOG.info("closing the flowActivityTable table");
663+
// The close API performs flushing and releases any resources held
664+
flowActivityTable.close();
665+
}
666+
if (subApplicationTable != null) {
667+
subApplicationTable.close();
668+
}
669+
if (domainTable != null) {
670+
domainTable.close();
671+
}
672+
if (conn != null) {
673+
LOG.info("closing the hbase Connection");
674+
conn.close();
675+
}
666676
}
667677
storageMonitor.stop();
668678
super.serviceStop();

0 commit comments

Comments
 (0)