Project

General

Profile

« Previous | Next » 

Revision 2725

Added by Jing Tao about 19 years ago

Add more debug info.

View differences:

src/edu/ucsb/nceas/metacat/ReplicationHandler.java
64 64
  //PrintWriter out;
65 65
  private static final AbstractDatabase dbAdapter = MetaCatUtil.dbAdapter;
66 66
  private static Logger logMetacat = Logger.getLogger(ReplicationHandler.class);
67
 
68
  
67
  private static int DOCINSERTNUMBER = 1;
68
  private static int DOCERRORNUMBER  = 1;
69
  private static int REVINSERTNUMBER = 1;
70
  private static int REVERRORNUMBER  = 1;
69 71
  public ReplicationHandler()
70 72
  {
71 73
    //this.out = o;
......
224 226
        }
225 227
        //v is the list of updated documents
226 228
        Vector updateList = new Vector(message.getUpdatesVect());
229
        MetacatReplication.replLog("The document list size is "+updateList.size());
227 230
        //System.out.println("v: " + v.toString());
228 231
        //d is the list of deleted documents
229 232
        Vector deleteList = new Vector(message.getDeletesVect());
230 233
        //System.out.println("d: " + d.toString());
231 234
        logMetacat.info("Update vector size: "+ updateList.size());
232 235
        logMetacat.info("Delete vector size: "+ deleteList.size());
236
        MetacatReplication.replLog("The delete document list size is "+deleteList.size());
233 237
        // go though every element in updated document vector
234 238
        handleDocList(updateList, DocumentImpl.DOCUMENTTABLE);
235 239
        //handle deleted docs
......
249 253
        
250 254
        // handle replicate doc in xml_revision
251 255
        Vector revisionList = new Vector(message.getRevisionsVect());
256
        MetacatReplication.replLog("The revision document list size is "+revisionList.size());
252 257
        handleDocList(revisionList, DocumentImpl.REVISIONTABLE);
258
        DOCINSERTNUMBER = 1;
259
        DOCERRORNUMBER  = 1;
260
        REVINSERTNUMBER = 1;
261
        REVERRORNUMBER  = 1;
253 262
    }//for response
254 263

  
255 264
    //updated last_checked
......
352 361
                              createdDate,
353 362
                              updatedDate);
354 363
      logMetacat.info("Successfully replicated doc " + accNumber);
355
      MetacatReplication.replLog("wrote doc " + accNumber + " from " +
364
      if (tableName.equals(DocumentImpl.DOCUMENTTABLE))
365
      {
366
        MetacatReplication.replLog("" +DOCINSERTNUMBER + " Wrote xml doc " + accNumber +
367
                                     " into "+tableName + " from " +
356 368
                                         remoteserver);
369
        DOCINSERTNUMBER++;
370
      }
371
      else
372
      {
373
          MetacatReplication.replLog("" +REVINSERTNUMBER + " Wrote xml doc " + accNumber +
374
                  " into "+tableName + " from " +
375
                      remoteserver);
376
          REVINSERTNUMBER++;
377
      }
378
      
357 379

  
358 380
    }//try
359 381
    catch(Exception e)
360 382
    {
361
      MetacatReplication.replErrorLog("Failed to write doc " + accNumber +
362
                                      " into db because " +e.getMessage());
383
        
384
        if (tableName.equals(DocumentImpl.DOCUMENTTABLE))
385
        {
386
          MetacatReplication.replErrorLog("" +DOCERRORNUMBER + " Failed to write xml doc " + accNumber +
387
                                       " into "+tableName + " from " +
388
                                           remoteserver + " because "+e.getMessage());
389
          DOCERRORNUMBER++;
390
        }
391
        else
392
        {
393
            MetacatReplication.replLog("" +REVERRORNUMBER + " Failed to write xml doc " + accNumber +
394
                    " into "+tableName + " from " +
395
                        remoteserver +" because "+e.getMessage());
396
            REVERRORNUMBER++;
397
        }
398
       
363 399
      logMetacat.error("Failed to write doc " + accNumber +
364 400
                                      " into db because " +e.getMessage());
365 401
      throw e;
......
439 475
                                                updatedDate);
440 476
                                         
441 477
        logMetacat.info("Successfully to write datafile " + accNumber);
442
        MetacatReplication.replLog("wrote datafile " + accNumber + " from " +
443
                                    remoteserver);
478
        /*MetacatReplication.replLog("wrote datafile " + accNumber + " from " +
479
                                    remoteserver);*/
480
        if (tableName.equals(DocumentImpl.DOCUMENTTABLE))
481
        {
482
          MetacatReplication.replLog("" +DOCINSERTNUMBER + " Wrote data file" + accNumber +
483
                                       " into "+tableName + " from " +
484
                                           remoteserver);
485
          DOCINSERTNUMBER++;
486
        }
487
        else
488
        {
489
            MetacatReplication.replLog("" +REVINSERTNUMBER + " Wrote data file" + accNumber +
490
                    " into "+tableName + " from " +
491
                        remoteserver);
492
            REVINSERTNUMBER++;
493
        }
494
        
444 495
      }//if
445 496
      else
446 497
      {
......
451 502
    }//try
452 503
    catch(Exception e)
453 504
    {
454
      MetacatReplication.replErrorLog("Failed to try wrote datafile " + accNumber +
455
                                      " because " +e.getMessage());
505
      /*MetacatReplication.replErrorLog("Failed to try wrote datafile " + accNumber +
506
                                      " because " +e.getMessage());*/
507
      if (tableName.equals(DocumentImpl.DOCUMENTTABLE))
508
      {
509
        MetacatReplication.replErrorLog("" +DOCERRORNUMBER + " Failed to write xml doc " + accNumber +
510
                                     " into "+tableName + " from " +
511
                                         remoteserver + " because "+e.getMessage());
512
        DOCERRORNUMBER++;
513
      }
514
      else
515
      {
516
          MetacatReplication.replLog("" +REVERRORNUMBER + " Failed to write xml doc " + accNumber +
517
                  " into "+tableName + " from " +
518
                      remoteserver +" because "+e.getMessage());
519
          REVERRORNUMBER++;
520
      }
456 521
      logMetacat.error("Failed to try wrote datafile " + accNumber +
457 522
                                      " because " +e.getMessage());
458 523
      throw e;

Also available in: Unified diff