Changeset 2203

Show
Ignore:
Timestamp:
05/29/11 21:19:58 (2 years ago)
Author:
ahu
Message:

latest revision of the mongodb backend

Location:
trunk/pdns/modules/mongodbbackend
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/modules/mongodbbackend/dnssec.cc

    r2162 r2203  
    282282 
    283283    m_db.update(collection_cryptokeys, mongo_q, update ); 
    284  
    285     if(logging_cerr)  
    286         cerr << backend_name << "(removeDomainKey) getLastError: "<< m_db.getLastError()<< endl; 
     284     
     285    string m_error = m_db.getLastError(); 
     286 
     287    if(logging_cerr && !m_error.empty()) 
     288        cerr << backend_name << "(removeDomainKey) getLastError: "<< m_error << endl; 
    287289     
    288290    return true; //?? how do we know that ?? 
  • trunk/pdns/modules/mongodbbackend/minimal.cc

    r2162 r2203  
    6666            L<<Logger::Error << backend_name << "(Re)creating index... " << endl; 
    6767 
     68 
    6869            m_db.ensureIndex(collection_domains , BSON( "domain_id" << 1), true, "domain_id", true); //, true); 
     70            L<<Logger::Error << backend_name << "Index: domains: 'domain_id' done." << endl; 
     71 
    6972            m_db.ensureIndex(collection_domains , BSON( "name" << 1), true, "name", true); //, true); 
     73            L<<Logger::Error << backend_name << "Index: domains: 'name' done." << endl; 
     74 
    7075            m_db.ensureIndex(collection_domains , BSON( "type" << 1), false, "type", true); //, true); 
    71             m_db.ensureIndex(collection_domains , BSON( "account" << 1), false, "type", true); //, true); 
     76            L<<Logger::Error << backend_name << "Index: domains: 'type' done." << endl; 
     77 
     78            m_db.ensureIndex(collection_domains , BSON( "account" << 1), false, "account", true); //, true); 
     79            L<<Logger::Error << backend_name << "Index: domains: 'account' done." << endl; 
     80 
    7281 
    7382            m_db.ensureIndex(collection_records, BSON( "domain_id" << 1), false, "domain_id", true); //, true); 
     83            L<<Logger::Error << backend_name << "Index: records: 'domain_id' done." << endl; 
     84             
    7485            m_db.ensureIndex(collection_records, BSON( "name" << 1), false, "name", true); //, true); 
     86            L<<Logger::Error << backend_name << "Index: records: 'name' done." << endl; 
     87 
    7588            m_db.ensureIndex(collection_records, BSON( "name" << 1 << "type" << 1), true, "name_type", true); //, true); 
     89            L<<Logger::Error << backend_name << "Index: records: 'name_type' done." << endl; 
     90 
    7691            m_db.ensureIndex(collection_records, BSON( "domain_id" << 1 << "auth" << 1 << "ordername" << -1), false, "domainid_auth_ordername_desc", true); //, true); 
     92            L<<Logger::Error << backend_name << "Index: records: 'domainid_auth_ordername_desc' done." << endl; 
     93 
    7794            m_db.ensureIndex(collection_records, BSON( "domain_id" << 1 << "auth" << 1 << "ordername" << 1), false, "domainid_auth_ordername_asc", true); //, true); 
     95            L<<Logger::Error << backend_name << "Index: records: 'domainid_auth_ordername_asc' done." << endl; 
     96 
    7897            m_db.ensureIndex(collection_records, BSON( "domain_id" << 1 << "name" << 1 ), false, "domainid_name", true); //, true); 
     98            L<<Logger::Error << backend_name << "Index: records: 'domainid_name' done." << endl; 
     99 
    79100 
    80101            m_db.ensureIndex(collection_domainmetadata, BSON( "name" << 1 ), true, "name", true); //, true); 
     102            L<<Logger::Error << backend_name << "Index: domainmetadata: 'name' done." << endl; 
     103 
    81104            m_db.ensureIndex(collection_domainmetadata, BSON( "name" << 1 << "content.kind" << 1), true, "name_kind", true); //, true); 
     105            L<<Logger::Error << backend_name << "Index: domainmetadata: 'name_kind' done." << endl; 
     106 
    82107 
    83108            m_db.ensureIndex(collection_cryptokeys, BSON( "domain_id" << 1 ), true, "domain_id", true); //, true); 
     109            L<<Logger::Error << backend_name << "Index: cryptokeys: 'domain_id' done." << endl; 
     110 
    84111            m_db.ensureIndex(collection_cryptokeys, BSON( "name" << 1 ), true, "name", true); //, true); 
     112            L<<Logger::Error << backend_name << "Index: cryptokeys: 'name'  done." << endl; 
     113 
    85114            m_db.ensureIndex(collection_cryptokeys, BSON( "name" << 1 << "domain_id" << 1), true, "name_domainid", true); //, true); 
     115            L<<Logger::Error << backend_name << "Index: cryptokeys: 'name_domainid'  done." << endl; 
     116 
    86117            m_db.ensureIndex(collection_cryptokeys, BSON( "domain_id" << 1 << "content.id" << 1), true, "domainid_id", true); //, true); 
     118            L<<Logger::Error << backend_name << "Index: cryptokeys: 'domainid_id'  done." << endl; 
     119 
    87120            m_db.ensureIndex(collection_cryptokeys, BSON( "name" << 1 << "content.id" << 1), true, "name_id", true); //, true); 
     121            L<<Logger::Error << backend_name << "Index: cryptokeys: 'name_id'  done." << endl; 
     122 
    88123 
    89124            m_db.ensureIndex(collection_tsigkeys, BSON( "name" << 1 << "content.algorithm" << 1), true, "name_algo", true); //, true); 
     125            L<<Logger::Error << backend_name << "Index: tsigkeys: 'name_algo' done." << endl; 
     126 
     127 
     128            L<<Logger::Error << backend_name << "(Re)creating index... DONE!" << endl; 
    90129 
    91130        } 
     
    102141   
    103142MONGODBBackend::~MONGODBBackend() { 
    104 //      delete m_db; 
     143//    delete m_db; 
    105144    L<<Logger::Info<<backend_name<<"Disconnected!" << endl; 
    106145} 
     
    128167     
    129168    mongo_query = q_type == "ANY" ? QUERY( "name" << toLower(qname) ) : QUERY( "name" << toLower(qname) << "type" << q_type); 
     169    mongo_query.hint(q_type == "ANY" ? BSON("name" << 1) : BSON("name" << 1 << "type" << 1)); 
    130170         
    131171    elements = false; 
     
    136176         
    137177    cursor = m_db.query(collection_records, mongo_query); 
    138          
     178     
    139179} 
    140180 
     
    253293            } 
    254294         
    255 //              if (contents) 
    256 //                      delete contents; 
     295//          if (contents) 
     296//              delete []contents; 
    257297 
    258298            contents = new mongo::BSONObjIterator(mongo_record.getObjectField("content")); 
     
    265305        } 
    266306    }  
    267          
     307 
    268308    return !rr.content.empty() ; 
    269309} 
     
    273313     
    274314    DomainInfo DI; 
    275  
     315     
    276316    return getDomainInfo(name, DI, &soadata); 
    277317} 
  • trunk/pdns/modules/mongodbbackend/private.cc

    r2162 r2203  
    2929        di->id = mongo_r->getIntField("domain_id"); 
    3030        di->last_check = mongo_r->getIntField("last_check"); 
     31        di->notified_serial = mongo_r->getIntField("notified_serial"); 
    3132 
    3233        if (soadata == NULL)