Show
Ignore:
Timestamp:
11/24/09 21:34:45 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1259098485 +0000
git-parent:

[53aeed588114b6e346057869dab719cefe3000c9]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1259098485 +0000
Message:

attempt jlog repairs inline

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_jlog_listener.c

    r53aeed5 re944e6d  
    3737#include "utils/noit_log.h" 
    3838#include "jlog/jlog.h" 
     39#include "jlog/jlog_private.h" 
    3940#include "noit_jlog_listener.h" 
    4041 
     
    153154    jlog_get_checkpoint(jcl->jlog, ac->remote_cn, &jcl->chkpt); 
    154155    jcl->count = jlog_ctx_read_interval(jcl->jlog, &jcl->start, &jcl->finish); 
     156    if(jcl->count < 0) { 
     157      char idxfile[PATH_MAX]; 
     158      noitL(noit_error, "jlog_ctx_read_interval: %s\n", 
     159            jlog_ctx_err_string(jcl->jlog)); 
     160      switch (jlog_ctx_err(jcl->jlog)) { 
     161        case JLOG_ERR_FILE_CORRUPT: 
     162        case JLOG_ERR_IDX_CORRUPT: 
     163          jlog_repair_datafile(jcl->jlog, jcl->start.log); 
     164          jlog_repair_datafile(jcl->jlog, jcl->start.log + 1); 
     165          noitL(noit_error, 
     166                "jlog reconstructed, deleting corresponding index.\n"); 
     167          STRSETDATAFILE(jcl->jlog, idxfile, jcl->start.log); 
     168          strlcat(idxfile, INDEX_EXT, sizeof(idxfile)); 
     169          unlink(idxfile); 
     170          STRSETDATAFILE(jcl->jlog, idxfile, jcl->start.log + 1); 
     171          strlcat(idxfile, INDEX_EXT, sizeof(idxfile)); 
     172          unlink(idxfile); 
     173          goto alldone; 
     174          break; 
     175        default: 
     176          goto alldone; 
     177      } 
     178    } 
    155179    if(jcl->count > MAX_ROWS_AT_ONCE) { 
    156180      /* Artificially set down the range to make the batches a bit easier