Changeset 2203
- Timestamp:
- 05/29/11 21:19:58 (2 years ago)
- Location:
- trunk/pdns/modules/mongodbbackend
- Files:
-
- 3 modified
-
dnssec.cc (modified) (1 diff)
-
minimal.cc (modified) (7 diffs)
-
private.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/modules/mongodbbackend/dnssec.cc
r2162 r2203 282 282 283 283 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; 287 289 288 290 return true; //?? how do we know that ?? -
trunk/pdns/modules/mongodbbackend/minimal.cc
r2162 r2203 66 66 L<<Logger::Error << backend_name << "(Re)creating index... " << endl; 67 67 68 68 69 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 69 72 m_db.ensureIndex(collection_domains , BSON( "name" << 1), true, "name", true); //, true); 73 L<<Logger::Error << backend_name << "Index: domains: 'name' done." << endl; 74 70 75 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 72 81 73 82 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 74 85 m_db.ensureIndex(collection_records, BSON( "name" << 1), false, "name", true); //, true); 86 L<<Logger::Error << backend_name << "Index: records: 'name' done." << endl; 87 75 88 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 76 91 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 77 94 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 78 97 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 79 100 80 101 m_db.ensureIndex(collection_domainmetadata, BSON( "name" << 1 ), true, "name", true); //, true); 102 L<<Logger::Error << backend_name << "Index: domainmetadata: 'name' done." << endl; 103 81 104 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 82 107 83 108 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 84 111 m_db.ensureIndex(collection_cryptokeys, BSON( "name" << 1 ), true, "name", true); //, true); 112 L<<Logger::Error << backend_name << "Index: cryptokeys: 'name' done." << endl; 113 85 114 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 86 117 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 87 120 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 88 123 89 124 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; 90 129 91 130 } … … 102 141 103 142 MONGODBBackend::~MONGODBBackend() { 104 // delete m_db;143 // delete m_db; 105 144 L<<Logger::Info<<backend_name<<"Disconnected!" << endl; 106 145 } … … 128 167 129 168 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)); 130 170 131 171 elements = false; … … 136 176 137 177 cursor = m_db.query(collection_records, mongo_query); 138 178 139 179 } 140 180 … … 253 293 } 254 294 255 // if (contents)256 // deletecontents;295 // if (contents) 296 // delete []contents; 257 297 258 298 contents = new mongo::BSONObjIterator(mongo_record.getObjectField("content")); … … 265 305 } 266 306 } 267 307 268 308 return !rr.content.empty() ; 269 309 } … … 273 313 274 314 DomainInfo DI; 275 315 276 316 return getDomainInfo(name, DI, &soadata); 277 317 } -
trunk/pdns/modules/mongodbbackend/private.cc
r2162 r2203 29 29 di->id = mongo_r->getIntField("domain_id"); 30 30 di->last_check = mongo_r->getIntField("last_check"); 31 di->notified_serial = mongo_r->getIntField("notified_serial"); 31 32 32 33 if (soadata == NULL)