Changeset 362

Show
Ignore:
Timestamp:
04/26/08 20:32:35 (7 months ago)
Author:
jake
Message:

Bloom filter size not configurable, need to implement dynamic blooms

Location:
trunk/thrudex/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/thrudex/src/CLuceneBackend.cpp

    r350 r362  
    66 
    77#include "CLuceneBackend.h" 
     8#include "ConfigFile.h" 
    89#include "utils.h" 
    910#include <boost/filesystem.hpp> 
     
    8687        return; 
    8788 
     89    size_t filter_space = ConfigManager->read<int>("FILTER_SPACE_SIZE",1000000); 
     90 
    8891    index_cache[index] = 
    89         shared_ptr<CLuceneIndex>(new CLuceneIndex(idx_root,index,analyzer)); 
     92        shared_ptr<CLuceneIndex>(new CLuceneIndex(idx_root,index,filter_space,analyzer)); 
    9093} 
    9194 
     
    101104        throw ex; 
    102105    } 
    103  
    104106 
    105107    lucene::document::Document *doc = new lucene::document::Document(); 
     
    240242    } else if (op == "put_log_position") { 
    241243        fs::ofstream outfile; 
    242         outfile.open( log_pos_file.c_str (),  
     244        outfile.open( log_pos_file.c_str (), 
    243245                      ios::out | ios::binary | ios::trunc); 
    244246        if (!outfile.is_open ()) 
  • trunk/thrudex/src/CLuceneIndex.cpp

    r349 r362  
    4646}; 
    4747 
    48 CLuceneIndex::CLuceneIndex(const string &index_root, const string &index_name, shared_ptr<Analyzer> analyzer) 
    49     : index_root(index_root), index_name(index_name), analyzer(analyzer), filter_space(10000000), last_synched(0), syncing(false) 
     48CLuceneIndex::CLuceneIndex(const string &index_root, const string &index_name, const size_t &filter_space, shared_ptr<Analyzer> analyzer) 
     49    : index_root(index_root), index_name(index_name), analyzer(analyzer), filter_space(filter_space), last_synched(0), syncing(false) 
    5050{ 
    5151 
     
    167167 
    168168        modifier->flush(); 
    169        
     169 
    170170        ram_searcher.reset(); 
    171171 
    172         //shared_ptr<CLuceneRAMDirectory> l_ram_readonly_directory = ram_readonly_directory; 
     172        //shared_ptr<CLuceneRAMDirectory> l_ram_readonly_directory = ram_readonly_directory; 
    173173 
    174174        //make a copy of the ram dir since its not thread safe 
     
    186186        if(syncing){ 
    187187            //make a copy of the ram dir since its not thread safe 
    188           ram_readonly_prev_directory = shared_ptr<CLuceneRAMDirectory>(new CLuceneRAMDirectory( ram_prev_directory.get() ), null_deleter() ); 
    189           ram_readonly_prev_directory->__cl_addref(); //trick clucene's lame ref counters 
     188          ram_readonly_prev_directory = shared_ptr<CLuceneRAMDirectory>(new CLuceneRAMDirectory( ram_prev_directory.get() ), null_deleter() ); 
     189          ram_readonly_prev_directory->__cl_addref(); //trick clucene's lame ref counters 
    190190 
    191191            ram_prev_searcher.reset(new IndexSearcher( ram_readonly_prev_directory.get() )); 
  • trunk/thrudex/src/CLuceneIndex.h

    r347 r362  
    4747    CLuceneIndex(const std::string &index_root, 
    4848                 const std::string &index_name, 
     49                 const std::size_t &filter_space, 
    4950                 boost::shared_ptr<lucene::analysis::Analyzer> analyzer); 
    5051 
     
    6465 
    6566    static log4cxx::LoggerPtr                        logger; 
    66     facebook::thrift::concurrency::Mutex           mutex; 
    67     //facebook::thrift::concurrency::ReadWriteMutex    mutex; 
     67    facebook::thrift::concurrency::Mutex             mutex; 
    6868 
    6969    const std::string                                index_root; 
     
    7171    boost::shared_ptr<lucene::analysis::Analyzer>    analyzer; 
    7272 
    73     int filter_space; 
     73    std::size_t filter_space; 
    7474 
    7575    boost::shared_ptr<lucene::index::IndexModifier>  modifier;