Revision 7127
Added by ben leinfelder over 12 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
446 | 446 |
// do we already have a replica? |
447 | 447 |
try { |
448 | 448 |
localId = IdentifierManager.getInstance().getLocalId(pid.getValue()); |
449 |
|
|
450 |
String msg = "Can't read the object bytes properly, replica is invalid."; |
|
451 |
ServiceFailure serviceFailure = new ServiceFailure("2151", msg); |
|
452 |
|
|
453 | 449 |
// if we have a local id, get the local object |
454 | 450 |
try { |
455 | 451 |
object = MetacatHandler.read(localId); |
456 |
|
|
457 | 452 |
} catch (Exception e) { |
453 |
// NOTE: we may already know about this ID because it could be a data file described by a metadata file |
|
454 |
// https://redmine.dataone.org/issues/2572 |
|
455 |
// TODO: fix this so that we don't prevent ourselves from getting replicas |
|
456 |
|
|
458 | 457 |
// let the CN know that the replication failed |
458 |
logMetacat.warn("Object content not found on this node despite having localId: " + localId); |
|
459 |
String msg = "Can't read the object bytes properly, replica is invalid."; |
|
460 |
ServiceFailure serviceFailure = new ServiceFailure("2151", msg); |
|
459 | 461 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, serviceFailure); |
460 | 462 |
logMetacat.warn(msg); |
461 | 463 |
throw serviceFailure; |
... | ... | |
498 | 500 |
Checksum givenChecksum = sysmeta.getChecksum(); |
499 | 501 |
Checksum computedChecksum = null; |
500 | 502 |
try { |
501 |
computedChecksum = ChecksumUtil.checksum(object, |
|
502 |
givenChecksum.getAlgorithm()); |
|
503 |
computedChecksum = ChecksumUtil.checksum(object, givenChecksum.getAlgorithm()); |
|
503 | 504 |
object.reset(); |
504 | 505 |
|
505 | 506 |
} catch (Exception e) { |
506 |
String msg = "Error computing checksum on replica: " |
|
507 |
+ e.getMessage(); |
|
507 |
String msg = "Error computing checksum on replica: " + e.getMessage(); |
|
508 | 508 |
logMetacat.error(msg); |
509 | 509 |
ServiceFailure sf = new ServiceFailure("2151", msg); |
510 | 510 |
sf.initCause(e); |
... | ... | |
523 | 523 |
// add it to local store |
524 | 524 |
Identifier retPid; |
525 | 525 |
try { |
526 |
// skip the MN.create -- this mutates the system metadata and we |
|
527 |
// dont want it to |
|
526 |
// skip the MN.create -- this mutates the system metadata and we don't want it to |
|
528 | 527 |
if ( localId == null ) { |
529 |
|
|
528 |
// TODO: this will fail if we already "know" about the identifier |
|
529 |
// FIXME: see https://redmine.dataone.org/issues/2572 |
|
530 | 530 |
retPid = super.create(session, pid, object, sysmeta); |
531 | 531 |
result = (retPid.getValue().equals(pid.getValue())); |
532 | 532 |
} |
Also available in: Unified diff
added comments and logging about https://redmine.dataone.org/issues/2572