Changeset 7397131


Ignore:
Timestamp:
04/06/15 10:49:40 (5 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.1.2, releng/10.2
Children:
0cc9172
Parents:
fc252bd
Message:

Fix the syscache Hash validation routine to skip the lists of jails (stopped/running), those hash sections are *allowed* to be empty, and should not trigger a re-sync of the database

Location:
src-sh/syscache/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-sh/syscache/daemon/DB.cpp

    rb7a102e r7397131  
    9797  //Determine the internal hash key for the particular request 
    9898  if(request.length()==1){ 
    99     if(request[0]=="startsync"){ kickoffSync(); return "Starting Sync..."; } 
     99    if(request[0]=="startsync"){  
     100      if( kickoffSync() ){ 
     101        writeToLog("User Sync Request..."); 
     102      } 
     103      return "Starting Sync..."; 
     104    } 
    100105    else if(request[0]=="hasupdates"){ hashkey = "System/hasUpdates"; } 
    101106    else if(request[0]=="needsreboot"){ return (QFile::exists(REBOOT_FLAG) ? "true": "false"); } 
     
    413418  // - This does not check the particular/individual field for availability 
    414419  QString chk = key.section("/",0,0)+"/"; 
     420  if(chk.contains("JailList")){ return; } //skip this validation for lists of jails (this *can* be empty) 
    415421  if(key.contains("/pkg/")){ chk = key.section("/pkg/",0,0)+"/pkg/"; } //Make this jail/ID specific 
    416422  if( QStringList(HASH->keys()).filter(chk).isEmpty() && !sysrun){ 
     423    writeToLog("Empty Hash Detected: Starting Sync..."); 
     424    writeToLog("Check: " + chk+ "\nKeys: " + QStringList(HASH->keys()).filter(chk).join(", ") ); 
    417425    kickoffSync();  
    418426  } 
     
    480488} 
    481489 
    482 void DB::kickoffSync(){ 
    483   if(sysrun){ return; } //already running a sync (sysrun is the last one to be finished) 
     490bool DB::kickoffSync(){ 
     491  if(sysrun){ return false; } //already running a sync (sysrun is the last one to be finished) 
    484492  writeToLog("Starting Sync: "+QDateTime::currentDateTime().toString(Qt::ISODate) ); 
    485493  locrun = remrun = pbirun = jrun = sysrun = true; //switch all the flags to running 
    486494  //if(!syncThread->isRunning()){ syncThread->start(); } //make sure the other thread is running 
    487495  QTimer::singleShot(0,SYNC, SLOT(performSync())); 
     496  return true; 
    488497} 
    489498 
  • src-sh/syscache/daemon/DB.h

    rfbd9980 r7397131  
    116116private slots: 
    117117        void watcherChange(QString); //watcher found something change 
    118         void kickoffSync(); 
     118        bool kickoffSync(); 
    119119         
    120120        //Syncer status updates 
Note: See TracChangeset for help on using the changeset viewer.