Project

General

Profile

« Previous | Next » 

Revision 10118

Added by Jing Tao over 7 years ago

Add some performace debug information.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
325 325
        UnsupportedType, InsufficientResources, NotFound, 
326 326
        InvalidSystemMetadata, NotImplemented, InvalidRequest {
327 327
        
328
        long startTime = System.currentTimeMillis();
329
        
328 330
        if(isReadOnlyMode()) {
329 331
            throw new ServiceFailure("1310", ReadOnlyChecker.DATAONEERROR);
330 332
        }
......
389 391
                    "identifier "+pid.getValue()+" can't be identified since - "+ee.getMessage());
390 392
        }
391 393
        
394
        long end =System.currentTimeMillis();
395
        logMetacat.debug("MNodeService.update - the time spending on checking the validation of the old pid "+pid.getValue()+" and the new pid "+newPid.getValue()+" is "+(end- startTime)+ " milli seconds.");
396
        
392 397
        // set the originating node
393 398
        NodeReference originMemberNode = this.getCapabilities().getIdentifier();
394 399
        sysmeta.setOriginMemberNode(originMemberNode);
......
405 410
        if (serialVersion == null) {
406 411
        	sysmeta.setSerialVersion(BigInteger.ZERO);
407 412
        }
408

  
413
        long startTime2 = System.currentTimeMillis();
409 414
        // does the subject have WRITE ( == update) priveleges on the pid?
410 415
        //allowed = isAuthorized(session, pid, Permission.WRITE);
411 416
        //CN having the permission is allowed; user with the write permission and calling on the authoritative node is allowed.
......
425 430
            throw new InvalidToken("1210", "Can't determine if the client has the permission to update the object with id "+pid.getValue()+" since "+e.getDescription());
426 431
        }
427 432
        
433
        end =System.currentTimeMillis();
434
        logMetacat.debug("MNodeService.update - the time spending on checking if the user has the permission to update the old pid "+pid.getValue()+" with the new pid "+newPid.getValue()+" is "+(end- startTime2)+ " milli seconds.");
435
        
428 436
        if (allowed) {
429
        	
437
            long startTime3 = System.currentTimeMillis();
430 438
        	// check quality of SM
431 439
        	if (sysmeta.getObsoletedBy() != null) {
432 440
        		throw new InvalidSystemMetadata("1300", "Cannot include obsoletedBy when updating object");
......
451 459
            	throw new InvalidRequest("1202", 
452 460
            			"The previous identifier has already been made obsolete by: " + existingObsoletedBy.getValue());
453 461
            }
462
            end =System.currentTimeMillis();
463
            logMetacat.debug("MNodeService.update - the time spending on checking the quality of the system metadata of the old pid "+pid.getValue()+" and the new pid "+newPid.getValue()+" is "+(end- startTime3)+ " milli seconds.");
464
           
454 465
            //check the sid in the system metadata. If it exists, it should be non-exist or match the old sid in the previous system metadata.
455 466
            Identifier sidInSys = sysmeta.getSeriesId();
456 467
            if(sidInSys != null) {
......
492 503
                    throw new InvalidSystemMetadata("1300", "The series id "+sidInSys.getValue()+" in the system metadata shouldn't have the same value of the pid.");
493 504
                }
494 505
            }
506
            
507
            long end2 =System.currentTimeMillis();
508
            logMetacat.debug("MNodeService.update - the time spending on checking the sid validation of the old pid "+pid.getValue()+" and the new pid "+newPid.getValue()+" is "+(end2- end)+ " milli seconds.");
509
           
495 510

  
496 511
            isScienceMetadata = isScienceMetadata(sysmeta);
497 512

  
......
529 544

  
530 545
            }
531 546
            
547
            long end3 =System.currentTimeMillis();
548
            logMetacat.debug("MNodeService.update - the time spending on saving the object with the new pid "+newPid.getValue()+" is "+(end3- end2)+ " milli seconds.");
549
           
532 550
            // add the newPid to the obsoletedBy list for the existing sysmeta
533 551
            existingSysMeta.setObsoletedBy(newPid);
534 552
            //increase version
......
550 568
            // log the update event
551 569
            EventLog.getInstance().log(request.getRemoteAddr(), request.getHeader("User-Agent"), subject.getValue(), localId, Event.UPDATE.toString());
552 570
            
571
            long end4 =System.currentTimeMillis();
572
            logMetacat.debug("MNodeService.update - the time spending on updating/saving system metadata  of the old pid "+pid.getValue()+" and the new pid "+newPid.getValue()+" and saving the log information is "+(end4- end3)+ " milli seconds.");
573
            
553 574
            // attempt to register the identifier - it checks if it is a doi
554 575
            try {
555 576
    			DOIService.getInstance().registerDOI(sysmeta);
556 577
    		} catch (Exception e) {
557 578
                throw new ServiceFailure("1190", "Could not register DOI: " + e.getMessage());
558 579
    		}
559

  
580
            long end5 =System.currentTimeMillis();
581
            logMetacat.debug("MNodeService.update - the time spending on registering the doi (if it is doi ) of the new pid "+newPid.getValue()+" is "+(end5- end4)+ " milli seconds.");
582
            
560 583
        } else {
561 584
            throw new NotAuthorized("1200", "The provided identity does not have " + "permission to UPDATE the object identified by " + pid.getValue()
562 585
                    + " on the Member Node.");
563 586
        }
564 587

  
588
        long end6 =System.currentTimeMillis();
589
        logMetacat.debug("MNodeService.update - the total time of updating the old pid " +pid.getValue() +" whth the new pid "+newPid.getValue()+" is "+(end6- startTime)+ " milli seconds.");
565 590
        return newPid;
566 591
    }
567 592

  

Also available in: Unified diff