/[collab-maint]/deb-maint/pinot/trunk/Core/DaemonState.cpp
ViewVC logotype

Diff of /deb-maint/pinot/trunk/Core/DaemonState.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 12863 by hanska-guest, Sat Apr 11 09:27:25 2009 UTC revision 12864 by hanska-guest, Fri May 1 06:48:47 2009 UTC
# Line 312  bool DBusServletInfo::reply(void) Line 312  bool DBusServletInfo::reply(void)
312    
313  DaemonState::DaemonState() :  DaemonState::DaemonState() :
314          ThreadsManager(PinotSettings::getInstance().m_daemonIndexLocation, 4),          ThreadsManager(PinotSettings::getInstance().m_daemonIndexLocation, 4),
         m_fullScan(false),  
315          m_isReindex(false),          m_isReindex(false),
316          m_reload(false),          m_reload(false),
317          m_flush(false),          m_flush(false),
# Line 460  bool DaemonState::crawl_location(const P Line 459  bool DaemonState::crawl_location(const P
459                  // Monitoring is not necessary, but we still have to pass the handler                  // Monitoring is not necessary, but we still have to pass the handler
460                  // so that we can act on documents that have been deleted                  // so that we can act on documents that have been deleted
461                  pCrawlerThread = new CrawlerThread(locationToCrawl, isSource,                  pCrawlerThread = new CrawlerThread(locationToCrawl, isSource,
462                          m_fullScan, m_isReindex, NULL, m_pDiskHandler);                          m_isReindex, NULL, m_pDiskHandler);
463          }          }
464          else          else
465          {          {
466                  pCrawlerThread = new CrawlerThread(locationToCrawl, isSource,                  pCrawlerThread = new CrawlerThread(locationToCrawl, isSource,
467                          m_fullScan, m_isReindex, m_pDiskMonitor, m_pDiskHandler);                          m_isReindex, m_pDiskMonitor, m_pDiskHandler);
468          }          }
469          pCrawlerThread->getFileFoundSignal().connect(sigc::mem_fun(*this, &DaemonState::on_message_filefound));          pCrawlerThread->getFileFoundSignal().connect(sigc::mem_fun(*this, &DaemonState::on_message_filefound));
470    
# Line 480  bool DaemonState::crawl_location(const P Line 479  bool DaemonState::crawl_location(const P
479          return false;          return false;
480  }  }
481    
482  void DaemonState::start(bool forceFullScan, bool isReindex)  void DaemonState::start(bool isReindex)
483  {  {
484          // Disable implicit flushing after a change          // Disable implicit flushing after a change
485          WorkerThread::immediateFlush(false);          WorkerThread::immediateFlush(false);
486    
         // Do full scans ?  
         if (forceFullScan == true)  
         {  
                 m_fullScan = true;  
         }  
         else  
         {  
                 Rand randomStuff;  
                 guint32 randomArray[5];  
   
                 randomStuff.set_seed(randomArray[2]);  
                 gint32 randomNum = randomStuff.get_int_range(0, 10);  
                 if (randomNum >= 7)  
                 {  
                         m_fullScan = true;  
                 }  
 #ifdef DEBUG  
                 cout << "DaemonState::start: picked " << randomNum << endl;  
 #endif  
         }  
487          m_isReindex = isReindex;          m_isReindex = isReindex;
488    
489          // Fire up the disk monitor thread          // Fire up the disk monitor thread
# Line 526  void DaemonState::start(bool forceFullSc Line 505  void DaemonState::start(bool forceFullSc
505          cout << "DaemonState::start: " << m_crawlQueue.size() << " locations to crawl" << endl;          cout << "DaemonState::start: " << m_crawlQueue.size() << " locations to crawl" << endl;
506  #endif  #endif
507    
508          if (m_fullScan == true)          CrawlHistory crawlHistory(PinotSettings::getInstance().getHistoryDatabaseName());
         {  
                 CrawlHistory crawlHistory(PinotSettings::getInstance().getHistoryDatabaseName());  
509    
510                  // Update all items status so that we can get rid of files from deleted sources          // Update all items status so that we can get rid of files from deleted sources
511                  crawlHistory.updateItemsStatus(CrawlHistory::CRAWLING, CrawlHistory::TO_CRAWL, 0, true);          crawlHistory.updateItemsStatus(CrawlHistory::CRAWLING, CrawlHistory::TO_CRAWL, 0, true);
512                  crawlHistory.updateItemsStatus(CrawlHistory::CRAWLED, CrawlHistory::TO_CRAWL, 0, true);          crawlHistory.updateItemsStatus(CrawlHistory::CRAWLED, CrawlHistory::TO_CRAWL, 0, true);
513                  crawlHistory.updateItemsStatus(CrawlHistory::CRAWL_ERROR, CrawlHistory::TO_CRAWL, 0, true);          crawlHistory.updateItemsStatus(CrawlHistory::CRAWL_ERROR, CrawlHistory::TO_CRAWL, 0, true);
         }  
514    
515          // Initiate crawling          // Initiate crawling
516          start_crawling();          start_crawling();
# Line 567  bool DaemonState::start_crawling(void) Line 543  bool DaemonState::start_crawling(void)
543    
544                                  startedCrawler = crawl_location(nextLocation);                                  startedCrawler = crawl_location(nextLocation);
545                          }                          }
546                          else if (m_fullScan == true)                          else
547                          {                          {
548                                  CrawlHistory crawlHistory(PinotSettings::getInstance().getHistoryDatabaseName());                                  CrawlHistory crawlHistory(PinotSettings::getInstance().getHistoryDatabaseName());
549                                  set<string> deletedFiles;                                  set<string> deletedFiles;
# Line 785  void DaemonState::on_thread_end(WorkerTh Line 761  void DaemonState::on_thread_end(WorkerTh
761                  m_reload = false;                  m_reload = false;
762    
763                  // ...and restart everything                  // ...and restart everything
764                  start(true, false);                  start(false);
765          }          }
766    
767          // Try to run a queued action unless threads were stopped          // Try to run a queued action unless threads were stopped

Legend:
Removed from v.12863  
changed lines
  Added in v.12864

  ViewVC Help
Powered by ViewVC 1.1.5