Project

General

Profile

« Previous | Next » 

Revision 7147

call MN.delete() for each replica when CN.delete() is called
https://redmine.dataone.org/issues/2676

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
349 349
	  }
350 350
	  
351 351
	  // defer to superclass implementation
352
      return super.delete(session, pid);
352
	  Identifier retId =  super.delete(session, pid);
353
      
354
	  // notify the replicas
355
	  SystemMetadata systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
356
	  if (systemMetadata.getReplicaList() != null) {
357
		  for (Replica replica: systemMetadata.getReplicaList()) {
358
			  NodeReference replicaNode = replica.getReplicaMemberNode();
359
			  try {
360
				  Identifier mnRetId = D1Client.getMN(replicaNode).delete(null, pid);
361
			  } catch (Exception e) {
362
				  // all we can really do is log errors and carry on with life
363
				  logMetacat.error("Error deleting pid: " +  pid.getValue() + " from replica MN: " + replicaNode.getValue(), e);
364
			}
365
			  
366
		  }
367
	  }
368
	  
369
	  return retId;
370
      
353 371
  }
354 372
  
355 373
  /**
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
209 209
      if (allowed) {
210 210
          try {
211 211
              // delete the document
212
        	  //  TODO: the method - or one like it - actually needs to remove content not just archive it
212 213
              DocumentImpl.delete(localId, username, groupnames, null);
213 214
              EventLog.getInstance().log(request.getRemoteAddr(), request.getHeader("User-Agent"), username, localId, Event.DELETE.xmlValue());
214 215

  
......
217 218
              sysMeta.setArchived(true);
218 219
              HazelcastService.getInstance().getSystemMetadataMap().put(pid, sysMeta);
219 220
              
220
              // remove the system metadata for it
221
              //HazelcastService.getInstance().getSystemMetadataMap().remove(pid);
222
              
223 221
          } catch (McdbDocNotFoundException e) {
224 222
              throw new NotFound("1340", "The provided identifier was invalid.");
225 223

  

Also available in: Unified diff