Revision 8589
Added by Chris Jones almost 11 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
545 | 545 |
sysMeta.setArchived(true); |
546 | 546 |
sysMeta.setDateSysMetadataModified(Calendar.getInstance().getTime()); |
547 | 547 |
HazelcastService.getInstance().getSystemMetadataMap().put(pid, sysMeta); |
548 |
|
|
548 |
// notify the replicas |
|
549 |
notifyReplicaNodes(sysMeta); |
|
550 |
|
|
549 | 551 |
} else { |
550 | 552 |
throw new ServiceFailure("4972", "Couldn't archive the object " + pid.getValue() + |
551 | 553 |
". Couldn't obtain the system metadata record."); |
... | ... | |
569 | 571 |
|
570 | 572 |
} |
571 | 573 |
|
572 |
// get the node list |
|
573 |
try { |
|
574 |
cn = D1Client.getCN(); |
|
575 |
nodeList = cn.listNodes().getNodeList(); |
|
576 |
|
|
577 |
} catch (Exception e) { // handle BaseException and other I/O issues |
|
578 |
|
|
579 |
// swallow errors since the call is not critical |
|
580 |
logMetacat.error("Can't inform MNs of the archive of " + pid.getValue() + |
|
581 |
" due to communication issues with the CN: " + e.getMessage()); |
|
582 |
|
|
583 |
} |
|
584 |
|
|
585 |
// notify the replicas |
|
586 |
SystemMetadata systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid); |
|
587 |
if (systemMetadata.getReplicaList() != null) { |
|
588 |
for (Replica replica: systemMetadata.getReplicaList()) { |
|
589 |
NodeReference replicaNode = replica.getReplicaMemberNode(); |
|
590 |
try { |
|
591 |
if (nodeList != null) { |
|
592 |
// find the node type |
|
593 |
for (Node node : nodeList) { |
|
594 |
if ( node.getIdentifier().getValue().equals(replicaNode.getValue()) ) { |
|
595 |
nodeType = node.getType(); |
|
596 |
break; |
|
597 |
|
|
598 |
} |
|
599 |
} |
|
600 |
} |
|
601 |
|
|
602 |
// only send call MN.archive() to avoid an infinite loop with the CN |
|
603 |
if (nodeType != null && nodeType == NodeType.MN) { |
|
604 |
Identifier mnRetId = D1Client.getMN(replicaNode).archive(null, pid); |
|
605 |
|
|
606 |
} |
|
607 |
|
|
608 |
} catch (Exception e) { |
|
609 |
// all we can really do is log errors and carry on with life |
|
610 |
logMetacat.error("Error archiving pid: " + pid.getValue() + |
|
611 |
" from replica MN: " + replicaNode.getValue(), e); |
|
612 |
} |
|
613 |
|
|
614 |
} |
|
615 |
} |
|
616 |
|
|
617 | 574 |
return pid; |
618 | 575 |
|
619 | 576 |
} |
Also available in: Unified diff
Change CnodeService.archive() to no longer broadcast MN.archive() calls to all of the replica MNs of a pid, but rather broadcast MN.systemMetadataChanged().